Example #1
0
        private void btnSelectAnalyze_Click(object sender, EventArgs e)
        {
            string workID = "";

            try
            {
                IAttendanceAnalysis  serviceAnalysis = Service_Peripheral_HR.ServerModuleFactory.GetServerModule <IAttendanceAnalysis>();
                FormSelectPersonnel2 frm             = new FormSelectPersonnel2();

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    if (frm.SelectedNotifyPersonnelInfo.UserType == BillFlowMessage_ReceivedUserType.用户.ToString())
                    {
                        foreach (PersonnelBasicInfo personnelInfo in frm.SelectedNotifyPersonnelInfo.PersonnelBasicInfoList)
                        {
                            workID = personnelInfo.工号;
                            serviceAnalysis.Analysis_Main(dtpBeginDate.Value.Date, dtpEndDate.Value.Date, personnelInfo.工号);
                        }

                        MessageDialog.ShowPromptMessage("分析完成");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message + " 工号:" + workID);
            }
        }
Example #2
0
 private void btnOK_1_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageBox.Show("节假日、集体异常、员工方案等所有信息是否都已经设置完成?", "消息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             IAttendanceAnalysis serviceAnalysis = Service_Peripheral_HR.ServerModuleFactory.GetServerModule <IAttendanceAnalysis>();
             serviceAnalysis.Analysis_Main(dtpBeginDate.Value.Date, dtpEndDate.Value.Date, null);
             MessageDialog.ShowPromptMessage("分析完成");
         }
     }
     catch (Exception ex)
     {
         MessageDialog.ShowPromptMessage(ex.Message);
     }
 }
        /// <summary>
        /// 操作补单情况下的考勤流水与异常信息
        /// </summary>
        /// <param name="dataContxt">数据上下文</param>
        /// <param name="billNo">关联单号</param>
        /// <param name="exceptionType">异常类型</param>
        /// <returns>成功返回True失败返回False</returns>
        public void OperationTimeException_Replenishments(DepotManagementDataContext dataContxt, string billNo, CE_HR_AttendanceExceptionType exceptionType)
        {
            IAttendanceAnalysis service = ServerModuleFactory.GetServerModule <IAttendanceAnalysis>();

            try
            {
                switch (exceptionType)
                {
                case CE_HR_AttendanceExceptionType.请假:

                    var varDataLeave = from a in dataContxt.HR_LeaveBill
                                       where a.ID == Convert.ToInt32(billNo)
                                       select a;

                    if (varDataLeave.Count() != 1)
                    {
                        throw new Exception("请假单数据有误");
                    }

                    service.Analysis_Main(dataContxt, varDataLeave.Single().BeginTime, varDataLeave.Single().EndTime, varDataLeave.Single().Applicant);
                    break;

                case CE_HR_AttendanceExceptionType.加班:
                    var varOverTime = from a in dataContxt.HR_OvertimeBill
                                      where a.ID == Convert.ToInt32(billNo)
                                      select a;

                    if (varOverTime.Count() != 1)
                    {
                        throw new Exception("请假单数据有误");
                    }

                    var varOverPersonnel = from a in dataContxt.HR_OvertimePersonnel
                                           where a.BillID == varOverTime.Single().ID
                                           select a;

                    foreach (var item in varOverPersonnel)
                    {
                        service.Analysis_Main(dataContxt, varOverTime.Single().BeginTime, Convert.ToDateTime(varOverTime.Single().EndTime), item.WorkID);
                    }

                    break;

                case CE_HR_AttendanceExceptionType.出差:
                    var varOnBusiness = from a in dataContxt.HR_OnBusinessBill
                                        where a.ID == Convert.ToInt32(billNo)
                                        select a;

                    if (varOnBusiness.Count() != 1)
                    {
                        throw new Exception("请假单数据有误");
                    }

                    var varPersonnel = from a in dataContxt.HR_OnBusinessPersonnel
                                       where a.BillID == varOnBusiness.Single().ID
                                       select a;

                    foreach (var item in varPersonnel)
                    {
                        service.Analysis_Main(dataContxt, varOnBusiness.Single().RealBeginTime, varOnBusiness.Single().RealEndTime, item.WorkID);
                    }

                    break;

                default:
                    break;
                }

                dataContxt.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }