Пример #1
0
        public static bool IsNextFlowStarted(string projectId, string flowCode)
        {
            var flow          = FlowInfo.Get(flowCode);
            var nextFlowCodes = FlowInfo.Search(e => e.ParentCode == flow.ParentCode && e.ExecuteSequence == flow.ExecuteSequence + 1).Select(e => e.Code).ToList();

            return(Any(p => p.ProjectId == projectId && nextFlowCodes.Contains(p.FlowCode) && p.NodeCode != Constants.NodeCode.Start && p.NodeCode != Constants.NodeCode.Finish));
        }
Пример #2
0
        public static void AddComment(string action, string content, Guid refTableId, string refTableName, string sourceCode, int?procInstID = null, ProjectCommentStatus?status = null)
        {
            var source  = FlowInfo.Get(sourceCode);
            var comment = new ProjectComment
            {
                Action             = action,
                Content            = content,
                CreateTime         = DateTime.Now,
                CreateUserAccount  = ClientCookie.UserCode,
                CreateUserNameENUS = ClientCookie.UserNameENUS,
                CreateUserNameZHCN = ClientCookie.UserNameZHCN,
                Id             = Guid.NewGuid(),
                ProcInstID     = procInstID,
                RefTableId     = refTableId,
                RefTableName   = refTableName,
                SourceCode     = source.Code,
                SourceNameENUS = source.NameENUS,
                SourceNameZHCN = source.NameZHCN,
                Status         = status,
                TitleNameENUS  = ClientCookie.TitleENUS,
                TitleNameZHCN  = ClientCookie.TitleENUS,
                UserAccount    = ClientCookie.UserCode,
                UserNameENUS   = ClientCookie.UserNameENUS,
                UserNameZHCN   = ClientCookie.UserNameZHCN
            };

            comment.Add();
        }
Пример #3
0
        public static int SendTask(string refId, string title, string storeCode, string url, ProjectUsers receiver, string sourceCode, string typeCode, string activityName, int?procInstId = null)
        {
            var task     = new TaskWork();
            var source   = FlowInfo.Get(sourceCode);
            var taskType = FlowInfo.Get(typeCode);

            task.SourceCode       = source.Code;
            task.SourceNameENUS   = source.NameENUS;
            task.SourceNameZHCN   = source.NameZHCN;
            task.Status           = TaskWorkStatus.UnFinish;
            task.StatusNameZHCN   = "任务";
            task.StatusNameENUS   = "任务";
            task.Title            = title;
            task.RefID            = refId;
            task.StoreCode        = storeCode;
            task.ReceiverAccount  = receiver.UserAccount;
            task.ReceiverNameENUS = receiver.UserNameENUS;
            task.ReceiverNameZHCN = receiver.UserNameZHCN;
            task.TypeCode         = taskType.Code;
            task.TypeNameENUS     = taskType.NameENUS;
            task.TypeNameZHCN     = taskType.NameZHCN;
            task.ProcInstID       = procInstId;
            task.Id                = Guid.NewGuid();
            task.Url               = url;
            task.CreateTime        = DateTime.Now;
            task.CreateUserAccount = ClientCookie.UserCode;
            task.Sequence          = 0;
            task.ActivityName      = activityName;
            return(Add(task));
        }
Пример #4
0
        public TaskWork GenerateTask(string flowCode, string url, string receiver, string reveiverENUS, string receiverZHCN, string activityName)
        {
            TaskWork taskWork = new TaskWork();
            var      source   = FlowInfo.Get(FlowCode.Renewal);
            var      taskType = FlowInfo.Get(flowCode);

            taskWork.SourceCode     = source.Code;
            taskWork.SourceNameZHCN = source.NameZHCN;
            taskWork.SourceNameENUS = source.NameENUS;
            taskWork.Status         = TaskWorkStatus.UnFinish;
            taskWork.StatusNameZHCN = "任务";
            taskWork.StatusNameENUS = "任务";
            var title = TaskWork.BuildTitle(ProjectId, StoreNameZHCN, StoreNameENUS);

            taskWork.Title     = title;
            taskWork.RefID     = ProjectId;
            taskWork.StoreCode = USCode;

            taskWork.TypeCode         = taskType.Code;
            taskWork.TypeNameENUS     = taskType.NameENUS;
            taskWork.TypeNameZHCN     = taskType.NameZHCN;
            taskWork.ReceiverAccount  = receiver;
            taskWork.ReceiverNameENUS = reveiverENUS;
            taskWork.ReceiverNameZHCN = receiverZHCN;
            taskWork.Id                = Guid.NewGuid();
            taskWork.Url               = url;
            taskWork.CreateTime        = DateTime.Now;
            taskWork.CreateUserAccount = receiver;
            taskWork.Sequence          = 0;
            taskWork.ActivityName      = activityName;
            taskWork.Add();
            return(taskWork);
        }
Пример #5
0
        public static ConsInfoDTO <RenewalInfo, RenewalConsInfo> InitPage(string projectId, string id = "")
        {
            RenewalInfo info     = RenewalInfo.Get(projectId);
            var         consInfo = RenewalConsInfo.Get(projectId, id);

            if (consInfo == null)
            {
                consInfo           = new RenewalConsInfo();
                consInfo.ProjectId = projectId;
            }
            var isOriginator = ClientCookie.UserCode == info.PMAccount;

            consInfo.IsProjectFreezed = consInfo.CheckIfFreezeProject(projectId);
            var nextRefTableId  = new Guid(FlowInfo.GetRefTableId("RenewalTool", projectId));
            var nextFlowStarted = ProjectInfo.IsFlowStarted(projectId, FlowCode.Renewal_Tool);
            var haveTask        = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Renewal_Tool && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode);
            var projectComment  = ProjectComment.GetSavedComment(consInfo.Id, "RenewalConsInfo", ClientCookie.UserCode);

            if (string.IsNullOrEmpty(id))
            {
                consInfo.HasReinvenstment = info.NeedProjectCostEst;
            }
            ConsInfoDTO <RenewalInfo, RenewalConsInfo> dto = new ConsInfoDTO <RenewalInfo, RenewalConsInfo>();

            dto.Entity         = consInfo;
            dto.Info           = info;
            dto.ReinBasicInfo  = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id);
            dto.ReinCost       = ReinvestmentCost.GetByConsInfoId(consInfo.Id);
            dto.WriteOff       = WriteOffAmount.GetByConsInfoId(consInfo.Id);
            dto.ProjectComment = projectComment != null ? projectComment.Content : "";
            dto.Editable       = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_ConsInfo);
            dto.Recallable     = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_ConsInfo);
            dto.Savable        = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_ConsInfo) && string.IsNullOrEmpty(id);
            return(dto);
        }
Пример #6
0
        public static RenewalLegalApprovalDTO InitPage(string projectId, string id = null)
        {
            RenewalLegalApprovalDTO dto = new RenewalLegalApprovalDTO();
            var entity  = Get(projectId, id);
            var info    = RenewalInfo.Get(projectId);
            var isActor = ClientCookie.UserCode == info.AssetActorAccount;

            entity.IsProjectFreezed = entity.CheckIfFreezeProject(projectId);
            var nextRefTableId  = new Guid(FlowInfo.GetRefTableId(entity.TableName, projectId));
            var nextFlowStarted = ProjectInfo.IsFlowStarted(projectId, FlowCode.Renewal_Package);
            var haveTask        = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Renewal_LegalApproval && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode);
            var projectComment  = ProjectComment.GetSavedComment(entity.Id, entity.TableName, ClientCookie.UserCode);
            var appUser         = ApproveDialogUser.GetApproveDialogUser(entity.Id.ToString());

            dto.Info             = info;
            dto.Entity           = entity;
            dto.ProjectComment   = projectComment != null ? projectComment.Content : "";
            dto.IsGeneralCounsel = appUser != null && appUser.GeneralCounselCode == ClientCookie.UserCode;
            dto.Editable         = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_LegalApproval);
            dto.Recallable       = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_LegalApproval);
            dto.Savable          = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_LegalApproval) && string.IsNullOrEmpty(id);
            return(dto);
        }
Пример #7
0
        public override string Edit()
        {
            if (!PreEdit(this.ProjectId))
            {
                return("");
            }
            var closureEntity = ClosureInfo.GetByProjectId(this.ProjectId);
            var store         = StoreBasicInfo.GetStorInfo(closureEntity.USCode);
            var taskWork      = new TaskWork();
            var source        = FlowInfo.Get(FlowCode.Closure);
            var taskType      = FlowInfo.Get(FlowCode.Closure_WOCheckList);

            taskWork.SourceCode     = source.Code;
            taskWork.SourceNameZHCN = source.NameZHCN;
            taskWork.SourceNameENUS = source.NameENUS;
            taskWork.Status         = TaskWorkStatus.UnFinish;
            taskWork.StatusNameZHCN = "任务";
            taskWork.StatusNameENUS = "任务";
            taskWork.Title          = TaskWork.BuildTitle(this.ProjectId, store.NameZHCN, store.NameENUS);
            taskWork.RefID          = this.ProjectId;
            taskWork.StoreCode      = closureEntity.USCode;

            taskWork.TypeCode         = taskType.Code;
            taskWork.TypeNameENUS     = taskType.NameENUS;
            taskWork.TypeNameZHCN     = taskType.NameZHCN;
            taskWork.ReceiverAccount  = closureEntity.PMAccount;
            taskWork.ReceiverNameENUS = closureEntity.PMNameENUS;
            taskWork.ReceiverNameZHCN = closureEntity.PMNameZHCN;
            taskWork.Id           = Guid.NewGuid();
            taskWork.CreateTime   = DateTime.Now;
            taskWork.Url          = TaskWork.BuildUrl(FlowCode.Closure_WOCheckList, this.ProjectId, "");
            taskWork.ActivityName = NodeCode.Start;
            TaskWork.Add(taskWork);

            this.IsHistory          = true;
            this.RefreshClosureTool = false;
            //TaskWork.SetTaskHistory(this.Id, this.ProcInstID);

            this.Save();
            var objectCopy = new ObjectCopy();
            var newWo      = objectCopy.AutoCopy(this);

            newWo.Id         = Guid.NewGuid();
            newWo.ProcInstID = 0;
            newWo.Save();

            var projectEntity = ProjectInfo.Get(this.ProjectId, FlowCode.Closure_WOCheckList);

            ProjectInfo.UnFinishNode(this.ProjectId, FlowCode.Closure_WOCheckList, NodeCode.Closure_WOCheckList_Approve, ProjectStatus.UnFinish);
            var attList = Attachment.Search(e => e.RefTableID == this.Id.ToString() &&
                                            e.RefTableName == ClosureWOCheckList.TableName);
            var objCopy = new ObjectCopy();
            var newList = new List <Attachment>();

            foreach (var att in attList)
            {
                var newAtt = objCopy.AutoCopy(att);
                newAtt.RefTableID = newWo.Id.ToString();
                newAtt.ID         = Guid.NewGuid();
                newList.Add(newAtt);
            }
            Attachment.AddList(newList);
            return(taskWork.Url);
        }
Пример #8
0
        public static RenewalToolDTO InitPage(string projectId, string id = null)
        {
            RenewalToolDTO dto       = new RenewalToolDTO();
            var            tool      = RenewalTool.Get(projectId, id);
            var            project   = ProjectInfo.Get(projectId, FlowCode.Renewal_Tool);
            var            info      = RenewalInfo.Get(projectId);
            var            isFinance = ClientCookie.UserCode == info.FinanceAccount;

            tool.IsProjectFreezed = tool.CheckIfFreezeProject(projectId);
            var    nextRefTableId    = new Guid(FlowInfo.GetRefTableId("RenewalAnalysis", projectId));
            var    nextFlowStarted   = ProjectInfo.IsFlowStarted(projectId, FlowCode.Renewal_Analysis);
            var    haveTask          = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Renewal_Tool && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode);
            var    projectComment    = ProjectComment.GetSavedComment(tool.Id, "RenewalTool", ClientCookie.UserCode);
            var    projectNode       = NodeInfo.GetNodeInfo(project.NodeCode);
            var    packageStarted    = ProjectInfo.IsFlowStarted(projectId, FlowCode.Renewal_Package);
            string selectedYearMonth = null;

            dto.Info              = info;
            dto.Entity            = tool;
            dto.TTMDataYearMonths = RenewalToolFinMeasureInput.GetYearMonths(projectId, out selectedYearMonth);
            dto.FinMeasureInput   = RenewalToolFinMeasureInput.Get(projectId, dto.Entity.Id);
            if (string.IsNullOrEmpty(dto.FinMeasureInput.FinanceYear) || string.IsNullOrEmpty(dto.FinMeasureInput.FinanceMonth))
            {
                var ym = selectedYearMonth.Split('-');
                dto.FinMeasureInput.FinanceYear  = ym[0];
                dto.FinMeasureInput.FinanceMonth = ym[1];
            }
            dto.FinMeasureInput.FinanceDataYearMonth = dto.FinMeasureInput.FinanceYear + "-" + dto.FinMeasureInput.FinanceMonth;
            //dto.FinMeasureInput.ContributionMargin = StoreCM.Get(dto.Info.USCode).ContributionMargin;
            McdAMEntities amdb  = new McdAMEntities();
            var           finfo = amdb.DataSync_LDW_AM_STFinanceData2.FirstOrDefault(f => f.UsCode == dto.Info.USCode &&
                                                                                     f.FinanceYear == dto.FinMeasureInput.FinanceYear && f.FinanceMonth == dto.FinMeasureInput.FinanceMonth);
            decimal cm = 0;

            if (finfo != null && !string.IsNullOrEmpty(finfo.contribution_marginPct))
            {
                cm = decimal.Parse(finfo.contribution_marginPct);
            }
            dto.FinMeasureInput.ContributionMargin = cm;
            var coninfo = RenewalConsInfo.FirstOrDefault(e => e.ProjectId == projectId && !e.IsHistory);
            var conProj = ProjectInfo.FirstOrDefault(e => e.ProjectId == projectId && e.FlowCode == "Renewal_ConsInfo");

            dto.WriteOffAndReinCost = RenewalToolWriteOffAndReinCost.Get(projectId, dto.Entity.Id, projectNode);
            if (coninfo != null && !coninfo.HasReinvenstment)
            {
                dto.WriteOffAndReinCost.REWriteOff   = null;
                dto.WriteOffAndReinCost.LHIWriteOff  = null;
                dto.WriteOffAndReinCost.ESSDWriteOff = null;
                dto.WriteOffAndReinCost.ESSDWriteOff = null;
                dto.WriteOffAndReinCost.RECost       = null;
                dto.WriteOffAndReinCost.LHICost      = null;
                dto.WriteOffAndReinCost.ESSDCost     = null;
            }

            dto.Uploadable     = projectNode.Sequence >= 3 && ClientCookie.UserCode == dto.Info.AssetActorAccount && !packageStarted;
            dto.ProjectComment = projectComment != null ? projectComment.Content : "";
            dto.Editable       = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_Tool);
            dto.Recallable     = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_Tool);
            dto.Savable        = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_Tool) && string.IsNullOrEmpty(id);
            dto.IsFinished     =
                ProjectInfo.Any(
                    e =>
                    e.ProjectId == projectId && e.FlowCode == FlowCode.Renewal_Tool &&
                    e.Status == ProjectStatus.Finished);
            return(dto);
        }
Пример #9
0
 public List <FlowInfo> GetFlowList(string parentCode)
 {
     return(FlowInfo.GetFlowList(parentCode).ToList());
 }
Пример #10
0
        public Dictionary <string, string> GetPrintTemplateFields()
        {
            var project       = ProjectInfo.Get(this.ProjectId, FlowCode.Renewal_Package);
            var storeBasic    = StoreBasicInfo.GetStorInfo(project.USCode);
            var storeContract = StoreContractInfo.Search(c => c.StoreCode == project.USCode).OrderByDescending(c => c.CreatedTime).FirstOrDefault();
            var info          = RenewalInfo.Get(ProjectId);
            var flowInfo      = FlowInfo.Get(FlowCode.Renewal);
            var analysis      = RenewalAnalysis.Get(this.AnalysisId.Value) ?? new RenewalAnalysis();
            var finOutput     = RenewalToolFinMeasureOutput.GetByToolId(this.ToolId.Value);
            Dictionary <string, string> templateFileds = new Dictionary <string, string>();

            templateFileds.Add("WorkflowName", flowInfo.NameENUS);
            templateFileds.Add("ProjectID", ProjectId);
            templateFileds.Add("USCode", storeBasic.StoreCode);
            templateFileds.Add("Region", storeBasic.Region);
            templateFileds.Add("StoreNameEN", storeBasic.NameENUS);
            templateFileds.Add("Market", storeBasic.Market);
            templateFileds.Add("City", storeBasic.CityZHCN);
            templateFileds.Add("StoreNameCN", storeBasic.NameZHCN);
            templateFileds.Add("StoreAge", Math.Floor((DateTime.Now - storeBasic.OpenDate).TotalDays / 365D).ToString());
            templateFileds.Add("OpenDate", storeBasic.OpenDate.ToString("yyyy-MM-dd"));
            templateFileds.Add("CloseDate", storeBasic.CloseDate.HasValue ? (storeBasic.CloseDate.Value.Year != 1900 ? storeBasic.CloseDate.Value.ToString("yyyy-MM-dd") : "") : "");

            if (storeContract != null)
            {
                templateFileds.Add("CurrentLeaseENDYear", storeContract.EndYear);
            }
            else
            {
                templateFileds.Add("CurrentLeaseENDYear", "");
            }

            templateFileds.Add("AssetsManager", info.AssetManagerNameENUS);
            templateFileds.Add("AssetsActor", info.AssetActorNameENUS);
            templateFileds.Add("AssetsRep", info.AssetRepNameENUS);
            templateFileds.Add("NewLeaseENDYear", info.NewLeaseEndDate.HasValue ? info.NewLeaseEndDate.Value.ToString("yyyy") : "");
            templateFileds.Add("ClosureDate", storeBasic.CloseDate.HasValue ? (storeBasic.CloseDate.Value.Year != 1900 ? storeBasic.CloseDate.Value.ToString("yyyy-MM-dd") : "") : "");
            templateFileds.Add("FairMarketRentPerAppraisal", analysis.FairMarketRentAmount.HasValue ? DataConverter.ToMoney(analysis.FairMarketRentAmount.Value) : "");
            templateFileds.Add("LeaseTenureAndTerm", analysis.LeaseTenureAndTerm);
            templateFileds.Add("DR1stTYAmount", analysis.DR1stTYAmount.HasValue ? DataConverter.ToMoney(analysis.DR1stTYAmount.Value) : "");
            templateFileds.Add("FreeRentalPeriod", analysis.FreeRentalPeriod);
            templateFileds.Add("RentDeviation", analysis.RentDeviation.HasValue ? DataConverter.ToPercentage(analysis.RentDeviation.Value.ToString()) : "");
            templateFileds.Add("RentStructureUR", analysis.RentStructure);
            templateFileds.Add("MFStructureUR", analysis.MFStructureNew);
            if (finOutput != null)
            {
                templateFileds.Add("AnnualRentExpenseLY", DataConverter.ToMoney(finOutput.AnnualRentExpenseLY));
                templateFileds.Add("AnnualRentExpenseYr1", DataConverter.ToMoney(finOutput.AnnualRentExpenseLY));
                templateFileds.Add("AnnualRentExpenseAvg", DataConverter.ToMoney(finOutput.AnnualRentExpenseLY));
                templateFileds.Add("RentAsProdSalesLY", DataConverter.ToPercentage(finOutput.RentAsProdSalesLY));
                templateFileds.Add("RentAsProdSalesYr1", DataConverter.ToPercentage(finOutput.RentAsProdSalesYr1));
                templateFileds.Add("RentAsProdSalesAvg", DataConverter.ToPercentage(finOutput.RentAsProdSalesAvg));
                templateFileds.Add("OccupancyProdSalesLY", DataConverter.ToPercentage(finOutput.OccupancyProdSalesLY));
                templateFileds.Add("OccupancyProdSalesYr1", DataConverter.ToPercentage(finOutput.OccupancyProdSalesYr1));
                templateFileds.Add("OccupancyProdSalesAvg", DataConverter.ToPercentage(finOutput.OccupancyProdSalesAvg));
                templateFileds.Add("SOIProdSalesLY", DataConverter.ToPercentage(finOutput.SOIProdSalesLY));
                templateFileds.Add("SOIProdSalesYr1", DataConverter.ToPercentage(finOutput.SOIProdSalesYr1));
                templateFileds.Add("SOIProdSalesAvg", DataConverter.ToPercentage(finOutput.SOIProdSalesAvg));
                templateFileds.Add("CashROILY", DataConverter.ToPercentage(finOutput.CashROILY));
                templateFileds.Add("CashROIYr1", DataConverter.ToPercentage(finOutput.CashROIYr1));
                templateFileds.Add("CashROIAvg", DataConverter.ToPercentage(finOutput.CashROIAvg));
            }
            else
            {
                templateFileds.Add("AnnualRentExpenseLY", "");
                templateFileds.Add("AnnualRentExpenseYr1", "");
                templateFileds.Add("AnnualRentExpenseAvg", "");
                templateFileds.Add("RentAsProdSalesLY", "");
                templateFileds.Add("RentAsProdSalesYr1", "");
                templateFileds.Add("RentAsProdSalesAvg", "");
                templateFileds.Add("OccupancyProdSalesLY", "");
                templateFileds.Add("OccupancyProdSalesYr1", "");
                templateFileds.Add("OccupancyProdSalesAvg", "");
                templateFileds.Add("SOIProdSalesLY", "");
                templateFileds.Add("SOIProdSalesYr1", "");
                templateFileds.Add("SOIProdSalesAvg", "");
                templateFileds.Add("CashROILY", "");
                templateFileds.Add("CashROIYr1", "");
                templateFileds.Add("CashROIAvg", "");
            }

            return(templateFileds);
        }
Пример #11
0
        public override string Edit()
        {
            if (!PreEdit(this.ProjectId))
            {
                return("");
            }
            var closureEntity = ClosureInfo.GetByProjectId(this.ProjectId);
            var store         = StoreBasicInfo.GetStorInfo(closureEntity.USCode);
            var taskWork      = new TaskWork();
            var source        = FlowInfo.Get(FlowCode.Closure);
            var taskType      = FlowInfo.Get(FlowCode.Closure_ClosureTool);

            taskWork.SourceCode     = source.Code;
            taskWork.SourceNameZHCN = source.NameZHCN;
            taskWork.SourceNameENUS = source.NameENUS;
            taskWork.Status         = TaskWorkStatus.UnFinish;
            taskWork.StatusNameZHCN = "任务";
            taskWork.StatusNameENUS = "任务";
            taskWork.Title          = TaskWork.BuildTitle(this.ProjectId, store.NameZHCN, store.NameENUS);
            taskWork.RefID          = this.ProjectId;
            taskWork.StoreCode      = closureEntity.USCode;

            taskWork.TypeCode         = taskType.Code;
            taskWork.TypeNameENUS     = taskType.NameENUS;
            taskWork.TypeNameZHCN     = taskType.NameZHCN;
            taskWork.ReceiverAccount  = closureEntity.FinanceAccount;
            taskWork.ReceiverNameENUS = closureEntity.FinanceNameENUS;
            taskWork.ReceiverNameZHCN = closureEntity.FinanceNameZHCN;
            taskWork.Id           = Guid.NewGuid();
            taskWork.CreateTime   = DateTime.Now;
            taskWork.ActivityName = NodeCode.Start;
            taskWork.ActionName   = SetTaskActionName(ProjectId);
            taskWork.Url          = TaskWork.BuildUrl(FlowCode.Closure_ClosureTool, this.ProjectId, "");
            TaskWork.Add(taskWork);

            this.IsHistory = true;
            TaskWork.SetTaskHistory(this.Id, this.ProcInstID);
            this.Save();

            var objectCopy = new ObjectCopy();
            var newEntity  = objectCopy.AutoCopy(this);

            newEntity.Id         = Guid.NewGuid();
            newEntity.ProcInstID = 0;
            newEntity.IsHistory  = false;
            newEntity.Save();

            //复制ImpactOtherStore信息
            var impactOtherStores = ClosureToolImpactOtherStore.Search(i => i.ClosureId == this.Id).AsNoTracking().ToArray();

            if (impactOtherStores.Length > 0)
            {
                foreach (var impactItem in impactOtherStores)
                {
                    impactItem.Id        = Guid.NewGuid();
                    impactItem.ClosureId = newEntity.Id;
                }
                ClosureToolImpactOtherStore.Add(impactOtherStores);
            }

            ProjectInfo.Reset(this.ProjectId, FlowCode.Closure_ClosureTool);

            var attList = Attachment.Search(e => e.RefTableID == this.Id.ToString() &&
                                            e.RefTableName == ClosureTool.TableName).AsNoTracking().ToList();

            var newList = new List <Attachment>();

            foreach (var att in attList)
            {
                var newAtt = objCopy.AutoCopy(att);
                newAtt.RefTableID = newEntity.Id.ToString();
                newAtt.ID         = Guid.NewGuid();
                newList.Add(newAtt);
            }
            Attachment.AddList(newList);
            return(taskWork.Url);
        }
Пример #12
0
        public static void GenerateOnCreate(string mainFlowCode, string projectId)
        {
            var flows        = FlowInfo.Search(e => e.ParentCode == mainFlowCode).ToList();
            var projectNodes = new List <ProjectNode>();

            flows.ForEach(f =>
            {
                NodeInfo.Search(e => e.FlowCode == f.Code).ToList().ForEach(e =>
                {
                    projectNodes.Add(new ProjectNode
                    {
                        Id        = Guid.NewGuid(),
                        ProjectId = projectId,
                        FlowCode  = f.Code,
                        NodeCode  = e.Code,
                        IsHistory = false,
                        Status    = ProjectNodeStatus.UnFinish
                    });
                });
            });
            ProjectNode.Add(projectNodes.ToArray());
            if (mainFlowCode == Constants.FlowCode.Renewal)
            {
                var renewalNods = new List <ProjectNode>();
                renewalNods.Add(new ProjectNode
                {
                    Id        = Guid.NewGuid(),
                    ProjectId = projectId,
                    FlowCode  = "Renewal_GBMemo",
                    NodeCode  = "Renewal_GBMemo_Input",
                    IsHistory = false,
                    Status    = ProjectNodeStatus.UnFinish
                });
                renewalNods.Add(new ProjectNode
                {
                    Id        = Guid.NewGuid(),
                    ProjectId = projectId,
                    FlowCode  = "Renewal_GBMemo",
                    NodeCode  = "Renewal_GBMemo_Send",
                    IsHistory = false,
                    Status    = ProjectNodeStatus.UnFinish
                });
                ProjectNode.Add(renewalNods.ToArray());
            }
            if (mainFlowCode == Constants.FlowCode.MajorLease)
            {
                var majorleaseNods = new List <ProjectNode>();
                majorleaseNods.Add(new ProjectNode
                {
                    Id        = Guid.NewGuid(),
                    ProjectId = projectId,
                    FlowCode  = "MajorLease_GBMemo",
                    NodeCode  = "MajorLease_GBMemo_Input",
                    IsHistory = false,
                    Status    = ProjectNodeStatus.UnFinish
                });
                majorleaseNods.Add(new ProjectNode
                {
                    Id        = Guid.NewGuid(),
                    ProjectId = projectId,
                    FlowCode  = "MajorLease_GBMemo",
                    NodeCode  = "MajorLease_GBMemo_Send",
                    IsHistory = false,
                    Status    = ProjectNodeStatus.UnFinish
                });
                ProjectNode.Add(majorleaseNods.ToArray());
            }
        }
Пример #13
0
        public Dictionary <string, string> GetPrintTemplateFields()
        {
            var project       = ProjectInfo.Get(ProjectId, FlowCode.Renewal_LegalApproval);
            var storeBasic    = StoreBasicInfo.GetStorInfo(project.USCode);
            var storeContract = StoreContractInfo.Search(c => c.StoreCode == project.USCode).OrderByDescending(c => c.CreatedTime).FirstOrDefault();
            var info          = RenewalInfo.Get(ProjectId);
            var flowInfo      = FlowInfo.Get(FlowCode.Renewal);
            var legal         = RenewalLegalApproval.Get(project.ProjectId) ?? new RenewalLegalApproval();
            Dictionary <string, string> templateFileds = new Dictionary <string, string>();

            templateFileds.Add("WorkflowName", flowInfo.NameENUS);
            templateFileds.Add("ProjectID", ProjectId);
            templateFileds.Add("USCode", storeBasic.StoreCode);
            templateFileds.Add("Region", storeBasic.Region);
            templateFileds.Add("StoreNameEN", storeBasic.NameENUS);
            templateFileds.Add("Market", storeBasic.Market);
            templateFileds.Add("City", storeBasic.CityZHCN);
            templateFileds.Add("StoreNameCN", storeBasic.NameZHCN);
            templateFileds.Add("StoreAge", Math.Floor((DateTime.Now - storeBasic.OpenDate).TotalDays / 365D).ToString());
            templateFileds.Add("OpenDate", storeBasic.OpenDate.ToString("yyyy-MM-dd"));
            templateFileds.Add("CloseDate", storeBasic.CloseDate.HasValue ? (storeBasic.CloseDate.Value.Year != 1900 ? storeBasic.CloseDate.Value.ToString("yyyy-MM-dd") : "") : "");

            if (storeContract != null)
            {
                templateFileds.Add("CurrentLeaseENDYear", storeContract.EndYear);
            }
            else
            {
                templateFileds.Add("CurrentLeaseENDYear", "");
            }

            templateFileds.Add("AssetsManager", info.AssetManagerNameENUS);
            templateFileds.Add("AssetsActor", info.AssetActorNameENUS);
            templateFileds.Add("AssetsRep", info.AssetRepNameENUS);
            templateFileds.Add("NewLeaseENDYear", info.NewLeaseEndDate.HasValue ? info.NewLeaseEndDate.Value.ToString("yyyy") : "");
            templateFileds.Add("ClosureDate", storeBasic.CloseDate.HasValue ? (storeBasic.CloseDate.Value.Year != 1900 ? storeBasic.CloseDate.Value.ToString("yyyy-MM-dd") : "") : "");

            var           contractData = Employee.GetEmployeeContact(ProjectId);
            StringBuilder sbd          = new StringBuilder();

            if (contractData != null && contractData.Count > 0)
            {
                foreach (var item in contractData)
                {
                    sbd.Append("<tr><td>&nbsp;</td>");
                    sbd.Append("<td>");
                    sbd.Append(item.NameENUS);
                    sbd.Append("</td>");
                    sbd.Append("<td>");
                    sbd.Append(item.PositionENUS);
                    sbd.Append("</td>");
                    sbd.Append("<td>");
                    sbd.Append(item.Mail);
                    sbd.Append("</td>");
                    sbd.Append("<td>");
                    sbd.Append(item.Phone);
                    sbd.Append("</td>");
                    sbd.Append("<td>");
                    sbd.Append(item.Mobile);
                    sbd.Append("</td>");
                    sbd.Append("</tr>");
                }
            }
            else
            {
                sbd.Append("<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>");
            }
            templateFileds.Add("ContactInfoData", sbd.ToString());

            //Special Application
            templateFileds.Add("isurgencyyes", legal.IsUrgency ? "checked" : "");
            templateFileds.Add("isurgencyno", !legal.IsUrgency ? "checked" : "");
            templateFileds.Add("urgencyreason", legal.UrgencyReason);

            //transaction involves
            templateFileds.Add("isrecenttransfer", legal.IsRecentTransfer ? "checked" : "");
            templateFileds.Add("isintermediaries", legal.IsIntermediaries ? "checked" : "");
            templateFileds.Add("isrelatedparties", legal.IsRelatedParties ? "checked" : "");
            templateFileds.Add("isbroker", legal.IsBroker ? "checked" : "");
            templateFileds.Add("ispttp", legal.IsPTTP ? "checked" : "");
            templateFileds.Add("isasiiwgo", legal.IsASIIWGO ? "checked" : "");
            templateFileds.Add("isnoblclause", legal.IsNoBLClause ? "checked" : "");
            templateFileds.Add("isofac", legal.IsOFAC ? "checked" : "");
            templateFileds.Add("isantic", legal.IsAntiC ? "checked" : "");
            templateFileds.Add("isbenefitconflict", legal.IsBenefitConflict ? "checked" : "");
            templateFileds.Add("noneofabove", legal.NoneOfAbove ? "checked" : "");

            //Any Legal Concerns
            templateFileds.Add("anylegalconcernno", !legal.AnyLegalConcern ? "checked" : "");
            templateFileds.Add("anylegalconcernyes", legal.AnyLegalConcern ? "checked" : "");
            templateFileds.Add("illegalstructure", legal.IllegalStructure ? "checked" : "");
            templateFileds.Add("occupying", legal.Occupying ? "checked" : "");
            templateFileds.Add("noauthoritytorelease", legal.NoAuthorityToRelease ? "checked" : "");
            templateFileds.Add("entrustlease", legal.EntrustLease ? "checked" : "");
            templateFileds.Add("sublease", legal.SubLease ? "checked" : "");
            templateFileds.Add("beingsealedup", legal.BeingSealedUp ? "checked" : "");
            templateFileds.Add("beingsealedupdesc", legal.BeingSealedUpDesc);
            templateFileds.Add("licensecantbeobtained", legal.LicenseCantBeObtained ? "checked" : "");
            templateFileds.Add("pendingordispute", legal.PendingOrDispute ? "checked" : "");
            templateFileds.Add("pendingordisputedesc", legal.PendingOrDisputeDesc);
            templateFileds.Add("otherissure", legal.OtherIssure ? "checked" : "");
            templateFileds.Add("OtherIssureDesc", legal.OtherIssureDesc);

            //SOX Audit
            templateFileds.Add("optionsforrenewalyes", legal.OptionsForRenewal ? "checked" : "");
            templateFileds.Add("optionsforrenewalno", !legal.OptionsForRenewal ? "checked" : "");
            templateFileds.Add("reinstatementrequirementyes", legal.ReinstatementRequirement ? "checked" : "");
            templateFileds.Add("reinstatementrequirementno", !legal.ReinstatementRequirement ? "checked" : "");

            //Legal Department Review
            templateFileds.Add("endorsed", legal.ReviewStatus == "Endorsed" ? "checked" : "");
            templateFileds.Add("legalcomments", (legal.ReviewStatus == "LegalComments") ? "checked" : "");
            templateFileds.Add("notendorsed", legal.ReviewStatus == "" ? "NotEndorsed" : "");
            templateFileds.Add("submitbeforesign", legal.SubmitBeforeSign ? "checked" : "");
            templateFileds.Add("SubmitBeforeSignDesc", legal.SubmitBeforeSignDesc);
            templateFileds.Add("landlordformleaseuserd", legal.LandlordFormLeaseUserd ? "checked" : "");
            templateFileds.Add("ownerrefusetohonorlease", legal.OwnerRefuseToHonorLease ? "checked" : "");
            templateFileds.Add("mortgageerefusetoguarantee", legal.MortgageeRefuseToGuarantee ? "checked" : "");
            templateFileds.Add("otherlegalcomment", legal.OtherLegalComment ? "checked" : "");
            templateFileds.Add("LegalComments", legal.LegalComments);
            templateFileds.Add("OtherLegalCommentDesc", legal.OtherLegalCommentDesc);
            templateFileds.Add("NotEndorsedIssureNo", legal.NotEndorsedIssureNo.HasValue?legal.NotEndorsedIssureNo.Value.ToString():"");

            //Endorsement by General Counsel
            templateFileds.Add("GCComment", legal.GCComment);
            return(templateFileds);
        }