Exemple #1
0
        public static void Create(Report report, List <long> performIds, object fileContent, string fileName, string uploadFolder, bool isStaffReport)
        {
            if (!string.IsNullOrEmpty(report.ReportContent))
            {
                Create(report);

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

            if (isStaffReport)
            {
                if (performIds != null && performIds.Count > 0)
                {
                    foreach (var performId in performIds)
                    {
                        PerformServices.Update(performId: performId, status: report.Status, performOnDate: report.PerformOnDate, isNeedConfirm: false);
                    }
                }
                //Trường hợp giao việc ko chọn đơn vị, cập nhật trạng thái YKCD theo trạng thái báo cáo
                else
                {
                    var request = report.Request;

                    if (request.Performs == null || request.Performs.Count == 0)
                    {
                        request.Status = report.Status;

                        if (request.Status == 2)
                        {
                            request.FinishedOnDate = report.PerformOnDate;
                        }
                        RequestServices.Update(request);
                    }
                }
            }
            else
            {
                if (performIds != null && performIds.Count > 0)
                {
                    PerformServices.Update(performId: performIds.FirstOrDefault(), status: report.Status, performOnDate: report.PerformOnDate, isNeedConfirm: true);
                }
            }

            RequestServices.CapNhatTrangThaiYKCD(report.RequestID);
        }
Exemple #2
0
        public static void Update(long performId, int status, DateTime performOnDate, bool isNeedConfirm)
        {
            var perform = PerformServices.GetById(performId);

            perform.Status = status;

            if (status == 2 && isNeedConfirm)
            {
                perform.Status         = 3;
                perform.FinishedOnDate = performOnDate;
            }
            else if (status == 2 && !isNeedConfirm)
            {
                perform.Status         = 2;
                perform.FinishedOnDate = performOnDate;
            }
            perform.IsSynced = false;

            PerformServices.Update(perform);

            RequestServices.CapNhatTrangThaiYKCD(perform.RequestID);
        }