예제 #1
0
 protected void Session_Start(object sender, EventArgs e)
 {
     if (AppSettings.IS_USE_PROVINCE_MODULE)
     {
         Application.Lock();
         ProvinceServiceHelper.GetDataFromProvince(AppSettings.Province_Service, AppSettings.AGENCY_ID, AppSettings.UploadFolder);
         Application.UnLock();
     }
 }
예제 #2
0
        /// <summary>
        /// Giao việc một ý kiến chỉ đạo cho cá nhân, đơn vị thực hiện
        /// </summary>
        /// <param name="request">Thông tin ý kiến chỉ đạo</param>
        /// <param name="requesterId">Mã người giao việc</param>
        /// <param name="trackerIds">Mã người theo dõi</param>
        /// <param name="departmentIds">Mã đơn vị thực hiện</param>
        /// <param name="isFinishedConfirm">Có cần xác nhận</param>
        public static void Assign(Request request, int requesterId, List <int> trackerIds, List <int> departmentIds, bool isFinishedConfirm)
        {
            foreach (var trackerId in trackerIds)
            {
                Tracking tracking = new Tracking(request.RequestID, trackerId);
                TrackingServices.Create(tracking);
            }

            foreach (var departmentId in departmentIds)
            {
                Perform perform = new Perform(requestId: request.RequestID, departmentId: departmentId, requiredDate: request.RequiredDate);
                perform.IsFinishedConfirm = isFinishedConfirm;
                PerformServices.CreatePerform(perform);
            }

            var orgRequest = GetById(request.RequestID);

            orgRequest.Status          = 1;
            orgRequest.IsAssignPerform = true;
            orgRequest.RequesterID     = requesterId;

            Update(orgRequest);

            if (request.IsProvinceRequest)
            {
                orgRequest.CreatedBy = CommonSessions.UserID;
                Update(orgRequest);

                Report report = new Report()
                {
                    ReportContent = $"Đã giao cho {request.Departments?.Select(i => i.DepartmentName)?.ToList()?.DisplayInline()} thực hiện",
                    PerformOnDate = DateTime.Now,
                    RequestID     = request.RequestID,
                    Status        = 1
                };

                ProvinceServiceHelper.ReceiveReport(ConfigurationManager.AppSettings["Province_Service"], report);
            }
        }
예제 #3
0
        public static void Create(Report report, List <int> performIds, object fileContent, string fileName, string uploadFolder, bool isStaffReport = false, bool isSendToProvince = false, bool isSendFromProvince = false)
        {
            if (!string.IsNullOrEmpty(report.ReportContent))
            {
                Create(report);

                ReportFileServices.CreateReportFile(report, fileContent, fileName, uploadFolder);
            }

            Request request = RequestServices.GetById(report.RequestID);

            if (request.IsProvinceRequest)
            {
                if (request.Performs.Count > 0)
                {
                    if (isSendFromProvince)
                    {
                        if (request.Status == 2)
                        {
                            foreach (var perform in request.Performs)
                            {
                                PerformServices.Update(performId: perform.PerformID, status: report.Status, performOnDate: report.PerformOnDate, isNeedConfirm: false);
                            }
                        }
                    }
                    else if (isStaffReport)
                    {
                        if (performIds != null)
                        {
                            foreach (var performId in performIds)
                            {
                                PerformServices.Update(performId: performId, status: report.Status, performOnDate: report.PerformOnDate, isNeedConfirm: false);
                            }

                            report.Status = RequestServices.CapNhatTrangThaiYKCD(request.RequestID);
                        }
                    }
                    else
                    {
                        PerformServices.Update(performId: performIds.FirstOrDefault(), status: report.Status, performOnDate: report.PerformOnDate, isNeedConfirm: true);
                        report.Status = RequestServices.CapNhatTrangThaiYKCD(request.RequestID);
                    }

                    if (isSendToProvince)
                    {
                        ProvinceServiceHelper.ReceiveReport(ConfigurationManager.AppSettings["Province_Service"], report);
                    }
                }
                else
                {
                    if (!isSendFromProvince)
                    {
                        request.Status = report.Status;

                        if (request.Status == 2)
                        {
                            request.FinishedOnDate = report.PerformOnDate;
                        }

                        RequestServices.Update(request);

                        if (isSendToProvince)
                        {
                            ProvinceServiceHelper.ReceiveReport(ConfigurationManager.AppSettings["Province_Service"], report);
                        }
                    }
                }
            }
            else if (isStaffReport)
            {
                foreach (var performId in performIds)
                {
                    PerformServices.Update(performId: performId, status: report.Status, performOnDate: report.PerformOnDate, isNeedConfirm: false);
                }
            }
            else
            {
                PerformServices.Update(performId: performIds.FirstOrDefault(), status: report.Status, performOnDate: report.PerformOnDate, isNeedConfirm: true);
            }
        }