Esempio n. 1
0
        public static ConsInfoDTO <RenewalInfo, RenewalConsInfo> InitPage(string projectId, string id = "")
        {
            RenewalInfo info     = RenewalInfo.Get(projectId);
            var         consInfo = RenewalConsInfo.Get(projectId, id);

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

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

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

            dto.Entity         = consInfo;
            dto.Info           = info;
            dto.ReinBasicInfo  = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id);
            dto.ReinCost       = ReinvestmentCost.GetByConsInfoId(consInfo.Id);
            dto.WriteOff       = WriteOffAmount.GetByConsInfoId(consInfo.Id);
            dto.ProjectComment = projectComment != null ? projectComment.Content : "";
            dto.Editable       = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_ConsInfo);
            dto.Recallable     = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_ConsInfo);
            dto.Savable        = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_ConsInfo) && string.IsNullOrEmpty(id);
            return(dto);
        }
Esempio n. 2
0
        public MajorLeaseConsInfo GetConsInfo(string strProjectId, string entityId = "")
        {
            MajorLeaseConsInfo entity = null;
            var majorLeaseInfo        = MajorLeaseInfo.Search(e => e.ProjectId == strProjectId).FirstOrDefault();

            if (string.IsNullOrEmpty(entityId))
            {
                entity = Search(e => e.ProjectId.Equals(strProjectId) && !e.IsHistory).FirstOrDefault();
            }
            else
            {
                entity = Search(e => e.Id.ToString().Equals(entityId)).FirstOrDefault();
            }

            if (entity != null)
            {
                entity.IsProjectFreezed = CheckIfFreezeProject(strProjectId);
                entity.ReinCost         = ReinvestmentCost.GetByConsInfoId(entity.Id);
                entity.ReinBasicInfo    = ReinvestmentBasicInfo.GetByConsInfoId(entity.Id);
                if (entity.ReinBasicInfo == null)
                {
                    entity.ReinBasicInfo = new ReinvestmentBasicInfo
                    {
                        GBDate     = majorLeaseInfo.GBDate,
                        ReopenDate = majorLeaseInfo.ReopenDate
                    };
                }
                entity.WriteOff = WriteOffAmount.GetByConsInfoId(entity.Id);

                entity.IsShowEdit   = ProjectInfo.IsFlowEditable(strProjectId, WorkflowCode);
                entity.IsShowRecall = ProjectInfo.IsFlowRecallable(strProjectId, WorkflowCode);
            }
            else
            {
                if (majorLeaseInfo != null)
                {
                    entity = new MajorLeaseConsInfo
                    {
                        ReinBasicInfo =
                            new ReinvestmentBasicInfo
                        {
                            GBDate     = majorLeaseInfo.GBDate,
                            ReopenDate = majorLeaseInfo.ReopenDate
                        },
                        IsProjectFreezed  = CheckIfFreezeProject(strProjectId),
                        ReinvenstmentType = 1
                    };
                }
            }
            entity.IsShowSave = ProjectInfo.IsFlowSavable(strProjectId, FlowCode.MajorLease_ConsInfo);
            PopulateAppUsers(entity);
            return(entity);
        }
Esempio n. 3
0
        private static string GetReimageInvestmentCost(string rimgProjectId)
        {
            string strRturn = "";
            var    consCk   = ReimageConsInvtChecking.GetWorkflowEntity(rimgProjectId, FlowCode.Reimage_ConsInvtChecking);

            if (consCk != null)
            {
                var revensCost = ReinvestmentCost.GetByConsInfoId(consCk.EntityId);
                if (revensCost != null && !string.IsNullOrEmpty(revensCost.TotalReinvestmentFAAct))
                {
                    strRturn = revensCost.TotalReinvestmentFAAct;
                }
            }
            return(strRturn);
        }
Esempio n. 4
0
        public static ReimageConsInfo GetConsInfo(string strProjectId, string entityId = "")
        {
            ReimageConsInfo entity = null;

            if (string.IsNullOrEmpty(entityId))
            {
                entity = Search(e => e.ProjectId.Equals(strProjectId) && !e.IsHistory).FirstOrDefault();
            }
            else
            {
                entity = Search(e => e.Id.ToString().Equals(entityId)).FirstOrDefault();
            }
            var reimageInfo = ReimageInfo.FirstOrDefault(e => e.ProjectId == strProjectId);

            if (entity != null)
            {
                entity.IsProjectFreezed = entity.CheckIfFreezeProject(strProjectId);
                entity.ReinCost         = ReinvestmentCost.GetByConsInfoId(entity.Id);
                entity.ReinBasicInfo    = ReinvestmentBasicInfo.GetByConsInfoId(entity.Id);
                if (entity.ReinBasicInfo != null)
                {
                    entity.ReinBasicInfo.GBDate     = reimageInfo.GBDate;
                    entity.ReinBasicInfo.ReopenDate = reimageInfo.ReopenDate;
                }
                else
                {
                    entity.ReinBasicInfo =
                        new ReinvestmentBasicInfo
                    {
                        GBDate     = reimageInfo.GBDate,
                        ReopenDate = reimageInfo.ReopenDate
                    };
                }
                entity.WriteOff = WriteOffAmount.GetByConsInfoId(entity.Id);
                var attachmentReinCost = Attachment.FirstOrDefault(e => e.RefTableID == entity.Id.ToString() && e.TypeCode == "ReinCost");
                if (attachmentReinCost != null && entity.ReinCost != null)
                {
                    entity.ReinCost.ReinCostUser = attachmentReinCost.CreatorNameENUS;
                    entity.ReinCost.ReinCostTime = attachmentReinCost.CreateTime;
                }
                var attachmentWriteOff = Attachment.FirstOrDefault(e => e.RefTableID == entity.Id.ToString() && e.TypeCode == "WriteOff");
                if (attachmentWriteOff != null)
                {
                    entity.WriteOff.WriteOffUser = attachmentWriteOff.CreatorNameENUS;
                    entity.WriteOff.WriteOffTime = attachmentWriteOff.CreateTime;
                }
                //entity.ProcInstID = entity.ProcInstId;
                entity.IsShowEdit   = ProjectInfo.IsFlowEditable(strProjectId, FlowCode.Reimage_ConsInfo);
                entity.IsShowRecall = ProjectInfo.IsFlowRecallable(strProjectId, FlowCode.Reimage_ConsInfo);
            }
            else
            {
                //var reimage = ReimageInfo.FirstOrDefault(e => e.ProjectId == strProjectId);
                //if (reimage != null)
                //{
                //    entity = new ReimageConsInfo
                //    {
                //        ReinBasicInfo =
                //            new ReinvestmentBasicInfo
                //            {
                //                GBDate = reimage.GBDate,
                //                ReopenDate = reimage.ReopenDate
                //            },
                //        IsProjectFreezed =entity.CheckIfFreezeProject(strProjectId),
                //        ReinvenstmentType = 1
                //    };
                //}
                entity.IsProjectFreezed = entity.CheckIfFreezeProject(strProjectId);
                entity.ReinBasicInfo    = ReinvestmentBasicInfo.GetByConsInfoId(entity.Id);
                if (entity.ReinBasicInfo != null)
                {
                    entity.ReinBasicInfo.GBDate     = reimageInfo.GBDate;
                    entity.ReinBasicInfo.ReopenDate = reimageInfo.ReopenDate;
                }
                else
                {
                    entity.ReinBasicInfo =
                        new ReinvestmentBasicInfo
                    {
                        GBDate     = reimageInfo.GBDate,
                        ReopenDate = reimageInfo.ReopenDate
                    };
                }
            }
            entity.IsShowSave = ProjectInfo.IsFlowSavable(strProjectId, FlowCode.Reimage_ConsInfo);
            entity.PopulateAppUsers();
            return(entity);
        }
Esempio n. 5
0
        public RebuildConsInfo GetConsInfo(string strProjectId, string entityId = "")
        {
            RebuildConsInfo entity = null;

            if (string.IsNullOrEmpty(entityId))
            {
                entity = Search(e => e.ProjectId.Equals(strProjectId) && !e.IsHistory).FirstOrDefault();
            }
            else
            {
                entity = Search(e => e.Id.ToString().Equals(entityId)).FirstOrDefault();
            }

            if (entity != null)
            {
                entity.IsProjectFreezed = CheckIfFreezeProject(strProjectId);
                entity.ReinCost         = ReinvestmentCost.GetByConsInfoId(entity.Id);
                entity.ReinBasicInfo    = ReinvestmentBasicInfo.GetByConsInfoId(entity.Id);
                var attachmentReinCost = Attachment.FirstOrDefault(e => e.RefTableID == entity.Id.ToString() && e.TypeCode == "ReinCost");
                if (entity.ReinCost != null && attachmentReinCost != null)
                {
                    entity.ReinCost.ReinCostUser = attachmentReinCost.CreatorNameENUS;
                    entity.ReinCost.ReinCostTime = attachmentReinCost.CreateTime;
                }

                if (entity.ReinBasicInfo == null)
                {
                    var rbdInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId == strProjectId);
                    if (rbdInfo != null)
                    {
                        entity.ReinBasicInfo = new ReinvestmentBasicInfo
                        {
                            GBDate             = rbdInfo.GBDate,
                            ReopenDate         = rbdInfo.ReopenDate,
                            ConsCompletionDate = rbdInfo.ConstCompletionDate
                        };
                    }
                }
                entity.WriteOff = WriteOffAmount.GetByConsInfoId(entity.Id);
                var attachmentWriteOff = Attachment.FirstOrDefault(e => e.RefTableID == entity.Id.ToString() && e.TypeCode == "WriteOff");
                if (entity.WriteOff != null && attachmentWriteOff != null)
                {
                    entity.WriteOff.WriteOffUser = attachmentWriteOff.CreatorNameENUS;
                    entity.WriteOff.WriteOffTime = attachmentWriteOff.CreateTime;
                }

                entity.IsShowEdit   = ProjectInfo.IsFlowEditable(strProjectId, FlowCode.Rebuild_ConsInfo);
                entity.IsShowRecall = ProjectInfo.IsFlowRecallable(strProjectId, FlowCode.Rebuild_ConsInfo);
                entity.IsShowSave   = ProjectInfo.IsFlowSavable(strProjectId, FlowCode.Rebuild_ConsInfo);
            }
            else
            {
                var rbdInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId == strProjectId);
                if (rbdInfo != null)
                {
                    entity = new RebuildConsInfo
                    {
                        ReinBasicInfo =
                            new ReinvestmentBasicInfo
                        {
                            GBDate     = rbdInfo.GBDate,
                            ReopenDate = rbdInfo.ReopenDate
                        },
                        IsProjectFreezed = CheckIfFreezeProject(strProjectId),
                        ProjectId        = strProjectId
                    };
                }
            }
            PopulateAppUsers(entity);
            return(entity);
        }
Esempio n. 6
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();
            }
        }
Esempio n. 7
0
        public override void Finish(TaskWorkStatus status, TaskWork task)
        {
            RenewalInfo info = RenewalInfo.Get(this.ProjectId);

            switch (status)
            {
            case TaskWorkStatus.K2ProcessApproved:
                //var toolUploadTask = TaskWork.FirstOrDefault(t => t.RefID == ProjectId
                //        && t.TypeCode == FlowCode.Renewal_Tool
                //        && t.ReceiverAccount == info.AssetActorAccount
                //        && t.ActivityName == "AssetActor"
                //        && t.Status == TaskWorkStatus.Cancel);
                //if (toolUploadTask != null)
                //{
                //    toolUploadTask.Status = TaskWorkStatus.UnFinish;
                //    toolUploadTask.Update();
                //}
                //else if (!ProjectInfo.IsFlowStarted(this.ProjectId, FlowCode.Renewal_Tool))
                //{
                //    info.GenerateSubmitTask(FlowCode.Renewal_Tool);
                //}
                var  tool = RenewalTool.Get(ProjectId);
                Guid entityId;
                var  toolProj = ProjectInfo.FirstOrDefault(e => e.Status == ProjectStatus.Finished && e.ProjectId == ProjectId && e.FlowCode == FlowCode.Renewal_Tool);
                if (toolProj != null)
                {
                    NoticeToActor(info.AssetActorAccount, info.USCode);
                    tool.Edit();
                    entityId = tool.NewEntityId;
                }
                else
                {
                    entityId = tool.Id;
                    ProjectInfo.Reset(this.ProjectId, FlowCode.Renewal_Tool);
                    info.GenerateSubmitTask(FlowCode.Renewal_Tool);
                }


                var entity = RenewalToolWriteOffAndReinCost.FirstOrDefault(w => w.ToolId == entityId);
                if (entity == null)
                {
                    entity        = new RenewalToolWriteOffAndReinCost();
                    entity.Id     = Guid.NewGuid();
                    entity.ToolId = tool.Id;
                    entity.Add();
                }
                var writeOffAmount = WriteOffAmount.GetByConsInfoId(this.Id);
                var reinCost       = ReinvestmentCost.GetByConsInfoId(this.Id);
                if (writeOffAmount != null)
                {
                    entity.REWriteOff   = DataConverter.ToDecimal(writeOffAmount.REWriteOff);
                    entity.LHIWriteOff  = DataConverter.ToDecimal(writeOffAmount.LHIWriteOff);
                    entity.ESSDWriteOff = DataConverter.ToDecimal(writeOffAmount.ESSDWriteOff);
                }
                else
                {
                    entity.REWriteOff   = 0;
                    entity.LHIWriteOff  = 0;
                    entity.ESSDWriteOff = 0;
                }
                if (reinCost != null)
                {
                    entity.RECost   = DataConverter.ToDecimal(reinCost.RECostNorm);
                    entity.LHICost  = DataConverter.ToDecimal(reinCost.LHINorm);
                    entity.ESSDCost = DataConverter.ToDecimal(reinCost.ESSDNorm);
                }
                else
                {
                    entity.RECost   = 0;
                    entity.LHICost  = 0;
                    entity.ESSDCost = 0;
                }
                Log4netHelper.WriteInfo(JsonConvert.SerializeObject(new { desc = "renewal tool info:", entityId, tool, writeOffAmount, reinCost, Id }));
                entity.Update();
                if (HasReinvenstment)
                {
                    ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_ConsInfo_Approval);
                }

                break;

            case TaskWorkStatus.K2ProcessDeclined:
                break;
            }
            task.Finish();
        }
Esempio n. 8
0
 public override string Edit()
 {
     using (var tranScope = new TransactionScope())
     {
         var info     = RenewalInfo.Get(this.ProjectId);
         var consInfo = Duplicator.AutoCopy(this);
         consInfo.Id                = Guid.NewGuid();
         consInfo.IsHistory         = false;
         consInfo.CreateUserAccount = ClientCookie.UserCode;
         consInfo.Add();
         IsHistory = true;
         this.Update();
         ProjectInfo.Reset(ProjectId, this.WorkflowCode);
         var attachments = Attachment.GetList(this.TableName, Id.ToString(), string.Empty);
         attachments.ForEach(att =>
         {
             att.RefTableID = consInfo.Id.ToString();
             att.ID         = Guid.NewGuid();
         });
         Attachment.Add(attachments.ToArray());
         var reinBasic = ReinvestmentBasicInfo.GetByConsInfoId(this.Id);
         if (reinBasic != null)
         {
             var newReinBasic = Duplicator.AutoCopy(reinBasic);
             newReinBasic.Id         = 0;
             newReinBasic.ConsInfoID = consInfo.Id;
             newReinBasic.Add();
         }
         var wf = WriteOffAmount.GetByConsInfoId(this.Id);
         if (wf != null)
         {
             var newWf = Duplicator.AutoCopy(wf);
             newWf.Id         = Guid.NewGuid();
             newWf.ConsInfoID = consInfo.Id;
             newWf.Add();
         }
         var reinCost = ReinvestmentCost.GetByConsInfoId(this.Id);
         if (reinCost != null)
         {
             var newReinCost = Duplicator.AutoCopy(reinCost);
             newReinCost.Id         = Guid.NewGuid();
             newReinCost.ConsInfoID = consInfo.Id;
             newReinCost.Add();
         }
         var oldTasks = TaskWork.Search(t => t.RefID == ProjectId &&
                                        t.Status == TaskWorkStatus.UnFinish &&
                                        new string[] { FlowCode.Renewal_ConsInfo, FlowCode.Renewal_Tool }.Contains(t.TypeCode)).ToList();
         oldTasks.ForEach(t =>
         {
             t.Status = TaskWorkStatus.Cancel;
         });
         TaskWork.Update(oldTasks.ToArray());
         var toolUploadTask = TaskWork.FirstOrDefault(t => t.RefID == ProjectId &&
                                                      t.TypeCode == FlowCode.Renewal_Tool &&
                                                      t.ReceiverAccount == info.AssetActorAccount &&
                                                      t.ActivityName == "AssetActor" &&
                                                      t.Status == TaskWorkStatus.UnFinish);
         if (toolUploadTask != null)
         {
             toolUploadTask.Status = TaskWorkStatus.Cancel;
             toolUploadTask.Update();
         }
         CompleteRenewalToolTask();
         var task = info.GenerateSubmitTask(this.WorkflowCode);
         tranScope.Complete();
         return(task.Url);
     }
 }
Esempio n. 9
0
        public static ReopenMemo GetReopenMemo(string projectId)
        {
            var  memo        = FirstOrDefault(e => e.ProjectId.Equals(projectId));
            bool isEmptyMemo = false;

            if (memo == null)
            {
                memo        = new ReopenMemo();
                isEmptyMemo = true;
            }

            memo.ProjectId = projectId;
            if (projectId.ToLower().IndexOf("rebuild") >= 0)
            {
                var rbdInfo = new RebuildInfo();
                memo.RbdInfo = rbdInfo.GetRebuildInfo(projectId);
                memo.Store   = StoreBasicInfo.GetStore(memo.RbdInfo.USCode);
                var consInfo = new RebuildConsInfo();
                consInfo = consInfo.GetConsInfo(projectId);
                var rein = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentBasicInfo();
                memo.ReinvestInfo = rein;
                var recos = ReinvestmentCost.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentCost();
                memo.TotalReinvestmentBudget = recos.TotalReinvestmentBudget;
                if (!memo.ReopenDate.HasValue)
                {
                    memo.ReopenDate = memo.ReinvestInfo.ReopenDate;
                }
                if (!memo.GBDate.HasValue)
                {
                    memo.GBDate = memo.ReinvestInfo.GBDate;
                }
                var gbMemo = GBMemo.GetGBMemo(projectId);
                if (!memo.CompletionDate.HasValue && gbMemo != null)
                {
                    memo.CompletionDate = gbMemo.ConstCompletionDate;
                }
                //if (string.IsNullOrEmpty(memo.DesignConcept))
                //    memo.DesignConcept = memo.ReinvestInfo.NewDesignType;

                var writeoff = WriteOffAmount.GetByConsInfoId(consInfo.Id) ?? new WriteOffAmount();
                memo.WriteOff = writeoff;
            }
            else if (projectId.ToLower().IndexOf("reimage") >= 0)
            {
                memo.RmgInfo = ReimageInfo.GetReimageInfo(projectId);
                memo.Store   = StoreBasicInfo.GetStore(memo.RmgInfo.USCode);
                var consInfo = ReimageConsInfo.GetConsInfo(projectId);
                var rein     = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentBasicInfo();
                memo.ReinvestInfo = rein;
                var recos = ReinvestmentCost.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentCost();
                memo.TotalReinvestmentBudget = recos.TotalReinvestmentBudget;
                if (!memo.ReopenDate.HasValue)
                {
                    memo.ReopenDate = memo.ReinvestInfo.ReopenDate;
                }
                if (!memo.GBDate.HasValue)
                {
                    memo.GBDate = memo.ReinvestInfo.GBDate;
                }
                var gbMemo = ReimageGBMemo.GetGBMemo(projectId);
                if (!memo.CompletionDate.HasValue && gbMemo != null)
                {
                    memo.CompletionDate = gbMemo.ConstCompletionDate;
                }
                //if (string.IsNullOrEmpty(memo.DesignConcept))
                //    memo.DesignConcept = memo.ReinvestInfo.NewDesignType;
                var writeoff = WriteOffAmount.GetByConsInfoId(consInfo.Id) ?? new WriteOffAmount();
                memo.WriteOff = writeoff;
            }
            else if (projectId.ToLower().IndexOf("majorlease") >= 0)
            {
                var mjrInfo = new MajorLeaseInfo().GetMajorLeaseInfo(projectId);
                memo.ReopenDate = mjrInfo.ReopenDate;
                memo.Store      = StoreBasicInfo.GetStore(mjrInfo.USCode);
                var consInfo = new MajorLeaseConsInfo().GetConsInfo(projectId);
                var rein     = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentBasicInfo();
                memo.ReinvestInfo = rein;
                var recos = ReinvestmentCost.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentCost();
                memo.TotalReinvestmentBudget = recos.TotalReinvestmentBudget;
                if (!memo.ReopenDate.HasValue)
                {
                    memo.ReopenDate = memo.ReinvestInfo.ReopenDate;
                }
                if (!memo.GBDate.HasValue)
                {
                    memo.GBDate = memo.ReinvestInfo.GBDate;
                }
                var gbMemo = MajorLeaseGBMemo.GetGBMemo(projectId);
                if (!memo.CompletionDate.HasValue && gbMemo != null)
                {
                    memo.CompletionDate = gbMemo.ConstCompletionDate;
                }
                //if (string.IsNullOrEmpty(memo.DesignConcept))
                //    memo.DesignConcept = memo.ReinvestInfo.NewDesignType;
                var writeoff = WriteOffAmount.GetByConsInfoId(consInfo.Id) ?? new WriteOffAmount();
                memo.WriteOff = writeoff;
            }
            else if (projectId.ToLower().IndexOf("renewal") >= 0)
            {
                var renewalInfo = RenewalInfo.Get(projectId);
                memo.ReopenDate = renewalInfo.NewLeaseStartDate;
                memo.Store      = StoreBasicInfo.GetStore(renewalInfo.USCode);
                var consInfo = RenewalConsInfo.Get(projectId);
                var rein     = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentBasicInfo();
                memo.ReinvestInfo = rein;
                var recos = ReinvestmentCost.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentCost();
                memo.TotalReinvestmentBudget = recos.TotalReinvestmentBudget;
                if (!memo.ReopenDate.HasValue)
                {
                    memo.ReopenDate = memo.ReinvestInfo.ReopenDate;
                }
                if (!memo.GBDate.HasValue)
                {
                    memo.GBDate = memo.ReinvestInfo.GBDate;
                }
                var gbMemo = RenewalGBMemo.GetGBMemo(projectId);
                if (!memo.CompletionDate.HasValue && gbMemo != null)
                {
                    memo.CompletionDate = gbMemo.ConstCompletionDate;
                }
                //if (string.IsNullOrEmpty(memo.DesignConcept))
                //    memo.DesignConcept = memo.ReinvestInfo.NewDesignType;
                var writeoff = WriteOffAmount.GetByConsInfoId(consInfo.Id) ?? new WriteOffAmount();
                memo.WriteOff = writeoff;
            }
            if (isEmptyMemo)
            {
                if (memo.ReinvestInfo != null)
                {
                    if (memo.ReinvestInfo.NewMcCafe.HasValue && memo.ReinvestInfo.NewMcCafe.Value)
                    {
                        memo.NewMcCafe = true;
                    }
                    if ((memo.ReinvestInfo.NewAttachedKiosk.HasValue && memo.ReinvestInfo.NewAttachedKiosk.Value) ||
                        (memo.ReinvestInfo.NewRemoteKiosk.HasValue && memo.ReinvestInfo.NewRemoteKiosk.Value))
                    {
                        memo.NewKiosk = true;
                    }
                    if (memo.ReinvestInfo.NewMDS.HasValue && memo.ReinvestInfo.NewMDS.Value)
                    {
                        memo.NewMDS = true;
                    }
                    if (memo.ReinvestInfo.NewTwientyFourHour.HasValue && memo.ReinvestInfo.NewTwientyFourHour.Value)
                    {
                        memo.Is24H = true;
                    }
                    //if (!string.IsNullOrEmpty(memo.ReinvestInfo.NewOperationSize))
                    //{
                    //    memo.AftOperationSize = memo.ReinvestInfo.NewOperationSize;
                    //}
                    //if (!string.IsNullOrEmpty(memo.ReinvestInfo.EstimatedSeatNo))
                    //{
                    //    memo.AftARSN = memo.ReinvestInfo.EstimatedSeatNo;
                    //}
                }
                memo.TTMNetSales = GetTTFinanceData(memo.Store.StoreBasicInfo.StoreCode);
            }
            memo.PriceTiter = GetPriceTier(memo.Store.StoreBasicInfo.StoreCode);
            //if (string.IsNullOrEmpty(memo.AftARPT))
            //{
            //    memo.AftARPT = memo.PriceTiter;
            //}
            //if (memo.Store != null)
            //{
            //    memo.OriginalOperationSize = memo.Store.StoreSTLocation.TotalArea;
            //    memo.OriginalSeatNumber = memo.Store.StoreSTLocation.TotalSeatsNo;
            //}
            memo.YearMonthList = GetSelectYearMonth(memo.Store.StoreBasicInfo.StoreCode);
            if (isEmptyMemo)
            {
                SaveReopenMemo(memo);
            }
            return(memo);
        }