Пример #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);
        }
Пример #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);
        }
Пример #3
0
        public FinancialPreanalysis getFinan(string projectId, string usCode)
        {
            var financialPreanalysis = FinancialPreanalysis.FirstOrDefault(e => e.RefId == Id);

            if (financialPreanalysis == null)
            {
                financialPreanalysis = new FinancialPreanalysis();
                //FinancialPreanalysis financial = reimageSummary.LoadFinancialPreanalysisInfo();

                var enti = ReimageConsInfo.FirstOrDefault(e => e.ProjectId.Equals(projectId) && e.IsHistory == true);
                if (enti == null)
                {
                    enti = ReimageConsInfo.FirstOrDefault(e => e.ProjectId.Equals(projectId) && e.IsHistory == false);
                }
                var writeOff = WriteOffAmount.FirstOrDefault(e => e.ConsInfoID == enti.Id);

                if (writeOff != null)
                {
                    financialPreanalysis.EstimatedWriteOffCost = writeOff.TotalII;
                }
                var contributionMargin    = StoreCM.Get(usCode).ContributionMargin.ToString();
                var reimageConsInfo       = ReimageConsInfo.GetConsInfo(projectId);
                var reinvestmentBasicInfo = ReinvestmentBasicInfo.FirstOrDefault(e => e.ConsInfoID == reimageConsInfo.Id);
                if (reinvestmentBasicInfo != null)
                {
                    //ReinvestmentCost reinCost = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == enti.Id);
                    financialPreanalysis.IsMcCafe = reinvestmentBasicInfo.NewMcCafe;

                    if ((reinvestmentBasicInfo.NewAttachedKiosk.HasValue && reinvestmentBasicInfo.NewAttachedKiosk.Value) ||
                        (reinvestmentBasicInfo.NewRemoteKiosk.HasValue && reinvestmentBasicInfo.NewRemoteKiosk.Value))
                    {
                        financialPreanalysis.IsKiosk = true;
                    }
                    else
                    {
                        financialPreanalysis.IsKiosk = false;
                    }
                    financialPreanalysis.IsMDS             = reinvestmentBasicInfo.NewMDS;
                    financialPreanalysis.IsTwientyFourHour = reinvestmentBasicInfo.NewTwientyFourHour;
                    financialPreanalysis.StoreCM           = contributionMargin;

                    financialPreanalysis.GetNewAddBE();
                }
            }


            return(financialPreanalysis);
        }
Пример #4
0
        public void Save(string action = "")
        {
            using (var scope = new TransactionScope())
            {
                if (this.Id == Guid.Empty)
                {
                    Id                = Guid.NewGuid();
                    CreateTime        = DateTime.Now;
                    LastUpdateTime    = DateTime.Now;
                    CreateUserAccount = ClientCookie.UserCode;

                    IsHistory = false;

                    Add(this);
                }
                else
                {
                    //Id = summary.Id;
                    LastUpdateTime = DateTime.Now;
                    Update(this);
                }
                if (ReinvestmentBasicInfo != null)
                {
                    ReinvestmentBasicInfo.ConsInfoID = Id;
                    ReinvestmentBasicInfo.Save();
                }

                if (StoreProfitabilityAndLeaseInfo != null)
                {
                    StoreProfitabilityAndLeaseInfo.RefId = Id;
                    StoreProfitabilityAndLeaseInfo.Save();
                }

                if (FinancialPreanalysis != null)
                {
                    FinancialPreanalysis.RefId = Id;
                    FinancialPreanalysis.Save();
                }

                scope.Complete();
            }
        }
Пример #5
0
        public static RenewalAnalysisDTO InitPage(string projectId)
        {
            RenewalAnalysisDTO dto = new RenewalAnalysisDTO();
            var consInfo           = RenewalConsInfo.Get(projectId);
            var analysis           = Get(projectId);

            if (consInfo.HasReinvenstment)
            {
                var reinBasic = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentBasicInfo();
                analysis.OperationSize = reinBasic.NewOperationSize;
            }
            dto.Info = RenewalInfo.Get(projectId);
            analysis.LastRemodeling = GetLastRemodeling(dto.Info.USCode);
            dto.Entity           = analysis;
            dto.HasReinvenstment = consInfo.HasReinvenstment;
            dto.StoreInfo        = PrepareStoreInfo(projectId, dto.Info.USCode);
            dto.Editable         = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_Analysis);
            dto.Recallable       = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_Analysis);
            dto.Savable          = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_Analysis);
            return(dto);
        }
Пример #6
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);
        }
Пример #7
0
        public void Save(string action = "")
        {
            using (var scope = new TransactionScope())
            {
                if (Id == Guid.Empty)
                {
                    Id                 = Guid.NewGuid();
                    CreateTime         = DateTime.Now;
                    LastUpdateTime     = DateTime.Now;
                    CreateUserAccount  = ClientCookie.UserCode;
                    CreateUserNameZHCN = ClientCookie.UserNameZHCN;
                    CreateUserNameENUS = ClientCookie.UserNameENUS;
                    IsHistory          = false;
                    Add(this);
                }
                else
                {
                    LastUpdateTime = DateTime.Now;
                    Update(this);
                }
                if (ReinBasicInfo != null)
                {
                    var reinBasicInfo    = Duplicator.AutoCopy(ReinBasicInfo);
                    var oldreinBasicInfo = ReinvestmentBasicInfo.FirstOrDefault(e => e.ConsInfoID == Id);
                    if (oldreinBasicInfo != null)
                    {
                        reinBasicInfo.Id = oldreinBasicInfo.Id;
                    }
                    else
                    {
                        reinBasicInfo.Id = 0;
                    }
                    reinBasicInfo.ConsInfoID = Id;
                    reinBasicInfo.Save();

                    UpdateMajorLeaseInfo();
                }

                if (ReinCost != null)
                {
                    var reinCost = Duplicator.AutoCopy(ReinCost);
                    reinCost.Id         = new Guid();
                    reinCost.ConsInfoID = Id;

                    reinCost.Save();
                }

                if (WriteOff != null)
                {
                    var writeOff = Duplicator.AutoCopy(WriteOff);
                    writeOff.Id         = new Guid();
                    writeOff.ConsInfoID = Id;
                    writeOff.Save();
                }
                SaveApproveUsers(action);
                if (!action.Equals("Edit"))
                {
                    SaveComments(action);
                }

                UpdateAttachmentStatusByReinvenstmentType();
                scope.Complete();
            }
        }
Пример #8
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);
        }
Пример #9
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();
            }
        }
Пример #10
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);
     }
 }
Пример #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.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();
            }
        }
Пример #12
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);
        }