示例#1
0
        public static string ShowPerformObjects(long requestID)
        {
            string result = string.Empty;
            var    items  = PerformServices.GetList(requestID);

            if (CommonSessions.UserID > 0 &&
                (CommonSessions.UserID == requestID ||
                 TrackingServices.GetList(requestID).Select(item => item.UserID).Contains(CommonSessions.UserID) || CommonSessions.Role == UserRole.Administrator))
            {
                foreach (var item in items)
                {
                    result += $"{item.Agency.AgencyName} (<a href=\"#\" data-toggle=\"modal\" data-target=\".my-modal-lg\" data-link=\"{Redirector.GetLink("Province/XacNhanHoanThanh.aspx", "id", item.PerformID)}\">{item.StatusString}</a>)<br/>";
                }
            }
            else
            {
                foreach (var item in items)
                {
                    result += $"{item.Agency.AgencyName} ({item.StatusString})<br/>";
                }
            }


            return(result);
        }
示例#2
0
        public static bool CheckReportPermission(long requestID)
        {
            var request = RequestServices.GetById(requestID);

            if (CommonSessions.UserID > 0 && (request.CreatedBy == CommonSessions.UserID || request.Trackings.Any(t => t.UserID == CommonSessions.UserID) || CommonSessions.Role == UserRole.Administrator))
            {
                return(true);
            }

            return(CommonSessions.AgencyID > 0 && PerformServices.GetList(requestID).Any(item => item.AgencyID == CommonSessions.AgencyID));
        }
示例#3
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);
        }
示例#4
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);
        }