Esempio n. 1
0
        void OperationBusiness()
        {
            string type = GetMode(panel2);
            string mode = GetMode(panel3);

            if (type.Trim().Length == 0 || mode.Trim().Length == 0)
            {
                MessageDialog.ShowPromptMessage("请选择【单据类型】、【操作类型】");
                return;
            }
            CE_HR_AttendanceExceptionType billType =
                GlobalObject.GeneralFunction.StringConvertToEnum <CE_HR_AttendanceExceptionType>(type);
            CE_OperatorMode operationMode =
                GlobalObject.GeneralFunction.StringConvertToEnum <CE_OperatorMode>(mode);

            if (!CheckData())
            {
                return;
            }

            List <object>             lstInfo      = new List <object>();
            List <PersonnelBasicInfo> lstPersonnel = new List <PersonnelBasicInfo>();

            lstInfo.Add(ServerTime.ConvertToDateTime(dtp_BeginTime.Value));
            lstInfo.Add(ServerTime.ConvertToDateTime(dtp_EndTime.Value));
            lstInfo.Add(cmb_BusinessType.Text);
            lstInfo.Add(txtContent.Text.Trim());
            lstInfo.Add(num_Hours.Value);

            if (operationMode == CE_OperatorMode.添加)
            {
                lstInfo.Add(null);

                MessageDialog.ShowPromptMessage(string.Format("请设置需要【{0}】的人员", billType.ToString()));
                FormSelectPersonnel2 frm = new FormSelectPersonnel2();

                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                else
                {
                    if (frm.SelectedNotifyPersonnelInfo.UserType != BillFlowMessage_ReceivedUserType.用户.ToString())
                    {
                        MessageDialog.ShowPromptMessage("请选择【用户】");
                        return;
                    }
                    else
                    {
                        lstPersonnel = frm.SelectedNotifyPersonnelInfo.PersonnelBasicInfoList;
                    }
                }

                _serviceAnalysis.Operation_Exception(billType, operationMode, lstInfo, lstPersonnel);
            }
            else if (operationMode == CE_OperatorMode.修改)
            {
                lstInfo.Add((int)customDataGridView1.CurrentRow.Cells["单据号"].Value);

                if (MessageDialog.ShowEnquiryMessage("你确定要【" + operationMode.ToString() + "】?") == DialogResult.No)
                {
                    return;
                }

                _serviceAnalysis.Operation_Exception(billType, operationMode, lstInfo, lstPersonnel);
            }
            else if (operationMode == CE_OperatorMode.除)
            {
                if (MessageDialog.ShowEnquiryMessage("你确定要【" + operationMode.ToString() + "】?") == DialogResult.No)
                {
                    return;
                }

                if (customDataGridView1.SelectedRows.Count == 0)
                {
                    MessageDialog.ShowPromptMessage("请选择需要【删除】的记录");
                    return;
                }

                foreach (DataGridViewRow dgvr in customDataGridView1.SelectedRows)
                {
                    lstInfo.Add((int)dgvr.Cells["单据号"].Value);
                    lstPersonnel = new List <PersonnelBasicInfo>();
                    PersonnelBasicInfo personnel = new PersonnelBasicInfo();

                    personnel.工号 = dgvr.Cells["执行人"].Value.ToString();
                    lstPersonnel.Add(personnel);

                    _serviceAnalysis.Operation_Exception(billType, operationMode, lstInfo, lstPersonnel);
                }
            }

            MessageDialog.ShowPromptMessage(string.Format("【{0}单{1}成功】", billType.ToString(), operationMode.ToString()));
            RefreshDataGridView();
        }