示例#1
0
        public WorkReportModel GetComponentModelList(string wrTypeCode)
        {
            if (string.IsNullOrWhiteSpace(wrTypeCode))
            {
                return(null);
            }
            PlanDac planDac = new PlanDac();
            List <WRComponentModel> list = new List <WRComponentModel>();

            list = planDac.GetComponentModelList(wrTypeCode);
            WorkReportModel model = new WorkReportModel();

            model.ComponentModels = list;
            if (list != null && list.Count > 0)
            {
                model.WRType = list[0].WorkReportType;
                model.ID     = Guid.NewGuid().ToString();
            }
            return(model);
        }
示例#2
0
        internal PlanInfo Get(string planInfoID)
        {
            PlanDac          dac      = new PlanDac();
            PlanItemModelDac modelDac = new PlanItemModelDac();
            PlanInfo         planInfo = dac.GetPlanBaseInfo(planInfoID);

            planInfo.PlanItems = dac.GetPlanItems(planInfoID);
            List <string> carbonCopyRecipientsID = dac.GetRecipientsID(planInfoID);

            if (carbonCopyRecipientsID != null && carbonCopyRecipientsID.Count > 0)
            {
                planInfo.CarbonCopyRecipient = GetUserInfos(carbonCopyRecipientsID);
            }
            // 创建人
            SysUser user = userService.GetUserByID(planInfo.Creator.ID);

            planInfo.Creator.Name = user == null ? "张三" : user.Name;
            // 审批人
            user = userService.GetUserByID(planInfo.MainRecipient.ID);
            planInfo.MainRecipient.Name = user == null ? "李四" : user.Name;
            return(planInfo);
        }
示例#3
0
        public List <WorkReport> GetWorkReportList(WRQueryFilter filterCondition)
        {
            if (filterCondition == null)
            {
                return(null);
            }
            PlanDac           planDac = new PlanDac();
            List <WorkReport> reports = planDac.GetWorkReportList(filterCondition);

            if (reports != null && reports.Count > 0)
            {
                for (int i = 0; i < reports.Count; i++)
                {
                    WorkReport wr = reports[i];
                    if (!string.IsNullOrEmpty(wr.Creator))
                    {
                        SysUser user = userService.GetUserByID(wr.Creator);
                        wr.CreatorName = user == null? "某某" : user.Name;
                    }
                }
            }
            return(reports);
        }
示例#4
0
        public WorkReport GetWorkReportByID(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return(null);
            }
            PlanDac    planDac = new PlanDac();
            WorkReport wr      = planDac.GetWorkReportByID(id);

            wr.WorkReportComps = planDac.GetComponentsByID(wr.ID);
            wr.WorkReportPics  = planDac.GetPicturesByID(wr.ID);
            List <string> userIDs = planDac.GetRecipientsByID(wr.ID);

            if (userIDs != null && userIDs.Count > 0)
            {
                wr.WorkReportRecipients = GetUserInfos(userIDs);
            }
            if (!string.IsNullOrEmpty(wr.Creator))
            {
                SysUser user = userService.GetUserByID(wr.Creator);
                wr.CreatorName = user == null ? "某某" : user.Name;
            }
            return(wr);
        }
示例#5
0
        internal void UpdateWorkReport(WorkReport workReport, bool isReNotice)
        {
            if (workReport == null || string.IsNullOrWhiteSpace(workReport.ID))
            {
                return;
            }
            var     db      = Utils.GetDb();
            PlanDac planDac = new PlanDac(db);

            db.BeginTransaction();
            try
            {
                planDac.UpdateWorkReportBaseInfo(workReport);
                planDac.DeletaWorkReportComps(workReport.ID);
                // planDac.DeletaWorkReportRecipients(workReport.ID);
                planDac.AddWorkReportComps(workReport.WorkReportComps, workReport.ID);
                // planDac.AddWorkReportRecipients(workReport);

                List <WRPicture> newPics = workReport.WorkReportPics;
                if (newPics == null || newPics.Count <= 0)
                {
                    planDac.DeletaWorkReportPics(workReport.ID);
                }
                else
                {
                    List <WRPicture> oldPics = planDac.GetPicturesByID(workReport.ID);
                    if (oldPics == null || oldPics.Count <= 0)
                    {
                        planDac.AddWorkReportPictures(newPics, workReport.ID);
                    }
                    else
                    {
                        List <WRPicture> newAddPics  = new List <WRPicture>();
                        List <string>    deletedPics = new List <string>();
                        List <string>    oldPicIDs   = new List <string>();
                        List <string>    newPicIDs   = new List <string>();
                        oldPics.ForEach(pic =>
                        {
                            oldPicIDs.Add(pic.ID);
                        });
                        newPics.ForEach(pic =>
                        {
                            newPicIDs.Add(pic.ID);
                            if (string.IsNullOrEmpty(pic.ID) || !oldPicIDs.Contains(pic.ID))
                            {
                                newAddPics.Add(pic);
                            }
                        });
                        oldPics.ForEach(pic =>
                        {
                            if (!newPicIDs.Contains(pic.ID))
                            {
                                deletedPics.Add(pic.ID);
                            }
                        });
                        planDac.DeletaWorkReportPics(deletedPics);
                        planDac.AddWorkReportPictures(newAddPics, workReport.ID);
                    }
                }

                db.Commit();
                // 推送通知
                if (isReNotice)
                {
                    List <string> recipients = planDac.GetRecipientsByID(workReport.ID);
                    if (recipients != null && recipients.Count > 0)
                    {
                        NoticeRecipients(recipients);
                    }
                }
            }
            catch
            {
                db.Rollback();
            }
        }
示例#6
0
        public bool IsExistPlanDefineRef(string planDefineID)
        {
            PlanDac dac = new PlanDac();

            return(dac.IsExistPlanDefineRef(planDefineID));
        }
示例#7
0
        public void UpdatePlanStage(string planID, int approvalState)
        {
            PlanDac dac = new PlanDac();

            dac.UpdatePlanStage(planID, approvalState);
        }
示例#8
0
        public void PutSelfAssessment(List <PlanItem> planItemList)
        {
            PlanDac dac = new PlanDac();

            dac.PutSelfAssessment(planItemList);
        }
示例#9
0
        internal void PutSuperiorAssessment(List <PlanItem> planItemList)
        {
            PlanDac dac = new PlanDac();

            dac.PutSuperiorAssessment(planItemList);
        }