HYDocumentMS.FileAuth.UserFileAuthFrm.btnSubmit_Click C# (CSharp) Метод

btnSubmit_Click() приватный Метод

private btnSubmit_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            createDate = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            Boolean bl = false;
            listFileChk = new List<string>();
            foreach (DataGridViewRow row in this.dGVFileList.Rows)
            {

                string temp = row.Cells["CHK"].Value.ToString();
                bl = Convert.ToBoolean(temp);
                if (bl == true)
                {
                    listFileChk.Add(row.Cells["DFL_ID"].Value.ToString());
                }
                // MessageBox.Show(bl.ToString());
            }
            if (listFileChk.Count == 0)
            {
                MessageBox.Show("没有选中任何文件!!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                return;
            }
            fileView = this.chkFileView.Checked == true ? "Y" : "N";
            fileEdit = this.chkFileEdit.Checked == true ? "Y" : "N";
            fileDelete = this.chkFileDelete.Checked == true ? "Y" : "N";
            fileUpload = this.chkFileUpLoad.Checked == true ? "Y" : "N";
            fileDownLoad = this.chkFileDownLoad.Checked == true ? "Y" : "N";
            fileChkIn = this.chkFileCheckIn.Checked == true ? "Y" : "N";
            fileChkOut = this.chkFileCheckOut.Checked == true ? "Y" : "N";
            createDate = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            //string folderCreate = this.chkFolderCreate.Checked == true ? "Y" : "N";
            //string folderDelete = this.chkFolderDelete.Checked == true ? "Y" : "N";
            //string folderEdit = this.chkFolderEdit.Checked == true ? "Y" : "N";
            FILE_AUTH auth = null;
            Boolean blStart = true;
            if (fileView == "N" && fileEdit == "N" && fileDelete == "N" && fileUpload == "N" && fileDownLoad == "N" && fileChkIn == "N" && fileChkOut == "N")
            {
                if (MessageBox.Show("没有设定任何权限,请确认是否继续!!", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.OK)
                {
                    ///继续
                    ///
                }
                else
                {
                    blStart = false;
                }
            }
            if (blStart)
            {
                if (AuthObjectType == DataType.AuthObjectType.UserRole)
                {

                    foreach (string fileKey in listFileChk)
                    {
                        try
                        {
                            auth = _fileAuth.GetFileAuth(DataType.AuthObjectType.UserRole.ToString(), this.UserRole, "N", fileKey);
                            if (auth == null)
                            {
                                auth = new FILE_AUTH();
                                auth.CREATEUSER = LoginInfo.LoginID;
                                auth.CREATEDATE = createDate;
                                auth.FAU_ID = Guid.NewGuid().ToString();
                            }
                            else
                            {
                                auth.LASTUPDATEUSER = LoginInfo.LoginID;
                                auth.LASTUPDATEDATE = createDate;
                            }

                            auth.DEL_FLAG = "N";
                            auth.FAU_CHECKIN = fileChkIn;
                            auth.FAU_CHECKOUT = fileChkOut;
                            auth.FAU_DELETE = fileDelete;
                            auth.FAU_DOWNLOAD = fileDownLoad;
                            auth.FAU_UPLOAD = fileUpload;
                            auth.FAU_VIEW = fileView;
                            auth.FAU_EDIT = fileEdit;

                            auth.FAU_OBJ_TYPE = DataType.AuthObjectType.UserRole.ToString();
                            auth.FAU_OBJ_VALUE = this.UserRole.ToString();
                            auth.DFL_ID = fileKey.ToString();
                            auth.FAU_IS_FOLDER = "N";
                            auth.Save();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message.ToString(), "插入异常", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                            return;
                        }
                        finally
                        {

                        }
                    }
                    MessageBox.Show("插入成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    this.Close();
                    //DOC_FILE_LIST list = new DOC_FILE_LIST();

                }
                else if (AuthObjectType == DataType.AuthObjectType.SingleUser)
                {
                    foreach (string fileKey in listFileChk)
                    {
                        try
                        {
                            auth = _fileAuth.GetFileAuth(DataType.AuthObjectType.SingleUser.ToString(), this.UserAccount, "N", fileKey);
                            if (auth == null)
                            {
                                auth = new FILE_AUTH();
                                auth.CREATEUSER = LoginInfo.LoginID;
                                auth.CREATEDATE = createDate;
                                auth.FAU_ID = Guid.NewGuid().ToString();
                            }
                            else
                            {
                                auth.LASTUPDATEUSER = LoginInfo.LoginID;
                                auth.LASTUPDATEDATE = createDate;
                            }
                            auth.DEL_FLAG = "N";
                            auth.FAU_CHECKIN = fileChkIn;
                            auth.FAU_CHECKOUT = fileChkOut;
                            auth.FAU_DELETE = fileDelete;
                            auth.FAU_DOWNLOAD = fileDownLoad;
                            auth.FAU_UPLOAD = fileUpload;
                            auth.FAU_VIEW = fileView;
                            auth.FAU_EDIT = fileEdit;

                            auth.FAU_OBJ_TYPE = DataType.AuthObjectType.SingleUser.ToString();
                            auth.FAU_OBJ_VALUE = this.UserAccount.ToString();
                            auth.DFL_ID = fileKey.ToString();
                            auth.FAU_IS_FOLDER = "N";
                            auth.Save();

                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message.ToString(), "插入异常", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                            return;
                        }
                        finally
                        {

                        }
                    }
                    MessageBox.Show("插入成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    this.Close();
                }
            }
        }