Ejemplo n.º 1
0
        public override string Edit()
        {
            var taskWork = TaskWork.FirstOrDefault(e => e.ReceiverAccount == ClientCookie.UserCode && e.SourceCode == FlowCode.Closure && e.TypeCode == FlowCode.Closure_ExecutiveSummary && e.RefID == this.ProjectId);


            taskWork.Status         = TaskWorkStatus.UnFinish;
            taskWork.StatusNameZHCN = "任务";
            taskWork.StatusNameENUS = "任务";

            var closureEntity = ClosureInfo.GetByProjectId(this.ProjectId);

            taskWork.ReceiverAccount  = closureEntity.AssetActorAccount;
            taskWork.ReceiverNameENUS = closureEntity.AssetActorNameENUS;
            taskWork.ReceiverNameZHCN = closureEntity.AssetActorNameZHCN;
            taskWork.Id           = Guid.NewGuid();
            taskWork.CreateTime   = DateTime.Now;
            taskWork.Url          = TaskWork.BuildUrl(FlowCode.Closure_ExecutiveSummary, this.ProjectId, "");
            taskWork.ActivityName = NodeCode.Start;
            taskWork.ProcInstID   = null;
            taskWork.FinishTime   = null;
            taskWork.ActionName   = SetTaskActionName(ProjectId);
            TaskWork.Add(taskWork);

            this.IsHistory = true;

            this.Save();

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

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

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

            projectEntity.Status = ProjectStatus.UnFinish;

            ProjectInfo.Update(projectEntity);
            ProjectInfo.Reset(ProjectId, FlowCode.Closure_ExecutiveSummary);
            ProjectInfo.Reset(ProjectId, FlowCode.Closure);
            var attList = Attachment.Search(e => e.RefTableID == this.Id.ToString() && e.RefTableName == ClosureExecutiveSummary.TableName).AsNoTracking().ToList();

            var newList = new List <Attachment>();

            foreach (var att in attList)
            {
                var newAtt = objectCopy.AutoCopy(att);
                newAtt.RefTableID = newEntity.Id.ToString();
                newAtt.ID         = Guid.NewGuid();
                newList.Add(newAtt);
            }
            Attachment.Add(newList.ToArray());
            return(taskWork.Url);
        }
Ejemplo n.º 2
0
        public void Submit(string comment, Action onExecuting = null)
        {
            var actor = ProjectUsers.GetProjectUser(this.ProjectId, ProjectUserRoleCode.AssetActor);
            var task  = TaskWork.GetTaskWork(ProjectId, ClientCookie.UserCode, TaskWorkStatus.UnFinish,
                                             FlowCode.Renewal, WorkflowCode);
            var dataFields = SetWorkflowDataFields(task);
            var procInstId = K2FxContext.Current.StartProcess(WorkflowProcessCode, ClientCookie.UserCode, dataFields);

            if (procInstId > 0)
            {
                using (TransactionScope tranScope = new TransactionScope())
                {
                    this.ProcInstId        = procInstId;
                    this.CreateTime        = DateTime.Now;
                    this.CreateUserAccount = ClientCookie.UserCode;
                    this.Update();
                    var approveDialogUser = new ApproveDialogUser();
                    approveDialogUser.Id         = Guid.NewGuid();
                    approveDialogUser.LegalCode  = AppUsers.Legal.Code;
                    approveDialogUser.ProjectId  = this.ProjectId;
                    approveDialogUser.FlowCode   = this.WorkflowCode;
                    approveDialogUser.RefTableID = this.Id.ToString();
                    approveDialogUser.Add();
                    var project = ProjectInfo.Get(this.ProjectId, this.WorkflowCode);
                    project.CreateUserAccount = ClientCookie.UserCode;
                    project.Update();
                    var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode);
                    if (SavedComment != null)
                    {
                        SavedComment.Status     = ProjectCommentStatus.Submit;
                        SavedComment.Content    = comment;
                        SavedComment.CreateTime = DateTime.Now;
                        SavedComment.Update();
                    }
                    else
                    {
                        ProjectComment.AddComment(
                            ProjectCommentAction.Submit,
                            comment,
                            this.Id,
                            this.TableName,
                            FlowCode.Renewal,
                            procInstId,
                            ProjectCommentStatus.Submit
                            );
                    }
                    ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_LegalApproval_Input);
                    if (onExecuting != null)
                    {
                        onExecuting();
                    }
                    tranScope.Complete();
                }
            }
        }
Ejemplo n.º 3
0
        public void Submit(string comment, Action onExecuting = null)
        {
            var task = TaskWork.GetTaskWork(ProjectId, ClientCookie.UserCode, TaskWorkStatus.UnFinish,
                                            FlowCode.Renewal, WorkflowCode);
            var dataFields = SetWorkflowDataFields(task);
            var procInstId = K2FxContext.Current.StartProcess(WorkflowProcessCode, ClientCookie.UserCode, dataFields);

            if (procInstId > 0)
            {
                using (TransactionScope tranScope = new TransactionScope())
                {
                    task.Finish();
                    this.ProcInstId        = procInstId;
                    this.CreateTime        = DateTime.Now;
                    this.CreateUserAccount = ClientCookie.UserCode;
                    this.Update();
                    if (this.HasReinvenstment)
                    {
                        SaveApprovers();
                    }
                    var project = ProjectInfo.Get(this.ProjectId, this.WorkflowCode);
                    project.CreateUserAccount = ClientCookie.UserCode;
                    project.Update();
                    var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode);
                    if (SavedComment != null)
                    {
                        SavedComment.Status     = ProjectCommentStatus.Submit;
                        SavedComment.Content    = comment;
                        SavedComment.CreateTime = DateTime.Now;
                        SavedComment.Update();
                    }
                    else
                    {
                        ProjectComment.AddComment(
                            ProjectCommentAction.Submit,
                            comment,
                            this.Id,
                            this.TableName,
                            FlowCode.Renewal,
                            procInstId,
                            ProjectCommentStatus.Submit
                            );
                    }
                    if (HasReinvenstment)
                    {
                        ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_ConsInfo_Input);
                    }
                    if (onExecuting != null)
                    {
                        onExecuting();
                    }
                    tranScope.Complete();
                }
            }
        }
Ejemplo n.º 4
0
        public bool EnableReGenClosureTool()
        {
            if (this == null)
            {
                return(false);
            }
            var projectInfo = ProjectInfo.Get(this.ProjectId, FlowCode.Closure_ClosureTool);

            if (projectInfo.Status != ProjectStatus.Finished)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 5
0
        public void Save(bool pushOrNot)
        {
            using (TransactionScope tranScope = new TransactionScope())
            {
                var projectInfo = ProjectInfo.Get(Id);
                if (projectInfo == null)
                {
                    ProjectId = ProjectInfo.CreateDLProject(Id, FlowCode.Renewal, USCode, NodeCode.Start, ClientCookie.UserCode, pushOrNot);

                    var renewalInfo = new RenewalInfo();
                    renewalInfo.Id                 = Guid.NewGuid();
                    renewalInfo.ProjectId          = ProjectId;
                    renewalInfo.USCode             = USCode;
                    renewalInfo.RenewalYears       = 0;
                    renewalInfo.NeedProjectCostEst = false;
                    renewalInfo.CreateTime         = DateTime.Now;
                    renewalInfo.CreateUserAccount  = ClientCookie.UserCode;
                    renewalInfo.Add();

                    var renewalConsInfo = new RenewalConsInfo();
                    renewalConsInfo.Id                = Guid.NewGuid();
                    renewalConsInfo.ProjectId         = ProjectId;
                    renewalConsInfo.HasReinvenstment  = false;
                    renewalConsInfo.IsHistory         = false;
                    renewalConsInfo.CreateTime        = DateTime.Now;
                    renewalConsInfo.CreateUserAccount = ClientCookie.UserCode;
                    renewalConsInfo.ProcInstId        = 0;
                    renewalConsInfo.Add();

                    var writeOffAmount = new WriteOffAmount();
                    writeOffAmount.Id            = Guid.NewGuid();
                    writeOffAmount.ConsInfoID    = renewalConsInfo.Id;
                    writeOffAmount.TotalWriteOff = Renewal_Total_WO_Proj;
                    writeOffAmount.TotalNBV      = Renewal_Total_WO_Act;
                    writeOffAmount.Add();

                    var reinvestmentCost = new ReinvestmentCost();
                    reinvestmentCost.Id                    = Guid.NewGuid();
                    reinvestmentCost.ConsInfoID            = renewalConsInfo.Id;
                    reinvestmentCost.TotalReinvestmentNorm = Renewal_Total_Reinvestment_Proj;
                    reinvestmentCost.LHINorm               = Renewal_Total_Reinvestment_Act;
                    reinvestmentCost.Add();

                    var renewalAnalysis = new RenewalAnalysis();
                    renewalAnalysis.Id                  = Guid.NewGuid();
                    renewalAnalysis.ProjectId           = ProjectId;
                    renewalAnalysis.CreateUserAccount   = ClientCookie.UserCode;
                    renewalAnalysis.CreateTime          = DateTime.Now;
                    renewalAnalysis.IsHistory           = false;
                    renewalAnalysis.FairMarketRentAgent = Fair_Market_Rent;
                    renewalAnalysis.DR1stTYAmount       = DR1stTYAmount;
                    renewalAnalysis.RentDeviation       = RentDeviation;
                    renewalAnalysis.DRMFLastTYSales     = DRMFLastTYSales;
                    renewalAnalysis.DRMF1stTY           = DRMF1stTY;
                    renewalAnalysis.Add();

                    var renewalTool = new RenewalTool();
                    renewalTool.Id                = Guid.NewGuid();
                    renewalTool.ProjectId         = ProjectId;
                    renewalTool.IsHistory         = false;
                    renewalTool.CreateTime        = DateTime.Now;
                    renewalTool.CreateUserAccount = ClientCookie.UserCode;
                    renewalTool.Add();

                    var renewalToolFinMeasureOutput = new RenewalToolFinMeasureOutput();
                    renewalToolFinMeasureOutput.Id                 = Guid.NewGuid();
                    renewalToolFinMeasureOutput.ToolId             = renewalTool.Id;
                    renewalToolFinMeasureOutput.RentAsProdSalesYr1 = SRMFLastTYSales;
                    renewalToolFinMeasureOutput.RentAsProdSalesAvg = SRMF1stTYSales;
                    renewalToolFinMeasureOutput.Add();

                    var projectContractInfo = new ProjectContractInfo();
                    projectContractInfo.Id                           = Guid.NewGuid();
                    projectContractInfo.ProjectId                    = ProjectId;
                    projectContractInfo.ContractInfoId               = Guid.Empty;
                    projectContractInfo.CreatedTime                  = DateTime.Now;
                    projectContractInfo.WriteBack                    = false;
                    projectContractInfo.EditMode                     = EditMode;
                    projectContractInfo.PartyAFullName               = PartyAFullName;
                    projectContractInfo.McDLegalEntity               = ContractEntityName;
                    projectContractInfo.McDOwnership                 = McdOwnership;
                    projectContractInfo.ContactPerson                = ContactPerson;
                    projectContractInfo.ContactMode                  = ContactMode;
                    projectContractInfo.RentType                     = RentType;
                    projectContractInfo.TotalLeasedArea              = RentSize;
                    projectContractInfo.LeasePurchaseTerm            = ContractTerm;
                    projectContractInfo.LeasePurchase                = ContractType;
                    projectContractInfo.StartDate                    = ContractStartDate;
                    projectContractInfo.EndDate                      = ContraceEndDate;
                    projectContractInfo.StartYear                    = ContractStartYear;
                    projectContractInfo.EndYear                      = ContraceEndYear;
                    projectContractInfo.RentCommencementDate         = RentPaymentStartDate;
                    projectContractInfo.DeadlineToNotice             = DeadlineToNoticeLL;
                    projectContractInfo.Changedafter2010             = ChangedAfter2010;
                    projectContractInfo.RentStructure                = RentStructure;
                    projectContractInfo.WithEarlyTerminationClause   = EarlyTerminationClause;
                    projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription;
                    projectContractInfo.RentPaymentArrangement       = RentPaymentArrangement;
                    projectContractInfo.HasDeposit                   = Deposit;
                    projectContractInfo.DepositAmount                = DepositAmount;
                    projectContractInfo.RefundableDate               = WhenRefund;
                    projectContractInfo.WithPenaltyClause            = withPenaltyClause;
                    projectContractInfo.HasBankGuarantee             = BankGuarantee;
                    projectContractInfo.BGNumber                     = BankGuaranteeNumber;
                    projectContractInfo.BGAmount                     = BankGuaranteeAmount;
                    projectContractInfo.BGCommencementDate           = BGCommencementDate;
                    projectContractInfo.BGEndDate                    = BGEndDate;
                    projectContractInfo.Add();
                }
                else
                {
                    ProjectId            = projectInfo.ProjectId;
                    projectInfo.IsPushed = pushOrNot;
                    projectInfo.Update();

                    var renewalInfo = RenewalInfo.FirstOrDefault(i => i.ProjectId == ProjectId);
                    if (renewalInfo == null)
                    {
                        renewalInfo                    = new RenewalInfo();
                        renewalInfo.Id                 = Guid.NewGuid();
                        renewalInfo.ProjectId          = ProjectId;
                        renewalInfo.USCode             = USCode;
                        renewalInfo.RenewalYears       = 0;
                        renewalInfo.NeedProjectCostEst = false;
                        renewalInfo.CreateTime         = DateTime.Now;
                        renewalInfo.CreateUserAccount  = ClientCookie.UserCode;
                        renewalInfo.Add();
                    }

                    var renewalConsInfo = RenewalConsInfo.FirstOrDefault(i => i.ProjectId == ProjectId && !i.IsHistory);
                    if (renewalConsInfo == null)
                    {
                        renewalConsInfo                   = new RenewalConsInfo();
                        renewalConsInfo.Id                = Guid.NewGuid();
                        renewalConsInfo.ProjectId         = ProjectId;
                        renewalConsInfo.HasReinvenstment  = false;
                        renewalConsInfo.IsHistory         = false;
                        renewalConsInfo.CreateTime        = DateTime.Now;
                        renewalConsInfo.CreateUserAccount = ClientCookie.UserCode;
                        renewalConsInfo.ProcInstId        = 0;
                        renewalConsInfo.Add();
                    }

                    var writeOffAmount = WriteOffAmount.FirstOrDefault(i => i.ConsInfoID == renewalConsInfo.Id);
                    if (writeOffAmount == null)
                    {
                        writeOffAmount               = new WriteOffAmount();
                        writeOffAmount.Id            = Guid.NewGuid();
                        writeOffAmount.ConsInfoID    = renewalConsInfo.Id;
                        writeOffAmount.TotalWriteOff = Renewal_Total_WO_Proj;
                        writeOffAmount.TotalNBV      = Renewal_Total_WO_Act;
                        writeOffAmount.Add();
                    }
                    else
                    {
                        writeOffAmount.TotalWriteOff = Renewal_Total_WO_Proj;
                        writeOffAmount.TotalNBV      = Renewal_Total_WO_Act;
                        writeOffAmount.Update();
                    }

                    var reinvestmentCost = ReinvestmentCost.FirstOrDefault(i => i.ConsInfoID == renewalConsInfo.Id);
                    if (reinvestmentCost == null)
                    {
                        reinvestmentCost                       = new ReinvestmentCost();
                        reinvestmentCost.Id                    = Guid.NewGuid();
                        reinvestmentCost.ConsInfoID            = renewalConsInfo.Id;
                        reinvestmentCost.TotalReinvestmentNorm = Renewal_Total_Reinvestment_Proj;
                        reinvestmentCost.LHINorm               = Renewal_Total_Reinvestment_Act;
                        reinvestmentCost.Add();
                    }
                    else
                    {
                        reinvestmentCost.TotalReinvestmentNorm = Renewal_Total_Reinvestment_Proj;
                        reinvestmentCost.LHINorm = Renewal_Total_Reinvestment_Act;
                        reinvestmentCost.Update();
                    }

                    var renewalAnalysis = RenewalAnalysis.FirstOrDefault(i => i.ProjectId == ProjectId && !i.IsHistory);
                    if (renewalAnalysis == null)
                    {
                        renewalAnalysis                     = new RenewalAnalysis();
                        renewalAnalysis.Id                  = Guid.NewGuid();
                        renewalAnalysis.ProjectId           = ProjectId;
                        renewalAnalysis.CreateUserAccount   = ClientCookie.UserCode;
                        renewalAnalysis.CreateTime          = DateTime.Now;
                        renewalAnalysis.IsHistory           = false;
                        renewalAnalysis.FairMarketRentAgent = Fair_Market_Rent;
                        renewalAnalysis.DR1stTYAmount       = DR1stTYAmount;
                        renewalAnalysis.RentDeviation       = RentDeviation;
                        renewalAnalysis.DRMFLastTYSales     = DRMFLastTYSales;
                        renewalAnalysis.DRMF1stTY           = DRMF1stTY;
                        renewalAnalysis.Add();
                    }
                    else
                    {
                        renewalAnalysis.FairMarketRentAgent = Fair_Market_Rent;
                        renewalAnalysis.DR1stTYAmount       = DR1stTYAmount;
                        renewalAnalysis.RentDeviation       = RentDeviation;
                        renewalAnalysis.DRMFLastTYSales     = DRMFLastTYSales;
                        renewalAnalysis.DRMF1stTY           = DRMF1stTY;
                        renewalAnalysis.Update();
                    }

                    var renewalTool = RenewalTool.FirstOrDefault(i => i.ProjectId == ProjectId && !i.IsHistory);
                    if (renewalTool == null)
                    {
                        renewalTool                   = new RenewalTool();
                        renewalTool.Id                = Guid.NewGuid();
                        renewalTool.ProjectId         = ProjectId;
                        renewalTool.IsHistory         = false;
                        renewalTool.CreateTime        = DateTime.Now;
                        renewalTool.CreateUserAccount = ClientCookie.UserCode;
                        renewalTool.Add();
                    }

                    var renewalToolFinMeasureOutput = RenewalToolFinMeasureOutput.FirstOrDefault(i => i.ToolId == renewalTool.Id);
                    if (renewalToolFinMeasureOutput == null)
                    {
                        renewalToolFinMeasureOutput                    = new RenewalToolFinMeasureOutput();
                        renewalToolFinMeasureOutput.Id                 = Guid.NewGuid();
                        renewalToolFinMeasureOutput.ToolId             = renewalTool.Id;
                        renewalToolFinMeasureOutput.RentAsProdSalesYr1 = SRMFLastTYSales;
                        renewalToolFinMeasureOutput.RentAsProdSalesAvg = SRMF1stTYSales;
                        renewalToolFinMeasureOutput.Add();
                    }
                    else
                    {
                        renewalToolFinMeasureOutput.RentAsProdSalesYr1 = SRMFLastTYSales;
                        renewalToolFinMeasureOutput.RentAsProdSalesAvg = SRMF1stTYSales;
                        renewalToolFinMeasureOutput.Update();
                    }

                    var projectContractInfo = ProjectContractInfo.FirstOrDefault(i => i.ProjectId == ProjectId);
                    if (projectContractInfo != null)
                    {
                        projectContractInfo.EditMode                     = EditMode;
                        projectContractInfo.PartyAFullName               = PartyAFullName;
                        projectContractInfo.McDLegalEntity               = ContractEntityName;
                        projectContractInfo.McDOwnership                 = McdOwnership;
                        projectContractInfo.ContactPerson                = ContactPerson;
                        projectContractInfo.ContactMode                  = ContactMode;
                        projectContractInfo.RentType                     = RentType;
                        projectContractInfo.TotalLeasedArea              = RentSize;
                        projectContractInfo.LeasePurchaseTerm            = ContractTerm;
                        projectContractInfo.LeasePurchase                = ContractType;
                        projectContractInfo.StartDate                    = ContractStartDate;
                        projectContractInfo.EndDate                      = ContraceEndDate;
                        projectContractInfo.StartYear                    = ContractStartYear;
                        projectContractInfo.EndYear                      = ContraceEndYear;
                        projectContractInfo.RentCommencementDate         = RentPaymentStartDate;
                        projectContractInfo.DeadlineToNotice             = DeadlineToNoticeLL;
                        projectContractInfo.Changedafter2010             = ChangedAfter2010;
                        projectContractInfo.RentStructure                = RentStructure;
                        projectContractInfo.WithEarlyTerminationClause   = EarlyTerminationClause;
                        projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription;
                        projectContractInfo.RentPaymentArrangement       = RentPaymentArrangement;
                        projectContractInfo.HasDeposit                   = Deposit;
                        projectContractInfo.DepositAmount                = DepositAmount;
                        projectContractInfo.RefundableDate               = WhenRefund;
                        projectContractInfo.WithPenaltyClause            = withPenaltyClause;
                        projectContractInfo.HasBankGuarantee             = BankGuarantee;
                        projectContractInfo.BGNumber                     = BankGuaranteeNumber;
                        projectContractInfo.BGAmount                     = BankGuaranteeAmount;
                        projectContractInfo.BGCommencementDate           = BGCommencementDate;
                        projectContractInfo.BGEndDate                    = BGEndDate;
                        projectContractInfo.Update();
                    }
                    else
                    {
                        projectContractInfo                              = new ProjectContractInfo();
                        projectContractInfo.Id                           = Guid.NewGuid();
                        projectContractInfo.ProjectId                    = ProjectId;
                        projectContractInfo.ContractInfoId               = Guid.Empty;
                        projectContractInfo.CreatedTime                  = DateTime.Now;
                        projectContractInfo.WriteBack                    = false;
                        projectContractInfo.EditMode                     = EditMode;
                        projectContractInfo.PartyAFullName               = PartyAFullName;
                        projectContractInfo.McDLegalEntity               = ContractEntityName;
                        projectContractInfo.McDOwnership                 = McdOwnership;
                        projectContractInfo.ContactPerson                = ContactPerson;
                        projectContractInfo.ContactMode                  = ContactMode;
                        projectContractInfo.RentType                     = RentType;
                        projectContractInfo.TotalLeasedArea              = RentSize;
                        projectContractInfo.LeasePurchaseTerm            = ContractTerm;
                        projectContractInfo.LeasePurchase                = ContractType;
                        projectContractInfo.StartDate                    = ContractStartDate;
                        projectContractInfo.EndDate                      = ContraceEndDate;
                        projectContractInfo.StartYear                    = ContractStartYear;
                        projectContractInfo.EndYear                      = ContraceEndYear;
                        projectContractInfo.RentCommencementDate         = RentPaymentStartDate;
                        projectContractInfo.DeadlineToNotice             = DeadlineToNoticeLL;
                        projectContractInfo.Changedafter2010             = ChangedAfter2010;
                        projectContractInfo.RentStructure                = RentStructure;
                        projectContractInfo.WithEarlyTerminationClause   = EarlyTerminationClause;
                        projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription;
                        projectContractInfo.RentPaymentArrangement       = RentPaymentArrangement;
                        projectContractInfo.HasDeposit                   = Deposit;
                        projectContractInfo.DepositAmount                = DepositAmount;
                        projectContractInfo.RefundableDate               = WhenRefund;
                        projectContractInfo.WithPenaltyClause            = withPenaltyClause;
                        projectContractInfo.HasBankGuarantee             = BankGuarantee;
                        projectContractInfo.BGNumber                     = BankGuaranteeNumber;
                        projectContractInfo.BGAmount                     = BankGuaranteeAmount;
                        projectContractInfo.BGCommencementDate           = BGCommencementDate;
                        projectContractInfo.BGEndDate                    = BGEndDate;
                        projectContractInfo.Add();
                    }
                }
                tranScope.Complete();
            }
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        public Dictionary <string, string> GetPrintTemplateFields()
        {
            var project            = ProjectInfo.Get(this.ProjectId, FlowCode.TempClosure_ClosurePackage);
            var storeBasic         = StoreBasicInfo.FirstOrDefault(s => s.StoreCode == project.USCode);
            var storeContract      = StoreContractInfo.Get(storeBasic.StoreCode);
            var assetMgr           = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetManager);
            var assetActor         = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
            var assetRep           = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetRep);
            var tempClosurePackage = TempClosurePackage.Get(ProjectId);
            var tempClosure        = TempClosureInfo.Get(ProjectId);
            Dictionary <string, string> templateFileds = new Dictionary <string, string>();

            templateFileds.Add("WorkflowName", SystemCode.Instance.GetCodeName(FlowCode.TempClosure, ClientCookie.Language));
            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"));
            var storeInfo = StoreBasicInfo.GetStore(project.USCode);

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

            if (assetMgr != null)
            {
                templateFileds.Add("AssetsManager", assetMgr.UserNameENUS);
            }
            else
            {
                templateFileds.Add("AssetsManager", "");
            }

            templateFileds.Add("AssetsActor", assetActor.UserNameENUS);
            templateFileds.Add("AssetsRep", assetRep.UserNameENUS);
            templateFileds.Add("Address", storeBasic.AddressZHCN);
            templateFileds.Add("CloseDate", storeBasic.CloseDate.HasValue ? (storeBasic.CloseDate.Value.Year != 1900 ? storeBasic.CloseDate.Value.ToString("yyyy-MM-dd") : "") : "");
            templateFileds.Add("ClosureDate", tempClosure.ActualTempClosureDate.ToString("yyyy-MM-dd"));
            templateFileds.Add("LeaseExpireDate", tempClosure.LeaseExpireDate.HasValue ? tempClosure.LeaseExpireDate.Value.ToString("yyyy-MM-dd") : "");
            templateFileds.Add("ReOpenDate", tempClosure.ActualReopenDate.ToString("yyyy-MM-dd"));
            templateFileds.Add("RentFreeTerm", string.IsNullOrEmpty(tempClosurePackage.RentReliefClause) ? "否" : "是");
            templateFileds.Add("RentFreeStartDate", tempClosurePackage.RentReliefStartDate.HasValue ? tempClosurePackage.RentReliefStartDate.Value.ToString("yyyy-MM-dd") : "");
            templateFileds.Add("RentFreeEndDate", tempClosurePackage.RentReliefEndDate.HasValue ? tempClosurePackage.RentReliefEndDate.Value.ToString("yyyy-MM-dd") : "");
            templateFileds.Add("FreeRentTerm", tempClosurePackage.RentReliefClause);
            templateFileds.Add("LandlordName", tempClosure.LandlordName);
            if (tempClosurePackage.RentRelief.HasValue)
            {
                templateFileds.Add("ReliefRent", tempClosurePackage.RentRelief.Value ? "是" : "否");
            }
            else
            {
                templateFileds.Add("ReliefRent", "");
            }

            return(templateFileds);
        }
Ejemplo n.º 8
0
        public void Resubmit(string comment, string SerialNumber, ApproveUsers newApprover, Action onExecuting = null)
        {
            var    assetActor = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == this.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
            string destMRMgrs = newApprover.MarketMgr.Code;

            if (newApprover.RegionalMgr != null)
            {
                destMRMgrs += ";" + newApprover.RegionalMgr.Code;
            }
            List <ProcessDataField> dataFields = new List <ProcessDataField>
            {
                new ProcessDataField("dest_Creator", this.CreateUserAccount),
                new ProcessDataField("dest_MRMgrs", destMRMgrs),
                new ProcessDataField("dest_GMApprovers", string.Concat(newApprover.MDD.Code, ";", newApprover.GM.Code, ";", newApprover.FC.Code)),
                new ProcessDataField("dest_VPGM", newApprover.VPGM.Code),
                new ProcessDataField("ProcessCode", this.WorkflowProcessCode)
            };

            K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Resubmit", comment, dataFields);
            using (TransactionScope tranScope = new TransactionScope())
            {
                var project = ProjectInfo.Get(this.ProjectId, FlowCode.TempClosure_ClosurePackage);
                project.CreateUserAccount = ClientCookie.UserCode;
                project.Update();
                this.CreateUserAccount = ClientCookie.UserCode;
                Update(this);
                var approver = ApproveDialogUser.GetApproveDialogUser(this.Id.ToString());
                if (approver == null)
                {
                    approver = new ApproveDialogUser();
                }
                approver.ProjectId     = this.ProjectId;
                approver.RefTableID    = this.Id.ToString();
                approver.FlowCode      = this.WorkflowCode;
                approver.MarketMgrCode = newApprover.MarketMgr.Code;
                if (newApprover.RegionalMgr != null)
                {
                    approver.RegionalMgrCode = newApprover.RegionalMgr.Code;
                }
                else
                {
                    approver.RegionalMgrCode = null;
                }
                approver.MDDCode          = newApprover.MDD.Code;
                approver.GMCode           = newApprover.GM.Code;
                approver.FCCode           = newApprover.FC.Code;
                approver.VPGMCode         = newApprover.VPGM.Code;
                approver.MCCLAssetMgrCode = newApprover.MCCLAssetMgr.Code;
                approver.MCCLAssetDtrCode = newApprover.MCCLAssetDtr.Code;
                approver.NoticeUsers      = string.Join(";", newApprover.NoticeUsers.Select(u => u.Code).ToArray());
                approver.Save();
                ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.TempClosure_ClosurePackage_Input);
                var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode);
                if (SavedComment != null)
                {
                    SavedComment.Status     = ProjectCommentStatus.Submit;
                    SavedComment.Action     = ProjectCommentAction.ReSubmit;
                    SavedComment.Content    = comment;
                    SavedComment.CreateTime = DateTime.Now;
                    SavedComment.Update();
                }
                else
                {
                    ProjectComment.AddComment(
                        ProjectCommentAction.ReSubmit,
                        comment,
                        this.Id,
                        this.TableName,
                        FlowCode.TempClosure,
                        this.ProcInstId,
                        ProjectCommentStatus.Submit
                        );
                }

                var task = TaskWork.FirstOrDefault(t => t.RefID == this.ProjectId && t.TypeCode == this.WorkflowCode && t.ReceiverAccount == assetActor.UserAccount);
                task.Finish();
                if (onExecuting != null)
                {
                    onExecuting();
                }
                tranScope.Complete();
            }
        }
Ejemplo n.º 9
0
        public void Submit(string comment, ApproveUsers approvers, Action onExecuting = null)
        {
            var legal = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == this.ProjectId && pu.RoleCode == ProjectUserRoleCode.Legal);
            var task  = TaskWork.GetTaskWork(this.ProjectId, ClientCookie.UserCode, TaskWorkStatus.UnFinish,
                                             FlowCode.TempClosure, this.WorkflowCode);

            task.Status     = TaskWorkStatus.Finished;
            task.FinishTime = DateTime.Now;
            string destMRMgrs = approvers.MarketMgr.Code;

            if (approvers.RegionalMgr != null)
            {
                destMRMgrs += ";" + approvers.RegionalMgr.Code;
            }
            List <ProcessDataField> dataFields = new List <ProcessDataField>
            {
                new ProcessDataField("dest_Creator", this.CreateUserAccount),
                new ProcessDataField("dest_MRMgrs", destMRMgrs),
                new ProcessDataField("dest_GMApprovers", string.Concat(approvers.MDD.Code, ";", approvers.GM.Code, ";", approvers.FC.Code)),
                new ProcessDataField("dest_VPGM", approvers.VPGM.Code),
                new ProcessDataField("ProcessCode", this.WorkflowProcessCode),
                new ProcessDataField("ProjectTaskInfo", JsonConvert.SerializeObject(task))
            };
            var procInstId = K2FxContext.Current.StartProcess(WorkflowProcessCode, ClientCookie.UserCode, dataFields);

            if (procInstId > 0)
            {
                using (TransactionScope tranScope = new TransactionScope())
                {
                    TaskWork.Update(task);
                    var project = ProjectInfo.Get(this.ProjectId, FlowCode.TempClosure_ClosurePackage);
                    project.CreateUserAccount = ClientCookie.UserCode;
                    project.Update();
                    this.CreateUserAccount = ClientCookie.UserCode;
                    this.ProcInstId        = procInstId;
                    Update(this);
                    var approver = ApproveDialogUser.GetApproveDialogUser(this.Id.ToString());
                    if (approver == null)
                    {
                        approver = new ApproveDialogUser();
                    }
                    approver.ProjectId     = this.ProjectId;
                    approver.RefTableID    = this.Id.ToString();
                    approver.FlowCode      = FlowCode.TempClosure_ClosurePackage;
                    approver.MarketMgrCode = approvers.MarketMgr.Code;
                    if (approvers.RegionalMgr != null)
                    {
                        approver.RegionalMgrCode = approvers.RegionalMgr.Code;
                    }
                    approver.MDDCode  = approvers.MDD.Code;
                    approver.GMCode   = approvers.GM.Code;
                    approver.FCCode   = approvers.FC.Code;
                    approver.VPGMCode = approvers.VPGM.Code;
                    //approver.MCCLAssetMgrCode = approvers.MCCLAssetMgr.Code;
                    //approver.MCCLAssetDtrCode = approvers.MCCLAssetDtr.Code;
                    approver.NecessaryNoticeUsers = string.Join(";", approvers.NecessaryNoticeUsers.Select(u => u.Code).ToArray());
                    approver.NoticeUsers          = string.Join(";", approvers.NoticeUsers.Select(u => u.Code).ToArray());
                    approver.Save();
                    ProjectInfo.FinishNode(this.ProjectId, FlowCode.TempClosure_ClosurePackage, NodeCode.TempClosure_ClosurePackage_Input);
                    var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode);
                    if (SavedComment != null)
                    {
                        SavedComment.Status     = ProjectCommentStatus.Submit;
                        SavedComment.Content    = comment;
                        SavedComment.CreateTime = DateTime.Now;
                        SavedComment.Update();
                    }
                    else
                    {
                        ProjectComment.AddComment(
                            ProjectCommentAction.Submit,
                            comment,
                            this.Id,
                            "TempClosurePackage",
                            FlowCode.TempClosure,
                            this.ProcInstId,
                            ProjectCommentStatus.Submit
                            );
                    }
                    if (onExecuting != null)
                    {
                        onExecuting();
                    }
                    tranScope.Complete();
                }
            }
        }
Ejemplo n.º 10
0
        public void Save(bool pushOrNot)
        {
            using (TransactionScope tranScope = new TransactionScope())
            {
                var projectInfo = ProjectInfo.Get(Id);
                if (projectInfo == null)
                {
                    ProjectId = ProjectInfo.CreateDLProject(Id, FlowCode.MajorLease, USCode, NodeCode.Start, ClientCookie.UserCode, pushOrNot);

                    var mlcInfo = new MajorLeaseInfo();
                    mlcInfo.Id                    = Guid.NewGuid();
                    mlcInfo.ProjectId             = ProjectId;
                    mlcInfo.USCode                = USCode;
                    mlcInfo.ChangeRentalType      = ChangeRentalType;
                    mlcInfo.ChangeRentalTypeDESC  = ChangeRentalTypeDESC;
                    mlcInfo.ChangeRedLineType     = ChangeRedLineType;
                    mlcInfo.ChangeRedLineTypeDESC = ChangeRedLineTypeDESC;
                    mlcInfo.ChangeLeaseTermType   = ChangeLeaseTermType;
                    mlcInfo.ChangeLeaseTermDESC   = ChangeLeaseTermDESC;
                    mlcInfo.CreateTime            = DateTime.Now;
                    mlcInfo.CreateUserAccount     = ClientCookie.UserCode;
                    mlcInfo.CreateUserNameENUS    = ClientCookie.UserNameENUS;
                    mlcInfo.CreateUserNameZHCN    = ClientCookie.UserNameZHCN;
                    mlcInfo.ChangeLandlordType    = ChangeLandlordType;
                    mlcInfo.ChangeLandLordDESC    = ChangeLandLordDESC;
                    mlcInfo.Add();

                    var mlcPackage = new MajorLeaseChangePackage();
                    mlcPackage.Id                = Guid.NewGuid();
                    mlcPackage.ProjectId         = ProjectId;
                    mlcPackage.WriteOff          = MLCNetWriteOff_Act;
                    mlcPackage.IsHistory         = false;
                    mlcPackage.CreateUserAccount = ClientCookie.UserCode;
                    mlcPackage.CreateTime        = DateTime.Now;
                    mlcPackage.Add();

                    var mlcConsInvtChecking = new MajorLeaseConsInvtChecking();
                    mlcConsInvtChecking.Id         = Guid.NewGuid();
                    mlcConsInvtChecking.ProjectId  = ProjectId;
                    mlcConsInvtChecking.IsHistory  = false;
                    mlcConsInvtChecking.CreateTime = DateTime.Now;
                    mlcConsInvtChecking.Add();

                    var reinvestmentCost = new ReinvestmentCost();
                    reinvestmentCost.Id                     = Guid.NewGuid();
                    reinvestmentCost.ConsInfoID             = mlcConsInvtChecking.Id;
                    reinvestmentCost.TotalReinvestmentFAAct = MLC_TotalReinvestment_Act;
                    reinvestmentCost.Add();

                    var projectContractInfo = new ProjectContractInfo();
                    projectContractInfo.Id                           = Guid.NewGuid();
                    projectContractInfo.ProjectId                    = ProjectId;
                    projectContractInfo.ContractInfoId               = Guid.Empty;
                    projectContractInfo.CreatedTime                  = DateTime.Now;
                    projectContractInfo.WriteBack                    = false;
                    projectContractInfo.EditMode                     = EditMode;
                    projectContractInfo.PartyAFullName               = PartyAFullName;
                    projectContractInfo.McDLegalEntity               = ContractEntityName;
                    projectContractInfo.McDOwnership                 = McdOwnership;
                    projectContractInfo.ContactPerson                = ContactPerson;
                    projectContractInfo.ContactMode                  = ContactMode;
                    projectContractInfo.RentType                     = RentType;
                    projectContractInfo.TotalLeasedArea              = RentSize;
                    projectContractInfo.LeasePurchaseTerm            = ContractTerm;
                    projectContractInfo.LeasePurchase                = ContractType;
                    projectContractInfo.StartDate                    = ContractStartDate;
                    projectContractInfo.EndDate                      = ContraceEndDate;
                    projectContractInfo.StartYear                    = ContractStartYear;
                    projectContractInfo.EndYear                      = ContraceEndYear;
                    projectContractInfo.RentCommencementDate         = RentPaymentStartDate;
                    projectContractInfo.DeadlineToNotice             = DeadlineToNoticeLL;
                    projectContractInfo.Changedafter2010             = ChangedAfter2010;
                    projectContractInfo.RentStructure                = RentStructure;
                    projectContractInfo.WithEarlyTerminationClause   = EarlyTerminationClause;
                    projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription;
                    projectContractInfo.RentPaymentArrangement       = RentPaymentArrangement;
                    projectContractInfo.HasDeposit                   = Deposit;
                    projectContractInfo.DepositAmount                = DepositAmount;
                    projectContractInfo.RefundableDate               = WhenRefund;
                    projectContractInfo.WithPenaltyClause            = withPenaltyClause;
                    projectContractInfo.HasBankGuarantee             = BankGuarantee;
                    projectContractInfo.BGNumber                     = BankGuaranteeNumber;
                    projectContractInfo.BGAmount                     = BankGuaranteeAmount;
                    projectContractInfo.BGCommencementDate           = BGCommencementDate;
                    projectContractInfo.BGEndDate                    = BGEndDate;
                    projectContractInfo.Add();
                }
                else
                {
                    ProjectId            = projectInfo.ProjectId;
                    projectInfo.IsPushed = pushOrNot;
                    projectInfo.Update();

                    var mlcInfo = MajorLeaseInfo.FirstOrDefault(i => i.ProjectId == ProjectId);
                    if (mlcInfo != null)
                    {
                        mlcInfo.ChangeRentalType      = ChangeRentalType;
                        mlcInfo.ChangeRentalTypeDESC  = ChangeRentalTypeDESC;
                        mlcInfo.ChangeRedLineType     = ChangeRedLineType;
                        mlcInfo.ChangeRedLineTypeDESC = ChangeRedLineTypeDESC;
                        mlcInfo.ChangeLeaseTermType   = ChangeLeaseTermType;
                        mlcInfo.ChangeLeaseTermDESC   = ChangeLeaseTermDESC;
                        mlcInfo.ChangeLandlordType    = ChangeLandlordType;
                        mlcInfo.ChangeLandLordDESC    = ChangeLandLordDESC;
                        mlcInfo.Update();
                    }
                    else
                    {
                        mlcInfo                       = new MajorLeaseInfo();
                        mlcInfo.Id                    = Guid.NewGuid();
                        mlcInfo.ProjectId             = ProjectId;
                        mlcInfo.USCode                = USCode;
                        mlcInfo.ChangeRentalType      = ChangeRentalType;
                        mlcInfo.ChangeRentalTypeDESC  = ChangeRentalTypeDESC;
                        mlcInfo.ChangeRedLineType     = ChangeRedLineType;
                        mlcInfo.ChangeRedLineTypeDESC = ChangeRedLineTypeDESC;
                        mlcInfo.ChangeLeaseTermType   = ChangeLeaseTermType;
                        mlcInfo.ChangeLeaseTermDESC   = ChangeLeaseTermDESC;
                        mlcInfo.CreateTime            = DateTime.Now;
                        mlcInfo.CreateUserAccount     = ClientCookie.UserCode;
                        mlcInfo.CreateUserNameENUS    = ClientCookie.UserNameENUS;
                        mlcInfo.CreateUserNameZHCN    = ClientCookie.UserNameZHCN;
                        mlcInfo.ChangeLandlordType    = ChangeLandlordType;
                        mlcInfo.ChangeLandLordDESC    = ChangeLandLordDESC;
                        mlcInfo.Add();
                    }

                    var mlcPackage = MajorLeaseChangePackage.GetMajorPackageInfo(ProjectId);
                    if (mlcPackage != null)
                    {
                        mlcPackage.WriteOff = MLCNetWriteOff_Act;
                        mlcPackage.Update();
                    }
                    else
                    {
                        mlcPackage                   = new MajorLeaseChangePackage();
                        mlcPackage.Id                = Guid.NewGuid();
                        mlcPackage.ProjectId         = ProjectId;
                        mlcPackage.WriteOff          = MLCNetWriteOff_Act;
                        mlcPackage.IsHistory         = false;
                        mlcPackage.CreateUserAccount = ClientCookie.UserCode;
                        mlcPackage.CreateTime        = DateTime.Now;
                        mlcPackage.Add();
                    }

                    var mlcConsInvtChecking = MajorLeaseConsInvtChecking.FirstOrDefault(i => i.ProjectId == ProjectId && i.IsHistory == false);
                    if (mlcConsInvtChecking == null)
                    {
                        mlcConsInvtChecking            = new MajorLeaseConsInvtChecking();
                        mlcConsInvtChecking.Id         = Guid.NewGuid();
                        mlcConsInvtChecking.ProjectId  = ProjectId;
                        mlcConsInvtChecking.IsHistory  = false;
                        mlcConsInvtChecking.CreateTime = DateTime.Now;
                        mlcConsInvtChecking.Add();
                    }

                    var reinvestmentCost = ReinvestmentCost.GetByConsInfoId(mlcConsInvtChecking.Id);
                    if (reinvestmentCost != null)
                    {
                        reinvestmentCost.TotalReinvestmentFAAct = MLC_TotalReinvestment_Act;
                        reinvestmentCost.Update();
                    }
                    else
                    {
                        reinvestmentCost                        = new ReinvestmentCost();
                        reinvestmentCost.Id                     = Guid.NewGuid();
                        reinvestmentCost.ConsInfoID             = mlcConsInvtChecking.Id;
                        reinvestmentCost.TotalReinvestmentFAAct = MLC_TotalReinvestment_Act;
                        reinvestmentCost.Add();
                    }

                    var projectContractInfo = ProjectContractInfo.FirstOrDefault(i => i.ProjectId == ProjectId);
                    if (projectContractInfo != null)
                    {
                        projectContractInfo.EditMode                     = EditMode;
                        projectContractInfo.PartyAFullName               = PartyAFullName;
                        projectContractInfo.McDLegalEntity               = ContractEntityName;
                        projectContractInfo.McDOwnership                 = McdOwnership;
                        projectContractInfo.ContactPerson                = ContactPerson;
                        projectContractInfo.ContactMode                  = ContactMode;
                        projectContractInfo.RentType                     = RentType;
                        projectContractInfo.TotalLeasedArea              = RentSize;
                        projectContractInfo.LeasePurchaseTerm            = ContractTerm;
                        projectContractInfo.LeasePurchase                = ContractType;
                        projectContractInfo.StartDate                    = ContractStartDate;
                        projectContractInfo.EndDate                      = ContraceEndDate;
                        projectContractInfo.StartYear                    = ContractStartYear;
                        projectContractInfo.EndYear                      = ContraceEndYear;
                        projectContractInfo.RentCommencementDate         = RentPaymentStartDate;
                        projectContractInfo.DeadlineToNotice             = DeadlineToNoticeLL;
                        projectContractInfo.Changedafter2010             = ChangedAfter2010;
                        projectContractInfo.RentStructure                = RentStructure;
                        projectContractInfo.WithEarlyTerminationClause   = EarlyTerminationClause;
                        projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription;
                        projectContractInfo.RentPaymentArrangement       = RentPaymentArrangement;
                        projectContractInfo.HasDeposit                   = Deposit;
                        projectContractInfo.DepositAmount                = DepositAmount;
                        projectContractInfo.RefundableDate               = WhenRefund;
                        projectContractInfo.WithPenaltyClause            = withPenaltyClause;
                        projectContractInfo.HasBankGuarantee             = BankGuarantee;
                        projectContractInfo.BGNumber                     = BankGuaranteeNumber;
                        projectContractInfo.BGAmount                     = BankGuaranteeAmount;
                        projectContractInfo.BGCommencementDate           = BGCommencementDate;
                        projectContractInfo.BGEndDate                    = BGEndDate;
                        projectContractInfo.Update();
                    }
                    else
                    {
                        projectContractInfo                              = new ProjectContractInfo();
                        projectContractInfo.Id                           = Guid.NewGuid();
                        projectContractInfo.ProjectId                    = ProjectId;
                        projectContractInfo.ContractInfoId               = Guid.Empty;
                        projectContractInfo.CreatedTime                  = DateTime.Now;
                        projectContractInfo.WriteBack                    = false;
                        projectContractInfo.EditMode                     = EditMode;
                        projectContractInfo.PartyAFullName               = PartyAFullName;
                        projectContractInfo.McDLegalEntity               = ContractEntityName;
                        projectContractInfo.McDOwnership                 = McdOwnership;
                        projectContractInfo.ContactPerson                = ContactPerson;
                        projectContractInfo.ContactMode                  = ContactMode;
                        projectContractInfo.RentType                     = RentType;
                        projectContractInfo.TotalLeasedArea              = RentSize;
                        projectContractInfo.LeasePurchaseTerm            = ContractTerm;
                        projectContractInfo.LeasePurchase                = ContractType;
                        projectContractInfo.StartDate                    = ContractStartDate;
                        projectContractInfo.EndDate                      = ContraceEndDate;
                        projectContractInfo.StartYear                    = ContractStartYear;
                        projectContractInfo.EndYear                      = ContraceEndYear;
                        projectContractInfo.RentCommencementDate         = RentPaymentStartDate;
                        projectContractInfo.DeadlineToNotice             = DeadlineToNoticeLL;
                        projectContractInfo.Changedafter2010             = ChangedAfter2010;
                        projectContractInfo.RentStructure                = RentStructure;
                        projectContractInfo.WithEarlyTerminationClause   = EarlyTerminationClause;
                        projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription;
                        projectContractInfo.RentPaymentArrangement       = RentPaymentArrangement;
                        projectContractInfo.HasDeposit                   = Deposit;
                        projectContractInfo.DepositAmount                = DepositAmount;
                        projectContractInfo.RefundableDate               = WhenRefund;
                        projectContractInfo.WithPenaltyClause            = withPenaltyClause;
                        projectContractInfo.HasBankGuarantee             = BankGuarantee;
                        projectContractInfo.BGNumber                     = BankGuaranteeNumber;
                        projectContractInfo.BGAmount                     = BankGuaranteeAmount;
                        projectContractInfo.BGCommencementDate           = BGCommencementDate;
                        projectContractInfo.BGEndDate                    = BGEndDate;
                        projectContractInfo.Add();
                    }
                }
                tranScope.Complete();
            }
        }
Ejemplo n.º 11
0
        public void Save(bool pushOrNot)
        {
            using (TransactionScope tranScope = new TransactionScope())
            {
                var projectInfo = ProjectInfo.Get(Id);
                if (projectInfo == null)
                {
                    ProjectId = ProjectInfo.CreateDLProject(Id, FlowCode.Reimage, USCode, NodeCode.Start, ClientCookie.UserCode, pushOrNot);
                    var store = StoreBasicInfo.GetStorInfo(USCode);

                    var reimageInfo = new ReimageInfo();
                    reimageInfo.Id                 = Guid.NewGuid();
                    reimageInfo.ProjectId          = ProjectId;
                    reimageInfo.USCode             = USCode;
                    reimageInfo.CreateDate         = DateTime.Now;
                    reimageInfo.CreateUserAccount  = ClientCookie.UserCode;
                    reimageInfo.CreateUserNameENUS = ClientCookie.UserNameENUS;
                    reimageInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN;
                    reimageInfo.AssetRepAccount    = "";
                    reimageInfo.AssetRepNameZHCN   = "";
                    reimageInfo.AssetRepNameENUS   = "";
                    reimageInfo.AssetActorAccount  = "";
                    reimageInfo.AssetActorNameZHCN = "";
                    reimageInfo.AssetActorNameENUS = "";
                    reimageInfo.FinanceAccount     = "";
                    reimageInfo.FinanceNameZHCN    = "";
                    reimageInfo.FinanceNameENUS    = "";
                    reimageInfo.PMAccount          = "";
                    reimageInfo.PMNameZHCN         = "";
                    reimageInfo.PMNameENUS         = "";
                    reimageInfo.LegalAccount       = "";
                    reimageInfo.LegalNameZHCN      = "";
                    reimageInfo.LegalNameENUS      = "";
                    reimageInfo.StoreNameENUS      = store.NameENUS;
                    reimageInfo.StoreNameZHCN      = store.NameZHCN;
                    reimageInfo.GBDate             = GBDate;
                    reimageInfo.ReopenDate         = ReopenDate;
                    reimageInfo.Add();

                    var reimageConsInfo = new ReimageConsInfo();
                    reimageConsInfo.Id                = Guid.NewGuid();
                    reimageConsInfo.ProjectId         = ProjectId;
                    reimageConsInfo.IsHistory         = false;
                    reimageConsInfo.CreateTime        = DateTime.Now;
                    reimageConsInfo.CreateUserAccount = ClientCookie.UserCode;
                    reimageConsInfo.Add();

                    var reinvestmentBasicInfo = new ReinvestmentBasicInfo();
                    reinvestmentBasicInfo.ConsInfoID        = reimageConsInfo.Id;
                    reinvestmentBasicInfo.RightSizingSeatNo = RightSizingSeatNO;
                    reinvestmentBasicInfo.NewDesignType     = AfterReimageDesignType;
                    reinvestmentBasicInfo.Add();

                    var reimageConsInvtChecking = new ReimageConsInvtChecking();
                    reimageConsInvtChecking.Id                = Guid.NewGuid();
                    reimageConsInvtChecking.ProjectId         = ProjectId;
                    reimageConsInvtChecking.IsHistory         = false;
                    reimageConsInvtChecking.CreateTime        = DateTime.Now;
                    reimageConsInvtChecking.CreateUserAccount = ClientCookie.UserCode;
                    reimageConsInvtChecking.Add();

                    var writeOffAmount = new WriteOffAmount();
                    writeOffAmount.Id            = Guid.NewGuid();
                    writeOffAmount.ConsInfoID    = reimageConsInvtChecking.Id;
                    writeOffAmount.TotalWriteOff = Reimage_Total_WO_Proj;
                    writeOffAmount.TotalActual   = Reimage_Total_WO_Act;
                    writeOffAmount.Add();

                    var reinvestmentCost = new ReinvestmentCost();
                    reinvestmentCost.Id         = Guid.NewGuid();
                    reinvestmentCost.ConsInfoID = reimageConsInvtChecking.Id;
                    reinvestmentCost.TotalReinvestmentBudget = Reimage_Total_Reinvestment_Proj;
                    reinvestmentCost.TotalReinvestmentPMAct  = Reimage_Total_Reinvestment_Act;
                    reinvestmentCost.Add();

                    var reopenMemo = new ReopenMemo();
                    reopenMemo.Id        = Guid.NewGuid();
                    reopenMemo.ProjectId = ProjectId;
                    reopenMemo.NewMcCafe = false;
                    reopenMemo.NewKiosk  = false;
                    reopenMemo.NewMDS    = false;
                    reopenMemo.Is24H     = false;
                    reopenMemo.AftARSN   = AfterReimageSeatNO;
                    reopenMemo.Add();
                }
                else
                {
                    ProjectId            = projectInfo.ProjectId;
                    projectInfo.IsPushed = pushOrNot;
                    projectInfo.Update();
                    var store = StoreBasicInfo.GetStorInfo(USCode);

                    var reimageInfo = ReimageInfo.FirstOrDefault(i => i.ProjectId == ProjectId);
                    if (reimageInfo != null)
                    {
                        reimageInfo.GBDate     = GBDate;
                        reimageInfo.ReopenDate = ReopenDate;
                        reimageInfo.Update();
                    }
                    else
                    {
                        reimageInfo                    = new ReimageInfo();
                        reimageInfo.Id                 = Guid.NewGuid();
                        reimageInfo.ProjectId          = ProjectId;
                        reimageInfo.USCode             = USCode;
                        reimageInfo.CreateDate         = DateTime.Now;
                        reimageInfo.CreateUserAccount  = ClientCookie.UserCode;
                        reimageInfo.CreateUserNameENUS = ClientCookie.UserNameENUS;
                        reimageInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN;
                        reimageInfo.AssetRepAccount    = "";
                        reimageInfo.AssetRepNameZHCN   = "";
                        reimageInfo.AssetRepNameENUS   = "";
                        reimageInfo.AssetActorAccount  = "";
                        reimageInfo.AssetActorNameZHCN = "";
                        reimageInfo.AssetActorNameENUS = "";
                        reimageInfo.FinanceAccount     = "";
                        reimageInfo.FinanceNameZHCN    = "";
                        reimageInfo.FinanceNameENUS    = "";
                        reimageInfo.PMAccount          = "";
                        reimageInfo.PMNameZHCN         = "";
                        reimageInfo.PMNameENUS         = "";
                        reimageInfo.LegalAccount       = "";
                        reimageInfo.LegalNameZHCN      = "";
                        reimageInfo.LegalNameENUS      = "";
                        reimageInfo.StoreNameENUS      = store.NameENUS;
                        reimageInfo.StoreNameZHCN      = store.NameZHCN;
                        reimageInfo.GBDate             = GBDate;
                        reimageInfo.ReopenDate         = ReopenDate;
                        reimageInfo.Add();
                    }

                    var reimageConsInfo = ReimageConsInfo.FirstOrDefault(i => i.ProjectId == ProjectId && i.IsHistory == false);
                    if (reimageConsInfo != null)
                    {
                        var reinvestmentBasicInfo = ReinvestmentBasicInfo.FirstOrDefault(i => i.ConsInfoID == reimageConsInfo.Id);
                        if (reinvestmentBasicInfo != null)
                        {
                            reinvestmentBasicInfo.RightSizingSeatNo = RightSizingSeatNO;
                            reinvestmentBasicInfo.NewDesignType     = AfterReimageDesignType;
                            reinvestmentBasicInfo.Update();
                        }
                        else
                        {
                            reinvestmentBasicInfo                   = new ReinvestmentBasicInfo();
                            reinvestmentBasicInfo.ConsInfoID        = reimageConsInfo.Id;
                            reinvestmentBasicInfo.RightSizingSeatNo = RightSizingSeatNO;
                            reinvestmentBasicInfo.NewDesignType     = AfterReimageDesignType;
                            reinvestmentBasicInfo.Add();
                        }
                    }
                    else
                    {
                        reimageConsInfo                   = new ReimageConsInfo();
                        reimageConsInfo.Id                = Guid.NewGuid();
                        reimageConsInfo.ProjectId         = ProjectId;
                        reimageConsInfo.IsHistory         = false;
                        reimageConsInfo.CreateTime        = DateTime.Now;
                        reimageConsInfo.CreateUserAccount = ClientCookie.UserCode;
                        reimageConsInfo.Add();

                        var reinvestmentBasicInfo = new ReinvestmentBasicInfo();
                        reinvestmentBasicInfo.ConsInfoID        = reimageConsInfo.Id;
                        reinvestmentBasicInfo.RightSizingSeatNo = RightSizingSeatNO;
                        reinvestmentBasicInfo.NewDesignType     = AfterReimageDesignType;
                        reinvestmentBasicInfo.Add();
                    }

                    var reimageConsInvtChecking = ReimageConsInvtChecking.FirstOrDefault(i => i.ProjectId == ProjectId && i.IsHistory == false);
                    if (reimageConsInvtChecking != null)
                    {
                        var writeOffAmount = WriteOffAmount.FirstOrDefault(i => i.ConsInfoID == reimageConsInvtChecking.Id);
                        if (writeOffAmount != null)
                        {
                            writeOffAmount.TotalWriteOff = Reimage_Total_WO_Proj;
                            writeOffAmount.TotalActual   = Reimage_Total_WO_Act;
                            writeOffAmount.Update();
                        }
                        else
                        {
                            writeOffAmount               = new WriteOffAmount();
                            writeOffAmount.Id            = Guid.NewGuid();
                            writeOffAmount.ConsInfoID    = reimageConsInvtChecking.Id;
                            writeOffAmount.TotalWriteOff = Reimage_Total_WO_Proj;
                            writeOffAmount.TotalActual   = Reimage_Total_WO_Act;
                            writeOffAmount.Add();
                        }

                        var reinvestmentCost = ReinvestmentCost.FirstOrDefault(i => i.ConsInfoID == reimageConsInvtChecking.Id);
                        if (reinvestmentCost != null)
                        {
                            reinvestmentCost.TotalReinvestmentBudget = Reimage_Total_Reinvestment_Proj;
                            reinvestmentCost.TotalReinvestmentPMAct  = Reimage_Total_Reinvestment_Act;
                            reinvestmentCost.Update();
                        }
                        else
                        {
                            reinvestmentCost            = new ReinvestmentCost();
                            reinvestmentCost.Id         = Guid.NewGuid();
                            reinvestmentCost.ConsInfoID = reimageConsInvtChecking.Id;
                            reinvestmentCost.TotalReinvestmentBudget = Reimage_Total_Reinvestment_Proj;
                            reinvestmentCost.TotalReinvestmentPMAct  = Reimage_Total_Reinvestment_Act;
                            reinvestmentCost.Add();
                        }
                    }
                    else
                    {
                        reimageConsInvtChecking                   = new ReimageConsInvtChecking();
                        reimageConsInvtChecking.Id                = Guid.NewGuid();
                        reimageConsInvtChecking.ProjectId         = ProjectId;
                        reimageConsInvtChecking.IsHistory         = false;
                        reimageConsInvtChecking.CreateTime        = DateTime.Now;
                        reimageConsInvtChecking.CreateUserAccount = ClientCookie.UserCode;
                        reimageConsInvtChecking.Add();

                        var writeOffAmount = new WriteOffAmount();
                        writeOffAmount.Id            = Guid.NewGuid();
                        writeOffAmount.ConsInfoID    = reimageConsInvtChecking.Id;
                        writeOffAmount.TotalWriteOff = Reimage_Total_WO_Proj;
                        writeOffAmount.TotalActual   = Reimage_Total_WO_Act;
                        writeOffAmount.Add();

                        var reinvestmentCost = new ReinvestmentCost();
                        reinvestmentCost.Id         = Guid.NewGuid();
                        reinvestmentCost.ConsInfoID = reimageConsInvtChecking.Id;
                        reinvestmentCost.TotalReinvestmentBudget = Reimage_Total_Reinvestment_Proj;
                        reinvestmentCost.TotalReinvestmentPMAct  = Reimage_Total_Reinvestment_Act;
                        reinvestmentCost.Add();
                    }

                    var reopenMemo = ReopenMemo.FirstOrDefault(i => i.ProjectId == ProjectId);
                    if (reopenMemo != null)
                    {
                        reopenMemo.AftARSN = AfterReimageSeatNO;
                        reopenMemo.Update();
                    }
                    else
                    {
                        reopenMemo           = new ReopenMemo();
                        reopenMemo.Id        = Guid.NewGuid();
                        reopenMemo.ProjectId = ProjectId;
                        reopenMemo.NewMcCafe = false;
                        reopenMemo.NewKiosk  = false;
                        reopenMemo.NewMDS    = false;
                        reopenMemo.Is24H     = false;
                        reopenMemo.AftARSN   = AfterReimageSeatNO;
                        reopenMemo.Add();
                    }
                }
                tranScope.Complete();
            }
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
0
        public override string Edit()
        {
            //取消未处理完成的任务(主要是Package最后一个环节办理完后,不走K2流程生成的1条回到Actor的任务)
            var oldTask = TaskWork.Search(i => i.SourceCode == FlowCode.Closure && i.TypeCode == FlowCode.Closure_ClosurePackage && i.RefID == this.ProjectId && i.Status == TaskWorkStatus.UnFinish).ToArray();

            foreach (var taskItem in oldTask)
            {
                taskItem.Status = TaskWorkStatus.Cancel;
            }
            TaskWork.Update(oldTask);

            //var taskWork = TaskWork.FirstOrDefault(e => e.ReceiverAccount == ClientCookie.UserCode
            //            && e.SourceCode == FlowCode.Closure
            //            && e.TypeCode == FlowCode.Closure_ClosurePackage && e.RefID == this.ProjectId);


            //taskWork.Status = TaskWorkStatus.UnFinish;
            //taskWork.StatusNameZHCN = "任务";
            //taskWork.StatusNameENUS = "任务";

            //var closureEntity = ClosureInfo.GetByProjectId(this.ProjectId);
            //taskWork.ReceiverAccount = closureEntity.AssetActorAccount;
            //taskWork.ReceiverNameENUS = closureEntity.AssetActorNameENUS;
            //taskWork.ReceiverNameZHCN = closureEntity.AssetActorNameZHCN;
            //taskWork.Id = Guid.NewGuid();
            //taskWork.CreateTime = DateTime.Now;
            //taskWork.Url = TaskWork.BuildUrl(FlowCode.Closure_ClosurePackage, this.ProjectId, "");
            //taskWork.ActivityName = NodeCode.Start;
            //taskWork.ActionName = SetTaskActionName(ProjectId);
            //taskWork.ProcInstID = null;
            //taskWork.FinishTime = null;
            //TaskWork.Add(taskWork);
            var url = GeneratePackageTask(ProjectId);

            this.IsHistory = true;

            this.Save();

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

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

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

            projectEntity.Status = ProjectStatus.UnFinish;

            ProjectInfo.Update(projectEntity);
            ProjectInfo.Reset(ProjectId, FlowCode.Closure_ClosurePackage);
            ProjectInfo.Reset(ProjectId, FlowCode.Closure);
            var attList = Attachment.Search(e => e.RefTableID == this.Id.ToString() &&
                                            e.RefTableName == ClosurePackage.TableName).AsNoTracking().ToList();

            var newList = new List <Attachment>();

            foreach (var att in attList)
            {
                var newAtt = objectCopy.AutoCopy(att);
                newAtt.RefTableID = newEntity.Id.ToString();
                newAtt.ID         = Guid.NewGuid();
                newList.Add(newAtt);
            }
            Attachment.Add(newList.ToArray());
            return(url);
        }
Ejemplo n.º 14
0
        public void Save(bool pushOrNot)
        {
            using (TransactionScope tranScope = new TransactionScope())
            {
                var projectInfo = ProjectInfo.Get(Id);
                if (projectInfo == null)
                {
                    ProjectId = ProjectInfo.CreateDLProject(Id, FlowCode.Closure, USCode, NodeCode.Start, ClientCookie.UserCode, pushOrNot);

                    var closureInfo = new ClosureInfo();
                    closureInfo.Id                  = Guid.NewGuid();
                    closureInfo.ProjectId           = ProjectId;
                    closureInfo.USCode              = USCode;
                    closureInfo.ActualCloseDate     = CloseDate;
                    closureInfo.ClosureTypeCode     = ClosureTypeCode;
                    closureInfo.ClosureReasonCode   = ClosureReasonCode;
                    closureInfo.ClosureReasonRemark = ClosureReasonRemark;
                    closureInfo.RelocationCode      = RelocationCode;
                    closureInfo.CreateDate          = DateTime.Now;
                    closureInfo.CreateUserAccount   = ClientCookie.UserCode;
                    closureInfo.CreateUserNameENUS  = ClientCookie.UserNameENUS;
                    closureInfo.CreateUserNameZHCN  = ClientCookie.UserNameZHCN;
                    closureInfo.Add();

                    var closurePackage = new ClosurePackage();
                    closurePackage.Id                   = Guid.NewGuid();
                    closurePackage.ProjectId            = ProjectId;
                    closurePackage.RelocationPipelineID = RelocatedPipelineID;
                    closurePackage.IsHistory            = false;
                    closurePackage.CreateUserAccount    = ClientCookie.UserCode;
                    closurePackage.CreateTime           = DateTime.Now;
                    closurePackage.Add();

                    var closureConsInvtChecking = new ClosureConsInvtChecking();
                    closureConsInvtChecking.Id                = Guid.NewGuid();
                    closureConsInvtChecking.ProjectId         = ProjectId;
                    closureConsInvtChecking.IsHistory         = false;
                    closureConsInvtChecking.CreateTime        = DateTime.Now;
                    closureConsInvtChecking.TotalActual       = Closure_WO_Total_Act;
                    closureConsInvtChecking.ClosingCostActual = Closure_ClosingCost_Act;
                    closureConsInvtChecking.Add();

                    var closureMemo = new ClosureMemo();
                    closureMemo.Id            = Guid.NewGuid();
                    closureMemo.ProjectId     = ProjectId;
                    closureMemo.CreateTime    = DateTime.Now;
                    closureMemo.ClosureNature = ClosureNatureType.Permanent;
                    closureMemo.Status        = true;
                    closureMemo.Compensation  = Closure_Compensation_Act;
                    closureMemo.Add();
                }
                else
                {
                    ProjectId            = projectInfo.ProjectId;
                    projectInfo.IsPushed = pushOrNot;
                    projectInfo.Update();

                    var closureInfo = ClosureInfo.FirstOrDefault(i => i.ProjectId == ProjectId);
                    if (closureInfo != null)
                    {
                        closureInfo.ActualCloseDate     = CloseDate;
                        closureInfo.ClosureTypeCode     = ClosureTypeCode;
                        closureInfo.ClosureReasonCode   = ClosureReasonCode;
                        closureInfo.ClosureReasonRemark = ClosureReasonRemark;
                        closureInfo.RelocationCode      = RelocationCode;
                        closureInfo.Update();
                    }
                    else
                    {
                        closureInfo                     = new ClosureInfo();
                        closureInfo.Id                  = Guid.NewGuid();
                        closureInfo.ProjectId           = ProjectId;
                        closureInfo.USCode              = USCode;
                        closureInfo.ActualCloseDate     = CloseDate;
                        closureInfo.ClosureTypeCode     = ClosureTypeCode;
                        closureInfo.ClosureReasonCode   = ClosureReasonCode;
                        closureInfo.ClosureReasonRemark = ClosureReasonRemark;
                        closureInfo.RelocationCode      = RelocationCode;
                        closureInfo.CreateDate          = DateTime.Now;
                        closureInfo.CreateUserAccount   = ClientCookie.UserCode;
                        closureInfo.CreateUserNameENUS  = ClientCookie.UserNameENUS;
                        closureInfo.CreateUserNameZHCN  = ClientCookie.UserNameZHCN;
                        closureInfo.Add();
                    }

                    var closurePackage = ClosurePackage.Get(ProjectId);
                    if (closurePackage != null)
                    {
                        closurePackage.RelocationPipelineID = RelocatedPipelineID;
                        closurePackage.Update();
                    }
                    else
                    {
                        closurePackage                      = new ClosurePackage();
                        closurePackage.Id                   = Guid.NewGuid();
                        closurePackage.ProjectId            = ProjectId;
                        closurePackage.RelocationPipelineID = RelocatedPipelineID;
                        closurePackage.IsHistory            = false;
                        closurePackage.CreateUserAccount    = ClientCookie.UserCode;
                        closurePackage.CreateTime           = DateTime.Now;
                        closurePackage.Add();
                    }

                    var closureConsInvtChecking = ClosureConsInvtChecking.Get(ProjectId);
                    if (closureConsInvtChecking != null)
                    {
                        closureConsInvtChecking.TotalActual       = Closure_WO_Total_Act;
                        closureConsInvtChecking.ClosingCostActual = Closure_ClosingCost_Act;
                        closureConsInvtChecking.Update();
                    }
                    else
                    {
                        closureConsInvtChecking                   = new ClosureConsInvtChecking();
                        closureConsInvtChecking.Id                = Guid.NewGuid();
                        closureConsInvtChecking.ProjectId         = ProjectId;
                        closureConsInvtChecking.IsHistory         = false;
                        closureConsInvtChecking.CreateTime        = DateTime.Now;
                        closureConsInvtChecking.TotalActual       = Closure_WO_Total_Act;
                        closureConsInvtChecking.ClosingCostActual = Closure_ClosingCost_Act;
                        closureConsInvtChecking.Add();
                    }

                    var closureMemo = ClosureMemo.FirstOrDefault(i => i.ProjectId == ProjectId);
                    if (closureMemo != null)
                    {
                        closureMemo.Compensation = Closure_Compensation_Act;
                        closureMemo.Update();
                    }
                    else
                    {
                        closureMemo               = new ClosureMemo();
                        closureMemo.Id            = Guid.NewGuid();
                        closureMemo.ProjectId     = ProjectId;
                        closureMemo.CreateTime    = DateTime.Now;
                        closureMemo.ClosureNature = ClosureNatureType.Permanent;
                        closureMemo.Status        = true;
                        closureMemo.Compensation  = Closure_Compensation_Act;
                        closureMemo.Add();
                    }
                }
                tranScope.Complete();
            }
        }
Ejemplo n.º 15
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);
        }
Ejemplo n.º 16
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);
        }
Ejemplo n.º 17
0
        public void Save(bool pushOrNot)
        {
            using (TransactionScope tranScope = new TransactionScope())
            {
                var projectInfo = ProjectInfo.Get(Id);
                if (projectInfo == null)
                {
                    ProjectId = ProjectInfo.CreateDLProject(Id, FlowCode.Rebuild, USCode, NodeCode.Start, ClientCookie.UserCode, pushOrNot);

                    var rebuildInfo = new RebuildInfo();
                    rebuildInfo.Id                 = Guid.NewGuid();
                    rebuildInfo.ProjectId          = ProjectId;
                    rebuildInfo.USCode             = USCode;
                    rebuildInfo.CreateTime         = DateTime.Now;
                    rebuildInfo.CreateUserAccount  = ClientCookie.UserCode;
                    rebuildInfo.CreateUserNameENUS = ClientCookie.UserNameENUS;
                    rebuildInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN;
                    rebuildInfo.GBDate             = GBDate;
                    rebuildInfo.ReopenDate         = ReopenDate;
                    rebuildInfo.Add();

                    var rebuildPackage = new RebuildPackage();
                    rebuildPackage.Id                    = Guid.NewGuid();
                    rebuildPackage.ProjectId             = ProjectId;
                    rebuildPackage.IsHistory             = false;
                    rebuildPackage.ChangeLandlordType    = ChangeLandlordType;
                    rebuildPackage.NewLandlord           = ChangeLandLordDESC;
                    rebuildPackage.ChangeRentalType      = ChangeRentalType;
                    rebuildPackage.ChangeRentalTypeDESC  = ChangeRentalTypeDESC;
                    rebuildPackage.ChangeLeaseTermType   = ChangeLeaseTermType;
                    rebuildPackage.ChangeLeaseTermDESC   = ChangeLeaseTermDESC;
                    rebuildPackage.ChangeRedLineType     = ChangeRedLineType;
                    rebuildPackage.ChangeRedLineTypeDESC = ChangeRedLineTypeDESC;
                    //rebuildPackage.NewRentalStructure = NewRentalStructure;
                    rebuildPackage.Add();

                    var projectContractInfo = new ProjectContractInfo();
                    projectContractInfo.Id                           = Guid.NewGuid();
                    projectContractInfo.ProjectId                    = ProjectId;
                    projectContractInfo.ContractInfoId               = Guid.Empty;
                    projectContractInfo.CreatedTime                  = DateTime.Now;
                    projectContractInfo.WriteBack                    = false;
                    projectContractInfo.EditMode                     = EditMode;
                    projectContractInfo.PartyAFullName               = PartyAFullName;
                    projectContractInfo.McDLegalEntity               = ContractEntityName;
                    projectContractInfo.McDOwnership                 = McdOwnership;
                    projectContractInfo.ContactPerson                = ContactPerson;
                    projectContractInfo.ContactMode                  = ContactMode;
                    projectContractInfo.RentType                     = RentType;
                    projectContractInfo.TotalLeasedArea              = RentSize;
                    projectContractInfo.LeasePurchaseTerm            = ContractTerm;
                    projectContractInfo.LeasePurchase                = ContractType;
                    projectContractInfo.StartDate                    = ContractStartDate;
                    projectContractInfo.EndDate                      = ContraceEndDate;
                    projectContractInfo.StartYear                    = ContractStartYear;
                    projectContractInfo.EndYear                      = ContraceEndYear;
                    projectContractInfo.RentCommencementDate         = RentPaymentStartDate;
                    projectContractInfo.DeadlineToNotice             = DeadlineToNoticeLL;
                    projectContractInfo.Changedafter2010             = ChangedAfter2010;
                    projectContractInfo.RentStructure                = RentStructure;
                    projectContractInfo.WithEarlyTerminationClause   = EarlyTerminationClause;
                    projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription;
                    projectContractInfo.RentPaymentArrangement       = RentPaymentArrangement;
                    projectContractInfo.HasDeposit                   = Deposit;
                    projectContractInfo.DepositAmount                = DepositAmount;
                    projectContractInfo.RefundableDate               = WhenRefund;
                    projectContractInfo.WithPenaltyClause            = withPenaltyClause;
                    projectContractInfo.HasBankGuarantee             = BankGuarantee;
                    projectContractInfo.BGNumber                     = BankGuaranteeNumber;
                    projectContractInfo.BGAmount                     = BankGuaranteeAmount;
                    projectContractInfo.BGCommencementDate           = BGCommencementDate;
                    projectContractInfo.BGEndDate                    = BGEndDate;
                    projectContractInfo.Add();

                    var rebuildConsInfo = new RebuildConsInfo();
                    rebuildConsInfo.Id                = Guid.NewGuid();
                    rebuildConsInfo.ProjectId         = ProjectId;
                    rebuildConsInfo.IsHistory         = false;
                    rebuildConsInfo.CreateTime        = DateTime.Now;
                    rebuildConsInfo.CreateUserAccount = ClientCookie.UserCode;
                    rebuildConsInfo.Add();

                    var reinvestmentBasicInfo = new ReinvestmentBasicInfo();
                    reinvestmentBasicInfo.ConsInfoID        = rebuildConsInfo.Id;
                    reinvestmentBasicInfo.EstimatedSeatNo   = OriginalSeatNO;
                    reinvestmentBasicInfo.RightSizingSeatNo = AfterRebuildSeatNO;
                    reinvestmentBasicInfo.NewDesignType     = AfterRebuildDesignType;
                    reinvestmentBasicInfo.NewOperationSize  = AfterRebuildOperationArea;
                    reinvestmentBasicInfo.Add();

                    var rebuildConsInvtChecking = new RebuildConsInvtChecking();
                    rebuildConsInvtChecking.Id        = Guid.NewGuid();
                    rebuildConsInvtChecking.ProjectId = ProjectId;
                    rebuildConsInvtChecking.IsHistory = false;
                    rebuildConsInvtChecking.Add();

                    var writeOffAmount = new WriteOffAmount();
                    writeOffAmount.Id          = Guid.NewGuid();
                    writeOffAmount.ConsInfoID  = rebuildConsInvtChecking.Id;
                    writeOffAmount.TotalActual = Rebuild_TotalWO_Act;
                    writeOffAmount.Add();

                    var reinvestmentCost = new ReinvestmentCost();
                    reinvestmentCost.Id                     = Guid.NewGuid();
                    reinvestmentCost.ConsInfoID             = rebuildConsInvtChecking.Id;
                    reinvestmentCost.TotalReinvestmentFAAct = Rebuild_TotalReinvestment_Act;
                    reinvestmentCost.Add();
                }
                else
                {
                    ProjectId            = projectInfo.ProjectId;
                    projectInfo.IsPushed = pushOrNot;
                    projectInfo.Update();

                    var rebuildInfo = RebuildInfo.FirstOrDefault(i => i.ProjectId == ProjectId);
                    if (rebuildInfo != null)
                    {
                        rebuildInfo.GBDate     = GBDate;
                        rebuildInfo.ReopenDate = ReopenDate;
                        rebuildInfo.Update();
                    }
                    else
                    {
                        rebuildInfo                    = new RebuildInfo();
                        rebuildInfo.Id                 = Guid.NewGuid();
                        rebuildInfo.ProjectId          = ProjectId;
                        rebuildInfo.USCode             = USCode;
                        rebuildInfo.CreateTime         = DateTime.Now;
                        rebuildInfo.CreateUserAccount  = ClientCookie.UserCode;
                        rebuildInfo.CreateUserNameENUS = ClientCookie.UserNameENUS;
                        rebuildInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN;
                        rebuildInfo.GBDate             = GBDate;
                        rebuildInfo.ReopenDate         = ReopenDate;
                        rebuildInfo.Add();
                    }

                    var rebuildPackage = RebuildPackage.FirstOrDefault(i => i.ProjectId == ProjectId && !i.IsHistory);
                    if (rebuildPackage != null)
                    {
                        rebuildPackage.ChangeLandlordType    = ChangeLandlordType;
                        rebuildPackage.NewLandlord           = ChangeLandLordDESC;
                        rebuildPackage.ChangeRentalType      = ChangeRentalType;
                        rebuildPackage.ChangeRentalTypeDESC  = ChangeRentalTypeDESC;
                        rebuildPackage.ChangeLeaseTermType   = ChangeLeaseTermType;
                        rebuildPackage.ChangeLeaseTermDESC   = ChangeLeaseTermDESC;
                        rebuildPackage.ChangeRedLineType     = ChangeRedLineType;
                        rebuildPackage.ChangeRedLineTypeDESC = ChangeRedLineTypeDESC;
                        //rebuildPackage.NewRentalStructure = NewRentalStructure;
                        rebuildPackage.Update();
                    }
                    else
                    {
                        rebuildPackage                       = new RebuildPackage();
                        rebuildPackage.Id                    = Guid.NewGuid();
                        rebuildPackage.ProjectId             = ProjectId;
                        rebuildPackage.IsHistory             = false;
                        rebuildPackage.ChangeLandlordType    = ChangeLandlordType;
                        rebuildPackage.NewLandlord           = ChangeLandLordDESC;
                        rebuildPackage.ChangeRentalType      = ChangeRentalType;
                        rebuildPackage.ChangeRentalTypeDESC  = ChangeRentalTypeDESC;
                        rebuildPackage.ChangeLeaseTermType   = ChangeLeaseTermType;
                        rebuildPackage.ChangeLeaseTermDESC   = ChangeLeaseTermDESC;
                        rebuildPackage.ChangeRedLineType     = ChangeRedLineType;
                        rebuildPackage.ChangeRedLineTypeDESC = ChangeRedLineTypeDESC;
                        //rebuildPackage.NewRentalStructure = NewRentalStructure;
                        rebuildPackage.Add();
                    }

                    var projectContractInfo = ProjectContractInfo.FirstOrDefault(i => i.ProjectId == ProjectId);
                    if (projectContractInfo != null)
                    {
                        projectContractInfo.EditMode                     = EditMode;
                        projectContractInfo.PartyAFullName               = PartyAFullName;
                        projectContractInfo.McDLegalEntity               = ContractEntityName;
                        projectContractInfo.McDOwnership                 = McdOwnership;
                        projectContractInfo.ContactPerson                = ContactPerson;
                        projectContractInfo.ContactMode                  = ContactMode;
                        projectContractInfo.RentType                     = RentType;
                        projectContractInfo.TotalLeasedArea              = RentSize;
                        projectContractInfo.LeasePurchaseTerm            = ContractTerm;
                        projectContractInfo.LeasePurchase                = ContractType;
                        projectContractInfo.StartDate                    = ContractStartDate;
                        projectContractInfo.EndDate                      = ContraceEndDate;
                        projectContractInfo.StartYear                    = ContractStartYear;
                        projectContractInfo.EndYear                      = ContraceEndYear;
                        projectContractInfo.RentCommencementDate         = RentPaymentStartDate;
                        projectContractInfo.DeadlineToNotice             = DeadlineToNoticeLL;
                        projectContractInfo.Changedafter2010             = ChangedAfter2010;
                        projectContractInfo.RentStructure                = RentStructure;
                        projectContractInfo.WithEarlyTerminationClause   = EarlyTerminationClause;
                        projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription;
                        projectContractInfo.RentPaymentArrangement       = RentPaymentArrangement;
                        projectContractInfo.HasDeposit                   = Deposit;
                        projectContractInfo.DepositAmount                = DepositAmount;
                        projectContractInfo.RefundableDate               = WhenRefund;
                        projectContractInfo.WithPenaltyClause            = withPenaltyClause;
                        projectContractInfo.HasBankGuarantee             = BankGuarantee;
                        projectContractInfo.BGNumber                     = BankGuaranteeNumber;
                        projectContractInfo.BGAmount                     = BankGuaranteeAmount;
                        projectContractInfo.BGCommencementDate           = BGCommencementDate;
                        projectContractInfo.BGEndDate                    = BGEndDate;
                        projectContractInfo.Update();
                    }
                    else
                    {
                        projectContractInfo                              = new ProjectContractInfo();
                        projectContractInfo.Id                           = Guid.NewGuid();
                        projectContractInfo.ProjectId                    = ProjectId;
                        projectContractInfo.ContractInfoId               = Guid.Empty;
                        projectContractInfo.CreatedTime                  = DateTime.Now;
                        projectContractInfo.WriteBack                    = false;
                        projectContractInfo.EditMode                     = EditMode;
                        projectContractInfo.PartyAFullName               = PartyAFullName;
                        projectContractInfo.McDLegalEntity               = ContractEntityName;
                        projectContractInfo.McDOwnership                 = McdOwnership;
                        projectContractInfo.ContactPerson                = ContactPerson;
                        projectContractInfo.ContactMode                  = ContactMode;
                        projectContractInfo.RentType                     = RentType;
                        projectContractInfo.TotalLeasedArea              = RentSize;
                        projectContractInfo.LeasePurchaseTerm            = ContractTerm;
                        projectContractInfo.LeasePurchase                = ContractType;
                        projectContractInfo.StartDate                    = ContractStartDate;
                        projectContractInfo.EndDate                      = ContraceEndDate;
                        projectContractInfo.StartYear                    = ContractStartYear;
                        projectContractInfo.EndYear                      = ContraceEndYear;
                        projectContractInfo.RentCommencementDate         = RentPaymentStartDate;
                        projectContractInfo.DeadlineToNotice             = DeadlineToNoticeLL;
                        projectContractInfo.Changedafter2010             = ChangedAfter2010;
                        projectContractInfo.RentStructure                = RentStructure;
                        projectContractInfo.WithEarlyTerminationClause   = EarlyTerminationClause;
                        projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription;
                        projectContractInfo.RentPaymentArrangement       = RentPaymentArrangement;
                        projectContractInfo.HasDeposit                   = Deposit;
                        projectContractInfo.DepositAmount                = DepositAmount;
                        projectContractInfo.RefundableDate               = WhenRefund;
                        projectContractInfo.WithPenaltyClause            = withPenaltyClause;
                        projectContractInfo.HasBankGuarantee             = BankGuarantee;
                        projectContractInfo.BGNumber                     = BankGuaranteeNumber;
                        projectContractInfo.BGAmount                     = BankGuaranteeAmount;
                        projectContractInfo.BGCommencementDate           = BGCommencementDate;
                        projectContractInfo.BGEndDate                    = BGEndDate;
                        projectContractInfo.Add();
                    }

                    var rebuildConsInfo = RebuildConsInfo.FirstOrDefault(i => i.ProjectId == ProjectId && !i.IsHistory);
                    if (rebuildConsInfo == null)
                    {
                        rebuildConsInfo                   = new RebuildConsInfo();
                        rebuildConsInfo.Id                = Guid.NewGuid();
                        rebuildConsInfo.ProjectId         = ProjectId;
                        rebuildConsInfo.IsHistory         = false;
                        rebuildConsInfo.CreateTime        = DateTime.Now;
                        rebuildConsInfo.CreateUserAccount = ClientCookie.UserCode;
                        rebuildConsInfo.Add();
                    }

                    var reinvestmentBasicInfo = ReinvestmentBasicInfo.FirstOrDefault(i => i.ConsInfoID == rebuildConsInfo.Id);
                    if (reinvestmentBasicInfo != null)
                    {
                        reinvestmentBasicInfo.EstimatedSeatNo   = OriginalSeatNO;
                        reinvestmentBasicInfo.RightSizingSeatNo = AfterRebuildSeatNO;
                        reinvestmentBasicInfo.NewDesignType     = AfterRebuildDesignType;
                        reinvestmentBasicInfo.NewOperationSize  = AfterRebuildOperationArea;
                        reinvestmentBasicInfo.Update();
                    }
                    else
                    {
                        reinvestmentBasicInfo                   = new ReinvestmentBasicInfo();
                        reinvestmentBasicInfo.ConsInfoID        = rebuildConsInfo.Id;
                        reinvestmentBasicInfo.EstimatedSeatNo   = OriginalSeatNO;
                        reinvestmentBasicInfo.RightSizingSeatNo = AfterRebuildSeatNO;
                        reinvestmentBasicInfo.NewDesignType     = AfterRebuildDesignType;
                        reinvestmentBasicInfo.NewOperationSize  = AfterRebuildOperationArea;
                        reinvestmentBasicInfo.Add();
                    }

                    var rebuildConsInvtChecking = RebuildConsInvtChecking.FirstOrDefault(i => i.ProjectId == ProjectId && !i.IsHistory);
                    if (rebuildConsInvtChecking == null)
                    {
                        rebuildConsInvtChecking           = new RebuildConsInvtChecking();
                        rebuildConsInvtChecking.Id        = Guid.NewGuid();
                        rebuildConsInvtChecking.ProjectId = ProjectId;
                        rebuildConsInvtChecking.IsHistory = false;
                        rebuildConsInvtChecking.Add();
                    }

                    var writeOffAmount = WriteOffAmount.FirstOrDefault(i => i.ConsInfoID == rebuildConsInvtChecking.Id);
                    if (writeOffAmount != null)
                    {
                        writeOffAmount.TotalActual = Rebuild_TotalWO_Act;
                        writeOffAmount.Update();
                    }
                    else
                    {
                        writeOffAmount             = new WriteOffAmount();
                        writeOffAmount.Id          = Guid.NewGuid();
                        writeOffAmount.ConsInfoID  = rebuildConsInvtChecking.Id;
                        writeOffAmount.TotalActual = Rebuild_TotalWO_Act;
                        writeOffAmount.Add();
                    }

                    var reinvestmentCost = ReinvestmentCost.FirstOrDefault(i => i.ConsInfoID == rebuildConsInvtChecking.Id);
                    if (reinvestmentCost != null)
                    {
                        reinvestmentCost.TotalReinvestmentFAAct = Rebuild_TotalReinvestment_Act;
                        reinvestmentCost.Update();
                    }
                    else
                    {
                        reinvestmentCost                        = new ReinvestmentCost();
                        reinvestmentCost.Id                     = Guid.NewGuid();
                        reinvestmentCost.ConsInfoID             = rebuildConsInvtChecking.Id;
                        reinvestmentCost.TotalReinvestmentFAAct = Rebuild_TotalReinvestment_Act;
                        reinvestmentCost.Add();
                    }
                }
                tranScope.Complete();
            }
        }