public static void Update(long performId, int status, DateTime performOnDate, bool isNeedConfirm) { var perform = PerformServices.GetById(performId); if (perform != null) { perform.Status = status; if (status == 2 && perform.IsFinishedConfirm == true && isNeedConfirm) { perform.Status = 3; perform.FinishedOnDate = performOnDate; perform.IsSynced = false; } else if (status == 2 && (!isNeedConfirm || !perform.IsFinishedConfirm)) { perform.Status = 2; perform.FinishedOnDate = performOnDate; perform.IsSynced = false; } PerformServices.Update(perform); } RequestServices.CapNhatTrangThaiYKCD(perform.RequestID); }
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); } }