コード例 #1
0
        public static void SendRemind(string strProjectId, string strFlowCode, List <ProjectUsers> remindUsers)
        {
            var projectInfo = ProjectInfo.FirstOrDefault(e => e.FlowCode == strFlowCode &&
                                                         e.ProjectId == strProjectId);

            if (projectInfo != null)
            {
                var store = StoreBasicInfo.FirstOrDefault(e => e.StoreCode == projectInfo.USCode);

                var employee = Employee.GetEmployeeByCode(projectInfo.CreateUserAccount);

                if (store != null &&
                    employee != null)
                {
                    var remind = new Remind();
                    remind.SenderAccount  = employee.Code;
                    remind.SenderNameENUS = employee.NameENUS;
                    remind.SenderNameZHCN = employee.NameZHCN;
                    remind.Title          = string.Format("【{0} {1} ({2})】{3}流程已创建", projectInfo.USCode, store.NameZHCN, store.NameENUS, strFlowCode);
                    remind.Url            = string.Format("/Home/Main#/project/detail/{0}?flowCode={1}", strProjectId, strFlowCode);
                    remind.RegisterCode   = strFlowCode;
                    remind.IsReaded       = false;
                    PostRemaindList(remind, remindUsers);
                }
            }
        }
コード例 #2
0
        public static IQueryable <TaskWork> Query(TaskWorkCondition searchCondition, out int totalSize)
        {
            var predicate = PredicateBuilder.True <TaskWork>();

            if (!string.IsNullOrEmpty(searchCondition.Title))
            {
                predicate = predicate.And(e => e.Title.Contains(searchCondition.Title));
            }

            if (!string.IsNullOrEmpty(searchCondition.StoreCode))
            {
                predicate = predicate.And(e => e.StoreCode.Contains(searchCondition.StoreCode));
            }

            if (!string.IsNullOrEmpty(searchCondition.StoreNameZHCN))
            {
                var storeList     = StoreBasicInfo.Search(e => e.NameZHCN.Contains(searchCondition.StoreNameZHCN));
                var storeCodeList = storeList.Select(e => e.StoreCode).ToList();

                predicate = predicate.And(e => storeCodeList.Contains(e.StoreCode));
            }

            if (searchCondition.Status.HasValue)
            {
                predicate = predicate.And(e => e.Status == searchCondition.Status.Value);
            }

            if (!string.IsNullOrEmpty(searchCondition.TypeCode))
            {
                //var employeeList = Employee.Search(e => e.NameZHCN.Contains(searchCondition.SenderZHCN));
                //var employeeCodeList = employeeList.Select(e => e.Code).ToList();

                predicate = predicate.And(e => e.TypeCode.Contains(searchCondition.TypeCode));
            }

            if (!string.IsNullOrEmpty(searchCondition.ReceiverAccount))
            {
                predicate = predicate.And(e => e.ReceiverAccount == searchCondition.ReceiverAccount);
            }

            //从多少页开始取数据
            var list = Search(predicate, e => e.Num, searchCondition.PageIndex, searchCondition.PageSize,
                              out totalSize, true);

            return(list);
        }
コード例 #3
0
        /// <summary>
        /// 根据角色名称获取用户-简单用户对象
        /// </summary>
        /// <param name="storeCode">Store US Code</param>
        /// <param name="roleCodes">RoleCode组合</param>
        /// <returns>UserCode,RoleCode</returns>
        public static Dictionary <string, string> GetStoreEmployeesRoleCodeByMultiRoles(string storeCode, string[] roleCodes)
        {
            var db = PrepareDb();
            Dictionary <string, string> result = new Dictionary <string, string>();
            var storeEntry = new StoreBasicInfo();
            //获取Store的Region/Market/City的Code
            var store = StoreBasicInfo.GetStore(storeCode);

            foreach (var roleCode in roleCodes)
            {
                string rc = roleCode.Trim();
                switch (rc)
                {
                case "Asset_Rep":
                    var reps = GetStoreAssetRepByStoreCode(storeCode);
                    foreach (var rep in reps)
                    {
                        result.Add(rep.Code, rc);
                    }
                    break;

                case "Asset_Mgr":
                    var repMgrs = GetStoreAssetRepMgrByStoreCode(storeCode);
                    foreach (var repMgr in repMgrs)
                    {
                        result.Add(repMgr.Code, rc);
                    }
                    break;

                default:
                    RoleCode roleEnum;
                    if (Enum.TryParse(rc, out roleEnum))
                    {
                        var users = GetStoreEmployeesByRole(storeCode, roleEnum);
                        foreach (var user in users)
                        {
                            result.Add(user.Code, rc);
                        }
                    }
                    break;
                }
            }
            return(result);
        }
コード例 #4
0
ファイル: RenewalPackage.cs プロジェクト: XiaoYaTech/Demo
 public void GenerateCover()
 {
     if (!Attachment.Any(att => att.RefTableID == this.Id.ToString() && att.RequirementId == new Guid("9D1E247C-AAE0-44F6-869E-F50B3E633C1C")))
     {
         var info             = RenewalInfo.Get(this.ProjectId);
         var store            = StoreBasicInfo.GetStorInfo(info.USCode);
         var contract         = StoreContractInfo.Get(info.USCode);
         var context          = HttpContext.Current;
         var templateFileName = context.Server.MapPath("~/Template/RenewalCover_Template_v20130922.xlsx");
         var fileName         = context.Server.MapPath(string.Format("~/UploadFiles/{0}.xlsx", Guid.NewGuid()));
         File.Copy(templateFileName, fileName);
         var fileInfo = new FileInfo(fileName);
         ExcelDataInputDirector excelDirector = new ExcelDataInputDirector(fileInfo, ExcelDataInputType.RenewalCover);
         ExcelInputDTO          excelInput    = new ExcelInputDTO();
         excelInput.Region              = store.RegionENUS;
         excelInput.Province            = store.ProvinceZHCN;
         excelInput.City                = store.CityENUS;
         excelInput.Market              = store.MarketENUS;
         excelInput.StoreName           = store.NameZHCN;
         excelInput.USCode              = store.StoreCode;
         excelInput.OpenDate            = store.OpenDate;
         excelInput.LeaseExpirationDate = contract.EndDate.Value;
         excelInput.Priority            = info.Priority;
         excelDirector.Input(excelInput);
         var att = new Attachment();
         att.ID              = Guid.NewGuid();
         att.RefTableID      = this.Id.ToString();
         att.RefTableName    = this.TableName;
         att.RelativePath    = "/";
         att.TypeCode        = "Cover";
         att.RequirementId   = Guid.Parse("9D1E247C-AAE0-44F6-869E-F50B3E633C1C");
         att.Name            = "Cover";
         att.Extension       = fileInfo.Extension;
         att.InternalName    = fileInfo.Name;
         att.ContentType     = "application/vnd.ms-excel";
         att.Length          = (int)fileInfo.Length;
         att.CreatorID       = ClientCookie.UserCode;
         att.CreatorNameENUS = ClientCookie.UserNameENUS;
         att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
         att.CreateTime      = DateTime.Now;
         att.Add();
     }
 }
コード例 #5
0
        public void UpdateStoreLLRecord()
        {
            var info         = RenewalInfo.Get(this.ProjectId);
            var negotiations = RenewalLLNegotiationRecord.GetRecords(this.Id);

            if (negotiations.Count > 0)
            {
                StoreSTLLRecord record = StoreSTLLRecord.Get(info.USCode);
                if (record == null)
                {
                    var storeBasic = StoreBasicInfo.GetStorInfo(info.USCode);
                    record           = new StoreSTLLRecord();
                    record.StoreCode = info.USCode;
                    record.StoreID   = storeBasic.StoreID;
                    record.Id        = Guid.NewGuid();
                }
                record.LLparticipants  = negotiations[0].LLParticipants;
                record.Location        = negotiations[0].Location;
                record.McdParticipants = negotiations[0].McdParticipants;
                record.Content         = negotiations[0].Content;
                record.CreatedTime     = negotiations[0].CreateTime;
                record.Topic           = negotiations[0].Topic;
                record.Save();
                var storeNegos = negotiations.Select(n => new StoreSTNegotiation
                {
                    Id                = Guid.NewGuid(),
                    StoreID           = record.StoreID,
                    StoreCode         = record.StoreCode,
                    IsBroker          = record.IsBroker,
                    BrokerName        = record.BrokerName,
                    DateTime          = n.Date.Value.ToString("yyyy-MM-dd"),
                    Location          = n.Location,
                    Topic             = n.Topic,
                    McdParticipants   = n.McdParticipants,
                    McdParticipantsAD = record.McdParticipantsAD,
                    LLparticipants    = n.LLParticipants,
                    Content           = n.Content,
                    CreatedTime       = n.CreateTime
                }).ToArray();
                StoreSTNegotiation.Add(storeNegos);
            }
        }
コード例 #6
0
        /// <summary>
        /// 获取资产代表
        /// </summary>
        /// <param name="storeCode">店Code</param>
        /// <returns></returns>
        public List <ProjectTeamMember> GetAssetRepsByStoreCode(string storeCode, string currentUserCode, string roleCode)
        {
            var db = GetDb();
            List <ProjectTeamMember> result = new List <ProjectTeamMember>();

            //获取Store的Region/Market/City的Code
            var store = StoreBasicInfo.GetStore(storeCode);
            var user  = db.Employee.Where(e => e.Code.Equals(store.StoreDevelop.AssetRepEid) && e.Status).Select(p => new ProjectTeamMember
            {
                UserAccount  = p.Code,
                UserNameENUS = p.NameENUS,
                UserNameZHCN = p.NameZHCN
            }).FirstOrDefault();

            if (user != null)
            {
                result.Add(user);
            }

            return(result);
        }
コード例 #7
0
        /// <summary>
        /// 根据角色名称获取用户-简单用户对象
        /// </summary>
        /// <param name="storeCode">Store US Code</param>
        /// <param name="roleCodes">RoleCode组合</param>
        /// <param name="userCode"></param>
        /// <returns></returns>
        public static List <SimpleEmployee> GetStoreEmployeesByMultiRoles(string storeCode, string[] roleCodes, string userCode)
        {
            var db = PrepareDb();
            List <SimpleEmployee> result = new List <SimpleEmployee>();
            var storeEntry = new StoreBasicInfo();
            //获取Store的Region/Market/City的Code
            var store = StoreBasicInfo.GetStore(storeCode);

            foreach (var roleCode in roleCodes)
            {
                string rc = roleCode.Trim();
                switch (rc)
                {
                case "Asset Rep":
                    var reps = GetStoreAssetRepByStoreCode(storeCode);
                    result.AddRange(reps);
                    break;

                case "Asset Mgr":
                    var repMgrs = GetStoreAssetRepMgrByStoreCode(storeCode);
                    result.AddRange(repMgrs);
                    break;

                case "Asset Actor":
                    var repActors = GetStoreAssetActorsByStoreCode(storeCode, userCode);
                    result.AddRange(repActors);
                    break;

                default:
                    RoleCode roleEnum;
                    if (Enum.TryParse(rc, out roleEnum))
                    {
                        var users = GetStoreEmployeesByRole(storeCode, roleEnum);
                        result.AddRange(users);
                    }
                    break;
                }
            }
            return(result);
        }
コード例 #8
0
ファイル: GBMemo.cs プロジェクト: XiaoYaTech/Demo
        public static GBMemo GetGBMemo(string projectId)
        {
            var memo = FirstOrDefault(e => e.ProjectId.Equals(projectId) && !e.IsHistory);

            if (memo == null)
            {
                memo = new GBMemo();
            }

            memo.ProjectId = projectId;
            string usCode = "";

            if (projectId.ToLower().IndexOf("rebuild") >= 0)
            {
                var rbdInfo = new RebuildInfo();
                rbdInfo   = rbdInfo.GetRebuildInfo(projectId);
                memo.Info = rbdInfo;
                usCode    = rbdInfo.USCode;
            }
            if (projectId.ToLower().IndexOf("reimage") >= 0)
            {
                var reimageInfo = ReimageInfo.GetReimageInfo(projectId);
                memo.rmgInfo = reimageInfo;
                usCode       = reimageInfo.USCode;
            }
            memo.Store = StoreBasicInfo.GetStore(usCode);

            if (memo.Store.Hour24Count == 24)
            {
                memo.Is24Hour = true;
            }
            else
            {
                memo.Is24Hour = false;
            }
            return(memo);
        }
コード例 #9
0
        public static TTMFinanceData GetFinanceData(string projectId, string financeYear = "", string financeMonth = "")
        {
            var ldw_FinanceData = LDW_FinanceData.Get(projectId);
            var ttmData         = new TTMFinanceData();

            if (string.IsNullOrEmpty(financeYear) && string.IsNullOrEmpty(financeMonth) && ldw_FinanceData != null)
            {
                ttmData.Accounting       = DataConverter.ToDecimal(ldw_FinanceData.Accounting_TTM);
                ttmData.DepreciationEssd = DataConverter.ToDecimal(ldw_FinanceData.Depreciation_Essd_TTM);
                ttmData.DepreciationLhi  = DataConverter.ToDecimal(ldw_FinanceData.Depreciation_LHI_TTM);
                ttmData.NonProductCosts  = DataConverter.ToDecimal(ldw_FinanceData.Non_Product_Costs_TTM);
                ttmData.NonProductSales  = DataConverter.ToDecimal(ldw_FinanceData.Non_Product_Sales_TTM);
                ttmData.Insurance        = DataConverter.ToDecimal(ldw_FinanceData.Insurance_TTM);

                ttmData.InterestEssd     = DataConverter.ToDecimal(ldw_FinanceData.Interest_Essd_TTM);
                ttmData.InterestLhi      = DataConverter.ToDecimal(ldw_FinanceData.Interest_LHI_TTM);
                ttmData.OtherIncExp      = DataConverter.ToDecimal(ldw_FinanceData.Other_Exp_TTM);
                ttmData.Pac              = DataConverter.ToDecimal(ldw_FinanceData.Pac_TTM);
                ttmData.ProductSales     = DataConverter.ToDecimal(ldw_FinanceData.ProductSales_TTM);
                ttmData.Rent             = DataConverter.ToDecimal(ldw_FinanceData.Rent_TTM);
                ttmData.ServiceFee       = DataConverter.ToDecimal(ldw_FinanceData.Service_Fee_TTM);
                ttmData.TaxesAndLicenses = DataConverter.ToDecimal(ldw_FinanceData.Taxes_Licenses_TTM);
                ttmData.CompSales        = DataConverter.ToDecimal(ldw_FinanceData.comp_sales_ttm);
            }
            else
            {
                var yearMonthObj = StoreSTMonthlyFinaceInfoTTM.FirstOrDefault(f => true);
                if (string.IsNullOrEmpty(financeYear))
                {
                    if (yearMonthObj != null && !string.IsNullOrEmpty(yearMonthObj.TTMValue))
                    {
                        financeYear = yearMonthObj.TTMValue.Substring(0, yearMonthObj.TTMValue.IndexOf('-'));
                    }
                    else
                    {
                        financeYear = Utils.GetLatestYear();
                    }
                }
                if (string.IsNullOrEmpty(financeMonth))
                {
                    if (yearMonthObj != null && !string.IsNullOrEmpty(yearMonthObj.TTMValue))
                    {
                        financeMonth = yearMonthObj.TTMValue.Substring(yearMonthObj.TTMValue.IndexOf('-') + 1);
                    }
                    else
                    {
                        financeMonth = Utils.GetLatestMonth();
                    }
                }
                var uscode       = RenewalInfo.Get(projectId).USCode;
                var storeId      = StoreBasicInfo.Search(s => s.StoreCode.Equals(uscode)).Select(id => id.StoreID).FirstOrDefault();
                var financeData  = DataSync_LDW_AM_STFinanceData.FirstOrDefault(f => f.UsCode == uscode && f.FinanceYear.Equals(financeYear) && f.FinanceMonth.Equals(financeMonth));
                var financeData2 = DataSync_LDW_AM_STFinanceData2.FirstOrDefault(f => f.UsCode == uscode && f.FinanceYear.Equals(financeYear) && f.FinanceMonth.Equals(financeMonth));
                var re           = DataSync_LDW_AM_STMonthlyFinaceInfo.Search(f => f.StoreID == storeId).OrderByDescending(f => f.Year).FirstOrDefault();

                ttmData.Accounting       = DataConverter.ToDecimal(financeData2.Accounting_TTM);
                ttmData.DepreciationEssd = DataConverter.ToDecimal(financeData2.Depreciation_Essd_TTM);
                ttmData.DepreciationLhi  = DataConverter.ToDecimal(financeData2.Depreciation_LHI_TTM);
                ttmData.NonProductCosts  = DataConverter.ToDecimal(financeData2.Non_Product_Costs_TTM);
                ttmData.NonProductSales  = DataConverter.ToDecimal(financeData2.Non_Product_Sales_TTM);
                ttmData.Insurance        = DataConverter.ToDecimal(financeData2.Insurance_TTM);
                ttmData.InterestEssd     = DataConverter.ToDecimal(financeData2.Interest_Essd_TTM);
                ttmData.InterestLhi      = DataConverter.ToDecimal(financeData2.Interest_LHI_TTM);
                ttmData.OtherIncExp      = DataConverter.ToDecimal(financeData2.Other_Exp_TTM);
                ttmData.Pac              = DataConverter.ToDecimal(financeData2.Pac_TTM);
                ttmData.ProductSales     = DataConverter.ToDecimal(financeData.ProductSales_TTM);
                ttmData.Rent             = DataConverter.ToDecimal(financeData2.Rent_TTM);
                ttmData.ServiceFee       = DataConverter.ToDecimal(financeData2.Service_Fee_TTM);
                ttmData.TaxesAndLicenses = DataConverter.ToDecimal(financeData2.Taxes_Licenses_TTM);
                ttmData.CompSales        = DataConverter.ToDecimal(financeData2.comp_sales_ttm);
            }
            return(ttmData);
        }
コード例 #10
0
        public static void Create(PostCreateWorkflow <RenewalInfo> postCreateRenewal)
        {
            using (TransactionScope tranScope = new TransactionScope())
            {
                var usCode    = postCreateRenewal.Entity.USCode;
                var store     = StoreBasicInfo.GetStorInfo(usCode);
                var projectId = ProjectInfo.CreateMainProject(FlowCode.Renewal, usCode, NodeCode.Start, ClientCookie.UserCode);
                postCreateRenewal.Entity.Id = Guid.NewGuid();
                postCreateRenewal.Entity.CreateUserAccount = ClientCookie.UserCode;
                postCreateRenewal.Entity.CreateTime        = DateTime.Now;
                postCreateRenewal.Entity.StoreNameENUS     = store.NameENUS;
                postCreateRenewal.Entity.StoreNameZHCN     = store.NameZHCN;

                postCreateRenewal.Entity.AssetRepAccount  = postCreateRenewal.Team.AssetRep.UserAccount;
                postCreateRenewal.Entity.AssetRepNameENUS = postCreateRenewal.Team.AssetRep.UserNameENUS;
                postCreateRenewal.Entity.AssetRepNameZHCN = postCreateRenewal.Team.AssetRep.UserNameZHCN;

                postCreateRenewal.Entity.AssetActorAccount  = postCreateRenewal.Team.AssetActor.UserAccount;
                postCreateRenewal.Entity.AssetActorNameENUS = postCreateRenewal.Team.AssetActor.UserNameENUS;
                postCreateRenewal.Entity.AssetActorNameZHCN = postCreateRenewal.Team.AssetActor.UserNameZHCN;

                postCreateRenewal.Entity.FinanceAccount  = postCreateRenewal.Team.Finance.UserAccount;
                postCreateRenewal.Entity.FinanceNameENUS = postCreateRenewal.Team.Finance.UserNameENUS;
                postCreateRenewal.Entity.FinanceNameZHCN = postCreateRenewal.Team.Finance.UserNameZHCN;

                postCreateRenewal.Entity.PMAccount  = postCreateRenewal.Team.PM.UserAccount;
                postCreateRenewal.Entity.PMNameENUS = postCreateRenewal.Team.PM.UserNameENUS;
                postCreateRenewal.Entity.PMNameZHCN = postCreateRenewal.Team.PM.UserNameZHCN;

                postCreateRenewal.Entity.LegalAccount  = postCreateRenewal.Team.Legal.UserAccount;
                postCreateRenewal.Entity.LegalNameENUS = postCreateRenewal.Team.Legal.UserNameENUS;
                postCreateRenewal.Entity.LegalNameZHCN = postCreateRenewal.Team.Legal.UserNameZHCN;

                postCreateRenewal.Entity.AssetManagerAccount  = postCreateRenewal.Team.AssetMgr.UserAccount;
                postCreateRenewal.Entity.AssetManagerNameENUS = postCreateRenewal.Team.AssetMgr.UserNameENUS;
                postCreateRenewal.Entity.AssetManagerNameZHCN = postCreateRenewal.Team.AssetMgr.UserNameZHCN;

                postCreateRenewal.Entity.CMAccount  = postCreateRenewal.Team.CM.UserAccount;
                postCreateRenewal.Entity.CMNameENUS = postCreateRenewal.Team.CM.UserNameENUS;
                postCreateRenewal.Entity.CMNameZHCN = postCreateRenewal.Team.CM.UserNameZHCN;

                postCreateRenewal.Entity.ProjectId = projectId;
                postCreateRenewal.Entity.Add();
                ProjectInfo.CreateSubProject(FlowCode.Renewal_Letter, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount);
                RenewalLetter.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount);
                ProjectInfo.CreateSubProject(FlowCode.Renewal_LLNegotiation, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount);
                RenewalLLNegotiation.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount);
                ProjectInfo.CreateSubProject(FlowCode.Renewal_ConsInfo, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.PM.UserAccount);
                RenewalConsInfo.Create(projectId, postCreateRenewal.Team.PM.UserAccount, postCreateRenewal.Entity.NeedProjectCostEst);
                ProjectInfo.CreateSubProject(FlowCode.Renewal_Tool, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.Finance.UserAccount);
                var tool = RenewalTool.Create(projectId, postCreateRenewal.Team.Finance.UserAccount);
                ProjectInfo.CreateSubProject(FlowCode.Renewal_ClearanceReport, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount);
                RenewalClearanceReport.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount);
                ProjectInfo.CreateSubProject(FlowCode.Renewal_ConfirmLetter, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount);
                RenewalConfirmLetter.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount);
                ProjectInfo.CreateSubProject(FlowCode.Renewal_Analysis, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount);
                var analysis = RenewalAnalysis.Create(postCreateRenewal.Entity);
                ProjectInfo.CreateSubProject(FlowCode.Renewal_LegalApproval, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount);
                RenewalLegalApproval.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount);
                ProjectInfo.CreateSubProject(FlowCode.Renewal_Package, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount);
                RenewalPackage.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount, analysis.Id, tool.Id);
                ProjectInfo.CreateSubProject(FlowCode.Renewal_ContractInfo, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount);
                RenewalContractInfo.Create(projectId);
                ProjectInfo.CreateSubProject(FlowCode.Renewal_SiteInfo, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.PM.UserAccount);
                RenewalSiteInfo.Create(projectId, postCreateRenewal.Team.PM.UserAccount);

                ProjectInfo.CreateSubProject(FlowCode.Renewal_GBMemo, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.PM.UserAccount);

                List <ProjectUsers> projectUsers = new List <ProjectUsers>();

                postCreateRenewal.Team.AssetRep.Id                = Guid.NewGuid();
                postCreateRenewal.Team.AssetRep.ProjectId         = projectId;
                postCreateRenewal.Team.AssetRep.CreateDate        = DateTime.Now;
                postCreateRenewal.Team.AssetRep.CreateUserAccount = ClientCookie.UserCode;
                postCreateRenewal.Team.AssetRep.RoleCode          = ProjectUserRoleCode.AssetRep;
                postCreateRenewal.Team.AssetRep.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetRep, SystemLanguage.ENUS);
                postCreateRenewal.Team.AssetRep.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetRep, SystemLanguage.ZHCN);
                projectUsers.Add(postCreateRenewal.Team.AssetRep);

                postCreateRenewal.Team.AssetActor.Id                = Guid.NewGuid();
                postCreateRenewal.Team.AssetActor.ProjectId         = projectId;
                postCreateRenewal.Team.AssetActor.CreateDate        = DateTime.Now;
                postCreateRenewal.Team.AssetActor.CreateUserAccount = ClientCookie.UserCode;
                postCreateRenewal.Team.AssetActor.RoleCode          = ProjectUserRoleCode.AssetActor;
                postCreateRenewal.Team.AssetActor.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetActor, SystemLanguage.ENUS);
                postCreateRenewal.Team.AssetActor.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetActor, SystemLanguage.ZHCN);
                projectUsers.Add(postCreateRenewal.Team.AssetActor);

                postCreateRenewal.Team.Finance.Id                = Guid.NewGuid();
                postCreateRenewal.Team.Finance.ProjectId         = projectId;
                postCreateRenewal.Team.Finance.CreateDate        = DateTime.Now;
                postCreateRenewal.Team.Finance.CreateUserAccount = ClientCookie.UserCode;
                postCreateRenewal.Team.Finance.RoleCode          = ProjectUserRoleCode.Finance;
                postCreateRenewal.Team.Finance.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Finance, SystemLanguage.ENUS);
                postCreateRenewal.Team.Finance.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Finance, SystemLanguage.ZHCN);
                projectUsers.Add(postCreateRenewal.Team.Finance);

                postCreateRenewal.Team.PM.Id                = Guid.NewGuid();
                postCreateRenewal.Team.PM.ProjectId         = projectId;
                postCreateRenewal.Team.PM.CreateDate        = DateTime.Now;
                postCreateRenewal.Team.PM.CreateUserAccount = ClientCookie.UserCode;
                postCreateRenewal.Team.PM.RoleCode          = ProjectUserRoleCode.PM;
                postCreateRenewal.Team.PM.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.PM, SystemLanguage.ENUS);
                postCreateRenewal.Team.PM.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.PM, SystemLanguage.ZHCN);
                projectUsers.Add(postCreateRenewal.Team.PM);

                postCreateRenewal.Team.Legal.Id                = Guid.NewGuid();
                postCreateRenewal.Team.Legal.ProjectId         = projectId;
                postCreateRenewal.Team.Legal.CreateDate        = DateTime.Now;
                postCreateRenewal.Team.Legal.CreateUserAccount = ClientCookie.UserCode;
                postCreateRenewal.Team.Legal.RoleCode          = ProjectUserRoleCode.Legal;
                postCreateRenewal.Team.Legal.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Legal, SystemLanguage.ENUS);
                postCreateRenewal.Team.Legal.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Legal, SystemLanguage.ZHCN);
                projectUsers.Add(postCreateRenewal.Team.Legal);

                postCreateRenewal.Team.AssetMgr.Id                = Guid.NewGuid();
                postCreateRenewal.Team.AssetMgr.ProjectId         = projectId;
                postCreateRenewal.Team.AssetMgr.CreateDate        = DateTime.Now;
                postCreateRenewal.Team.AssetMgr.CreateUserAccount = ClientCookie.UserCode;
                postCreateRenewal.Team.AssetMgr.RoleCode          = ProjectUserRoleCode.AssetManager;
                postCreateRenewal.Team.AssetMgr.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetManager, SystemLanguage.ENUS);
                postCreateRenewal.Team.AssetMgr.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetManager, SystemLanguage.ZHCN);
                projectUsers.Add(postCreateRenewal.Team.AssetMgr);

                postCreateRenewal.Team.CM.Id                = Guid.NewGuid();
                postCreateRenewal.Team.CM.ProjectId         = projectId;
                postCreateRenewal.Team.CM.CreateDate        = DateTime.Now;
                postCreateRenewal.Team.CM.CreateUserAccount = ClientCookie.UserCode;
                postCreateRenewal.Team.CM.RoleCode          = ProjectUserRoleCode.CM;
                postCreateRenewal.Team.CM.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.CM, SystemLanguage.ENUS);
                postCreateRenewal.Team.CM.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.CM, SystemLanguage.ZHCN);
                projectUsers.Add(postCreateRenewal.Team.CM);

                ProjectUsers.Add(projectUsers.ToArray());

                postCreateRenewal.Viewers.ForEach(v =>
                {
                    v.Id                = Guid.NewGuid();
                    v.ProjectId         = projectId;
                    v.CreateDate        = DateTime.Now;
                    v.CreateUserAccount = ClientCookie.UserCode;
                    v.RoleCode          = ProjectUserRoleCode.View;
                });
                ProjectUsers.Add(postCreateRenewal.Viewers.ToArray());
                //postCreateRenewal.NecessaryViewers.ForEach(v =>
                //{
                //    v.Id = Guid.NewGuid();
                //    v.ProjectId = projectId;
                //    v.CreateDate = DateTime.Now;
                //    v.CreateUserAccount = ClientCookie.UserCode;
                //    v.RoleCode = ProjectUserRoleCode.View;
                //});
                //ProjectUsers.Add(postCreateRenewal.NecessaryViewers.ToArray());
                Remind.SendRemind(projectId, FlowCode.Renewal, projectUsers);
                Remind.SendRemind(projectId, FlowCode.Renewal, postCreateRenewal.Viewers);
                postCreateRenewal.Entity.GenerateSubmitTask(FlowCode.Renewal_Letter);
                postCreateRenewal.Entity.GenerateSubmitTask(FlowCode.Renewal_LLNegotiation);
                postCreateRenewal.Entity.CreateAttachmentsMemo();
                ProjectNode.GenerateOnCreate(FlowCode.Renewal, projectId);
                ProjectProgress.SetProgress(projectId, "10%");
                tranScope.Complete();
            }
        }
コード例 #11
0
        public static ReimageGBMemo GetGBMemo(string projectId, string entityId = "")
        {
            var memo = (string.IsNullOrEmpty(entityId) ?
                        FirstOrDefault(e => e.ProjectId.Equals(projectId) && !e.IsHistory)
                : FirstOrDefault(e => e.Id.ToString().Equals(entityId))) ?? new ReimageGBMemo();

            memo.ProjectId = projectId;

            string usCode  = "";
            var    rmgInfo = ReimageInfo.GetReimageInfo(projectId);

            memo.rmgInfo = rmgInfo;
            usCode       = rmgInfo.USCode;

            memo.Store = StoreBasicInfo.GetStore(usCode);
            var consInfo = new ReimageConsInfo();

            memo.ReinvestInfo = consInfo.GetReinvestmentBasicInfo(projectId);

            if (memo.Id == Guid.Empty)
            {
                memo.IsClosed      = (memo.Store.StoreBasicInfo.statusName == "Closed");
                memo.IsInOperation = false;

                if (memo.ReinvestInfo != null)
                {
                    if ((memo.ReinvestInfo.NewAttachedKiosk.HasValue && memo.ReinvestInfo.NewAttachedKiosk.Value) ||
                        (memo.ReinvestInfo.NewRemoteKiosk.HasValue && memo.ReinvestInfo.NewRemoteKiosk.Value))
                    {
                        memo.IsKiosk = true;
                    }
                    memo.IsMcCafe = memo.ReinvestInfo.NewMcCafe.HasValue && memo.ReinvestInfo.NewMcCafe.Value;
                    memo.IsMDS    = memo.ReinvestInfo.NewMDS.HasValue && memo.ReinvestInfo.NewMDS.Value;
                    memo.Is24Hour = memo.ReinvestInfo.NewTwientyFourHour.HasValue &&
                                    memo.ReinvestInfo.NewTwientyFourHour.Value;
                    memo.GBDate = memo.ReinvestInfo.GBDate;
                    memo.ConstCompletionDate = memo.ReinvestInfo.ConsCompletionDate;
                    memo.ReopenDate          = memo.ReinvestInfo.ReopenDate;
                }
                memo.Save();
            }
            else
            {
                var projectInfo = ProjectInfo.FirstOrDefault(e => e.ProjectId == projectId &&
                                                             e.FlowCode == FlowCode.Reimage_GBMemo);

                if (projectInfo != null)
                {
                    if (ClientCookie.UserCode.Equals(rmgInfo.PMAccount))
                    //if (reimageInfo != null)
                    {
                        var isExistTask = TaskWork.Any(e => e.RefID == projectId &&
                                                       e.TypeCode == FlowCode.Reimage_GBMemo &&
                                                       e.Status == TaskWorkStatus.UnFinish &&
                                                       e.ReceiverAccount == ClientCookie.UserCode
                                                       &&
                                                       e.ActivityName ==
                                                       WorkflowActOriginator);
                        memo.IsShowEdit   = projectInfo.Status == ProjectStatus.Finished && !isExistTask;
                        memo.IsShowRecall = CheckIfShowRecallByPojectStatus(projectInfo.Status) && !isExistTask;
                    }
                }
            }
            if (ClientCookie.UserCode.Equals(rmgInfo.PMAccount))
            {
                memo.IsShowSave = ProjectInfo.IsFlowSavable(projectId, FlowCode.Reimage_GBMemo);
            }
            PopulateAppUsers(memo);
            return(memo);
        }
コード例 #12
0
ファイル: ClosureWOCheckList.cs プロジェクト: XiaoYaTech/Demo
        public override string Edit()
        {
            if (!PreEdit(this.ProjectId))
            {
                return("");
            }
            var closureEntity = ClosureInfo.GetByProjectId(this.ProjectId);
            var store         = StoreBasicInfo.GetStorInfo(closureEntity.USCode);
            var taskWork      = new TaskWork();
            var source        = FlowInfo.Get(FlowCode.Closure);
            var taskType      = FlowInfo.Get(FlowCode.Closure_WOCheckList);

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

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

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

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

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

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

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

            foreach (var att in attList)
            {
                var newAtt = objCopy.AutoCopy(att);
                newAtt.RefTableID = newWo.Id.ToString();
                newAtt.ID         = Guid.NewGuid();
                newList.Add(newAtt);
            }
            Attachment.AddList(newList);
            return(taskWork.Url);
        }
コード例 #13
0
ファイル: RenewalTool.cs プロジェクト: XiaoYaTech/Demo
        public string DownloadToolTemplate()
        {
            var    templateFileName = string.Concat(SiteFilePath.Template_DIRECTORY, "/", SiteFilePath.RenewalTool_Template);
            string fileName         = string.Format("{0}/{1}.xlsx", SiteFilePath.TEMP_DIRECTORY, Guid.NewGuid());

            File.Copy(templateFileName, fileName);
            FileInfo fileInfo = new FileInfo(fileName);
            ExcelDataInputDirector excelDirector = new ExcelDataInputDirector(fileInfo, ExcelDataInputType.RenewalTool);
            ExcelInputDTO          excelDto      = new ExcelInputDTO();
            var info          = RenewalInfo.Get(this.ProjectId);
            var storeBasic    = StoreBasicInfo.GetStorInfo(info.USCode);
            var storeContract = StoreContractInfo.Get(info.USCode);
            var finInput      = RenewalToolFinMeasureInput.Get(this.ProjectId, this.Id);
            var wfAndReinCost = RenewalToolWriteOffAndReinCost.Get(this.ProjectId, this.Id);

            excelDto.USCode    = info.USCode;
            excelDto.Market    = storeBasic.Market;
            excelDto.StoreName = storeBasic.NameZHCN + "/" + storeBasic.NameENUS;
            excelDto.OpenDate  = storeBasic.OpenDate;
            if (storeContract.EndDate.HasValue)
            {
                excelDto.LeaseExpirationDate = storeContract.EndDate.Value;
            }
            excelDto.RenewalYears     = info.RenewalYears;
            excelDto.ProductSales     = finInput.ProductSalesAdjustment;
            excelDto.Pac              = finInput.PacAdjustment;
            excelDto.Rent             = finInput.RentAdjustment;
            excelDto.DepreciationLhi  = finInput.DepreciationLhiAdjustment;
            excelDto.InterestLhi      = finInput.InterestLhiAdjustment;
            excelDto.ServiceFee       = finInput.ServiceFeeAdjustment;
            excelDto.Accounting       = finInput.AccountingAdjustment;
            excelDto.Insurance        = finInput.InsuranceAdjustment;
            excelDto.TaxesAndLicenses = finInput.TaxesAndLicensesAdjustment;
            excelDto.DepreciationEssd = finInput.DepreciationEssdAdjustment;
            excelDto.InterestEssd     = finInput.InterestEssdAdjustment;
            excelDto.OtherIncExp      = finInput.OtherIncExpAdjustment;
            excelDto.NonProductSales  = finInput.NonProductSalesAdjustment;
            excelDto.NonProductCosts  = finInput.NonProductCostsAdjustment;
            excelDto.REII             = wfAndReinCost.REII;
            excelDto.LHIII            = wfAndReinCost.LHIII;
            excelDto.ESSDII           = wfAndReinCost.ESSDII;
            excelDto.RENBV            = wfAndReinCost.RENBV;
            if (wfAndReinCost.LHINBV.HasValue)
            {
                excelDto.LHINBV = wfAndReinCost.LHINBV.Value;
            }
            if (wfAndReinCost.ESSDNBV.HasValue)
            {
                excelDto.ESSDNBV = wfAndReinCost.ESSDNBV.Value;
            }
            excelDto.RECost             = wfAndReinCost.RECost;
            excelDto.LHICost            = wfAndReinCost.LHICost;
            excelDto.ESSDCost           = wfAndReinCost.ESSDCost;
            excelDto.TotalWriteOff      = wfAndReinCost.REWriteOff + wfAndReinCost.LHIWriteOff + wfAndReinCost.ESSDWriteOff;
            excelDto.RentalStructure    = !string.IsNullOrEmpty(finInput.RentalStructure) ? (Nullable <decimal>)decimal.Parse(finInput.RentalStructure) : null;
            excelDto.ContributionMargin = finInput.ContributionMargin;
            excelDto.SalesCompYr1       = finInput.SalesCompYr1;
            excelDto.SalesCompYr2       = finInput.SalesCompYr2;
            excelDto.SalesCompYr3       = finInput.SalesCompYr3;
            excelDto.SalesCompYr4       = finInput.SalesCompYr4;
            excelDto.SalesCompYr5       = finInput.SalesCompYr5;
            excelDto.SalesCompYr6       = finInput.SalesCompYr6;
            excelDto.SalesCompYr7       = finInput.SalesCompYr7;
            excelDto.SalesCompYr8       = finInput.SalesCompYr8;
            excelDto.SalesCompYr9       = finInput.SalesCompYr9;
            excelDto.SalesCompYr10      = finInput.SalesCompYr10;
            excelDto.SalesCompYr11      = finInput.SalesCompYr11;
            excelDto.SalesCompYr12      = finInput.SalesCompYr12;
            excelDto.SalesCompYr13      = finInput.SalesCompYr13;
            excelDto.SalesCompYr14      = finInput.SalesCompYr14;
            excelDto.SalesCompYr15      = finInput.SalesCompYr15;
            excelDto.SalesCompYr16      = finInput.SalesCompYr16;
            excelDto.SalesCompYr17      = finInput.SalesCompYr17;
            excelDto.SalesCompYr18      = finInput.SalesCompYr18;
            excelDto.SalesCompYr19      = finInput.SalesCompYr19;
            excelDto.SalesCompYr20      = finInput.SalesCompYr20;
            excelDto.ComSalesDesc       = this.ComSalesDesc;
            excelDto.CompSales          = finInput.CompSalesAdjustment;
            excelDto.FinanceYear        = finInput.FinanceYear;
            excelDto.FinanceMonth       = finInput.FinanceMonth;
            excelDirector.Input(excelDto);
            return(fileName);
        }
コード例 #14
0
        public Dictionary <string, string> GetPrintTemplateFields()
        {
            var project       = ProjectInfo.Get(ProjectId, FlowCode.Renewal_LegalApproval);
            var storeBasic    = StoreBasicInfo.GetStorInfo(project.USCode);
            var storeContract = StoreContractInfo.Search(c => c.StoreCode == project.USCode).OrderByDescending(c => c.CreatedTime).FirstOrDefault();
            var info          = RenewalInfo.Get(ProjectId);
            var flowInfo      = FlowInfo.Get(FlowCode.Renewal);
            var legal         = RenewalLegalApproval.Get(project.ProjectId) ?? new RenewalLegalApproval();
            Dictionary <string, string> templateFileds = new Dictionary <string, string>();

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

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

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

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

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

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

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

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

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

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

            //Endorsement by General Counsel
            templateFileds.Add("GCComment", legal.GCComment);
            return(templateFileds);
        }
コード例 #15
0
ファイル: ClosurePackage.cs プロジェクト: XiaoYaTech/Demo
        public Dictionary <string, string> GetPrintTemplateFields()
        {
            var returnDic = new Dictionary <string, string>();

            var            closureInfoEntity = ClosureInfo.GetByProjectId(this.ProjectId);
            var            storeInfo         = StoreBasicInfo.GetStore(closureInfoEntity.USCode);
            StoreBasicInfo store             = storeInfo.StoreBasicInfo;

            returnDic.Add("WorkflowName", SystemCode.Instance.GetCodeName(FlowCode.Closure, ClientCookie.Language));
            returnDic.Add("ProjectID", ProjectId);
            returnDic.Add("USCode", string.IsNullOrEmpty(closureInfoEntity.USCode) ? " " : closureInfoEntity.USCode);
            returnDic.Add("Region", string.IsNullOrEmpty(store.RegionENUS) ? " " : store.RegionENUS);
            returnDic.Add("StoreNameEN", string.IsNullOrEmpty(store.NameENUS) ? " " : store.NameENUS);
            returnDic.Add("Market", string.IsNullOrEmpty(store.MarketENUS) ? " " : store.MarketENUS);
            returnDic.Add("StoreNameCN", string.IsNullOrEmpty(store.NameZHCN) ? " " : store.NameZHCN);
            returnDic.Add("City", string.IsNullOrEmpty(store.CityENUS) ? " " : store.CityENUS);
            returnDic.Add("Address", string.IsNullOrEmpty(store.AddressZHCN) ? " " : store.AddressZHCN);
            returnDic.Add("StoreAge", (DateTime.Now.Year - store.OpenDate.Year).ToString());
            returnDic.Add("OpenDate", store.OpenDate.ToString("yyyy-MM-dd"));
            returnDic.Add("CurrentLeaseENDYear", storeInfo.StoreContractInfo.EndYear);
            returnDic.Add("AssetsManager", storeInfo.StoreDevelop.AssetMgrName);
            returnDic.Add("AssetsActor", storeInfo.StoreDevelop.AssetRepName);
            returnDic.Add("AssetsRep", closureInfoEntity.AssetActorNameENUS);
            returnDic.Add("ClosureType", string.IsNullOrEmpty(closureInfoEntity.ClosureTypeNameENUS) ? " " : closureInfoEntity.ClosureTypeNameENUS);
            returnDic.Add("LandlordName", string.IsNullOrEmpty(closureInfoEntity.LandlordName) ? " " : closureInfoEntity.LandlordName);
            if (storeInfo.StoreContractInfo != null)
            {
                returnDic.Add("LeaseExpireDate", storeInfo.StoreContractInfo.EndDate.Value.ToString("yyyy-MM-dd"));
            }
            else
            {
                returnDic.Add("LeaseExpireDate", " ");
            }
            if (closureInfoEntity.ActualCloseDate != null)
            {
                string closureDate = closureInfoEntity.ActualCloseDate.Value.ToString("yyyy-MM-dd");
                returnDic.Add("ClosureDate", string.IsNullOrEmpty(closureDate) ? " " : closureDate);
                returnDic.Add("CloseDate", string.IsNullOrEmpty(closureDate) ? " " : closureDate);
            }
            var packageInfo = ClosurePackage.Get(this.ProjectId);

            returnDic.Add("OriginalCFNPV", packageInfo.OriginalCFNPV.HasValue ? DataConverter.ToMoney(packageInfo.OriginalCFNPV.Value) : " ");

            var closureToolEntity = ClosureTool.Get(this.ProjectId);

            if (closureToolEntity != null)
            {
                returnDic.Add("TotalOneOffCosts", closureToolEntity.TotalOneOffCosts.HasValue ? DataConverter.ToMoney(closureToolEntity.TotalOneOffCosts.Value) : string.Empty);
                returnDic.Add("Compensation", closureToolEntity.Compensation.HasValue ? DataConverter.ToMoney(closureToolEntity.Compensation.Value).ToString() : " ");
            }
            returnDic.Add("NetOperatingIncome",
                          packageInfo.NetOperatingIncome.HasValue ? DataConverter.ToMoney(packageInfo.NetOperatingIncome.Value) : " ");
            returnDic.Add("Relocation", closureInfoEntity.RelocationNameENUS);
            returnDic.Add("RelocatedPipelineID",
                          packageInfo.RelocationPipelineID.HasValue ? packageInfo.RelocationPipelineID.ToString() : " ");
            returnDic.Add("PipelineName", packageInfo.PipelineName);
            returnDic.Add("NewSiteNetCFNPV", packageInfo.NewSiteNetCFNPV.HasValue ? DataConverter.ToMoney(packageInfo.NewSiteNetCFNPV.Value) : " ");
            returnDic.Add("OtherCFNPV", packageInfo.OtherCFNPV.HasValue ? DataConverter.ToMoney(packageInfo.OtherCFNPV.Value) : string.Empty);
            returnDic.Add("NetGain", packageInfo.NetGain.HasValue ? DataConverter.ToMoney(packageInfo.NetGain.Value) : " ");
            returnDic.Add("ReasonDescription", string.IsNullOrEmpty(packageInfo.ReasonDescriptionForNegativeNetGain) ? " " : packageInfo.ReasonDescriptionForNegativeNetGain);

            return(returnDic);
        }
コード例 #16
0
        public static TempClosureMemo GetTempClosureMemo(string projectId)
        {
            var memo = FirstOrDefault(e => e.ProjectId.Equals(projectId));

            if (memo == null)
            {
                memo           = new TempClosureMemo();
                memo.ProjectId = projectId;
                var eac = new EstimatedVsActualConstruction();
                if (projectId.ToLower().IndexOf("rebuild") >= 0)
                {
                    var rbdInfo = new RebuildInfo();
                    rbdInfo = rbdInfo.GetRebuildInfo(projectId);
                    var store = StoreBasicInfo.GetStore(rbdInfo.USCode);
                    eac = eac.GetEAC(rbdInfo.Id);
                    if (rbdInfo != null)
                    {
                        memo.ClosureDate = rbdInfo.TempClosureDate;
                    }
                    if (store != null)
                    {
                        memo.RegionCode     = store.StoreBasicInfo.RegionCode;
                        memo.RegionNameENUS = store.StoreBasicInfo.RegionENUS;
                        memo.RegionNameZHCN = store.StoreBasicInfo.RegionZHCN;

                        memo.MarketCode     = store.StoreBasicInfo.MarketCode;
                        memo.MarketNameENUS = store.StoreBasicInfo.MarketENUS;
                        memo.MarketNameZHCN = store.StoreBasicInfo.MarketZHCN;

                        memo.ProvinceNameENUS = store.StoreBasicInfo.ProvinceENUS;
                        memo.ProvinceNameZHCN = store.StoreBasicInfo.ProvinceZHCN;

                        memo.CityCode     = store.StoreBasicInfo.CityCode;
                        memo.CityNameENUS = store.StoreBasicInfo.CityENUS;
                        memo.CityNameZHCN = store.StoreBasicInfo.CityZHCN;

                        memo.StoreNameENUS = store.StoreBasicInfo.NameENUS;
                        memo.StoreNameZHCN = store.StoreBasicInfo.NameZHCN;

                        memo.StoreAddressENUS = store.StoreBasicInfo.AddressENUS;
                        memo.StoreAddressZHCN = store.StoreBasicInfo.AddressZHCN;

                        memo.USCode   = store.StoreBasicInfo.StoreCode;
                        memo.OpenDate = store.StoreBasicInfo.OpenDate;
                    }
                }
                else if (projectId.ToLower().IndexOf("reimage") >= 0)
                {
                    var rmgInfo = ReimageInfo.GetReimageInfo(projectId);
                    var store   = StoreBasicInfo.GetStore(rmgInfo.USCode);
                    eac = eac.GetEAC(rmgInfo.Id);
                    memo.ClosureDate = DateTime.Now;
                    if (store != null)
                    {
                        memo.RegionCode     = store.StoreBasicInfo.RegionCode;
                        memo.RegionNameENUS = store.StoreBasicInfo.RegionENUS;
                        memo.RegionNameZHCN = store.StoreBasicInfo.RegionZHCN;

                        memo.MarketCode     = store.StoreBasicInfo.MarketCode;
                        memo.MarketNameENUS = store.StoreBasicInfo.MarketENUS;
                        memo.MarketNameZHCN = store.StoreBasicInfo.MarketZHCN;

                        memo.ProvinceNameENUS = store.StoreBasicInfo.ProvinceENUS;
                        memo.ProvinceNameZHCN = store.StoreBasicInfo.ProvinceZHCN;

                        memo.CityCode     = store.StoreBasicInfo.CityCode;
                        memo.CityNameENUS = store.StoreBasicInfo.CityENUS;
                        memo.CityNameZHCN = store.StoreBasicInfo.CityZHCN;

                        memo.StoreNameENUS = store.StoreBasicInfo.NameENUS;
                        memo.StoreNameZHCN = store.StoreBasicInfo.NameZHCN;

                        memo.StoreAddressENUS = store.StoreBasicInfo.AddressENUS;
                        memo.StoreAddressZHCN = store.StoreBasicInfo.AddressZHCN;

                        memo.USCode   = store.StoreBasicInfo.StoreCode;
                        memo.OpenDate = store.StoreBasicInfo.OpenDate;
                    }
                }
                memo.Save();
            }
            return(memo);
        }
コード例 #17
0
ファイル: RenewalPackage.cs プロジェクト: XiaoYaTech/Demo
        public Dictionary <string, string> GetPrintTemplateFields()
        {
            var project       = ProjectInfo.Get(this.ProjectId, FlowCode.Renewal_Package);
            var storeBasic    = StoreBasicInfo.GetStorInfo(project.USCode);
            var storeContract = StoreContractInfo.Search(c => c.StoreCode == project.USCode).OrderByDescending(c => c.CreatedTime).FirstOrDefault();
            var info          = RenewalInfo.Get(ProjectId);
            var flowInfo      = FlowInfo.Get(FlowCode.Renewal);
            var analysis      = RenewalAnalysis.Get(this.AnalysisId.Value) ?? new RenewalAnalysis();
            var finOutput     = RenewalToolFinMeasureOutput.GetByToolId(this.ToolId.Value);
            Dictionary <string, string> templateFileds = new Dictionary <string, string>();

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

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

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

            return(templateFileds);
        }
コード例 #18
0
ファイル: ReimageSummary.cs プロジェクト: XiaoYaTech/Demo
        public StoreProfitabilityAndLeaseInfo GetStore(string projectId)
        {
            string pageType       = "";
            var    store          = new StoreProfitabilityAndLeaseInfo();
            var    reimageSummary = FirstOrDefault(e => e.ProjectId == projectId && e.IsHistory == false);

            if (reimageSummary != null)
            {
                store =
                    StoreProfitabilityAndLeaseInfo.FirstOrDefault(e => e.RefId == reimageSummary.Id);
            }
            if (store != null)
            {
                if (store.Id != 0)
                {
                    pageType = "save";
                }
            }
            if (pageType == "")
            {
                //var resultStoreAllInfo = storeBll.GetStoreDetailsByEID(eid, usCode);

                var reimageInfo    = ReimageInfo.FirstOrDefault(e => e.ProjectId == projectId);
                var storeBasicInfo = StoreBasicInfo.FirstOrDefault(e => e.StoreCode == reimageInfo.USCode);
                //var storeContractInfo = StoreContractInfo.FirstOrDefault(e => e.StoreCode == reimageInfo.USCode);
                //int Year = 0;
                //if (storeContractInfo != null)
                //{

                //    if (storeContractInfo.EndDate != null)
                //    {
                //        DateTime dtNow = DateTime.Now;
                //        Year = int.Parse(storeContractInfo.EndDate.ToString().Split('/')[2].Substring(0, 4)) - dtNow.Year;
                //    }
                //}
                //var stFinanceData =
                //   Mcdonalds.AM.DataAccess.DataSync_LDW_AM_STFinanceData.OrderByDescending(e => e.FinanceYear == DateTime.Now.Year.ToString(),
                //       e => e.FinanceMonth).FirstOrDefault();
                //if (stFinanceData == null)
                //{
                //    throw new Exception("Could not get the latest finance month data!");
                //}
                //var latestMonth = stFinanceData.FinanceMonth;
                //var data = Mcdonalds.AM.DataAccess.DataSync_LDW_AM_STFinanceData.FirstOrDefault(e => e.FinanceYear == DateTime.Now.Year.ToString() && e.FinanceMonth == latestMonth && e.UsCode == stFinanceData.UsCode);

                //store.AsOf =DateTime.Parse(DateTime.Now.Year + "/" + latestMonth + "/01");
                //store.TTMSales = data.Total_Sales_TTM.As<decimal>();
                //store.TTMSOIPercent = data.SOIPct_TTM.As<decimal>();
                if (store == null)
                {
                    store = new StoreProfitabilityAndLeaseInfo();
                }
                DateTime?dt = storeBasicInfo.ReImageDate;
                if (dt != null)
                {
                    if (dt.ToString().Substring(0, 8) == "1/1/1900")
                    {
                        dt = null;
                    }
                }
                store.LastRemodelDate = dt;
                //store.RemainingLeaseYears = Year;
            }
            return(store);
        }
コード例 #19
0
        private static RenewalAnalysisStoreInfo PrepareStoreInfo(string projectId, string usCode)
        {
            var store         = StoreBasicInfo.GetStorInfo(usCode);
            var storeMMInfo   = StoreMMInfo.Get(usCode);
            var storeContract = StoreContractInfo.Get(usCode);
            var ta            = StoreSTLocation.GetStoreSTLocation(usCode);
            var tool          = RenewalTool.Get(projectId);
            var finOutput     = RenewalToolFinMeasureOutput.GetByToolId(tool.Id) ?? new RenewalToolFinMeasureOutput();
            var consInfo      = RenewalConsInfo.Get(projectId);
            var toolWriteOff  = RenewalToolWriteOffAndReinCost.Get(projectId, tool.Id);
            var floors        = string.Join("/", new[] {
                string.Join(",", new[] {
                    ta.Floor1,
                    ta.Floor2,
                    ta.Floor3,
                    ta.Floor4,
                    ta.Floor5
                }.Where(e => !string.IsNullOrEmpty(e)).ToArray()),
                string.Join(",", new[] {
                    ta.FrontCounterFloor1,
                    ta.FrontCounterFloor2
                }.Where(e => !string.IsNullOrEmpty(e)).ToArray())
            }.Where(e => !string.IsNullOrEmpty(e)).ToArray());

            var seats = string.Join("/", new[] {
                new[] { ta.Seats1, ta.Seats2, ta.Seats3, ta.Seats4, ta.Seats5, ta.FrontCounterSeats }.Select(e => {
                    var val = 0;
                    int.TryParse(e, out val);
                    return(val);
                }).Sum(),
                string.IsNullOrEmpty(ta.OutsideSeats)?0:int.Parse(ta.OutsideSeats)
            });

            var beTypes = string.Join(",", StoreBEInfo.Search(e => e.StoreCode == usCode && e.BETypeName != "FC" && e.BETypeName != "DT").Select(e => e.BETypeName).ToArray());

            var leaseTenureAndTerm = string.Concat(storeContract.LeasePurchaseTerm, " years,from ",
                                                   storeContract.StartDate.HasValue ? storeContract.StartDate.Value.ToString("yyyy-MM-dd") : " / ",
                                                   "to",
                                                   storeContract.EndDate.HasValue ? storeContract.EndDate.Value.ToString("yyyy-MM-dd") : " / "
                                                   );

            return(new RenewalAnalysisStoreInfo
            {
                UsCode = store.StoreCode,
                NameZHCN = store.NameZHCN,
                NameENUS = store.NameENUS,
                MinimarketPriority = storeMMInfo.Priority,
                TADesrability = storeMMInfo.Desirability,
                SitePortfolioType = storeMMInfo.PortfolioTypeName,
                SiteRerating = storeMMInfo.LocationRatingPP,
                LeasedArea = storeContract.TotalLeasedArea,
                OperationSize = ta.TotalArea,
                Floors = floors,
                Seats = seats,
                BEType = beTypes,
                LeaseTenureAndTerm = leaseTenureAndTerm,
                FreeRentalPeriod = storeContract.FreeRentalPeriod,
                RentStructure = storeContract.RentStructure,
                DRMFLastTY = finOutput.AnnualRentExpenseLY,
                DRMFLastTYSales = finOutput.RentAsProdSalesLY,
                SRMFLastTY = finOutput.AnnualRentExpenseYr1,
                SRMFLastTYSales = finOutput.RentAsProdSalesYr1,
                SRMF1stTY = finOutput.AnnualRentExpenseAvg,
                SRMF1stTYSales = finOutput.RentAsProdSalesAvg,
                AnnualSOILastTY = finOutput.SOIProdSalesLY,
                AnnualSOIAvg = finOutput.SOIProdSalesAvg,
                CashROIAvg = finOutput.CashROIAvg,
                CashROILastTY = finOutput.CashROILY,
                OriginalInvestment = (toolWriteOff.REII + toolWriteOff.LHIII + toolWriteOff.ESSDII).ToString(),
                NBV = (toolWriteOff.RENBV + toolWriteOff.LHINBV + toolWriteOff.ESSDNBV).ToString(),
                AdditionalInvestmentCost = (toolWriteOff.RECost + toolWriteOff.LHICost + toolWriteOff.ESSDCost).ToString(),
                ExclusivityClause = storeContract.ExclusivityClause,
                McDsEarlyTerminationRight = storeContract.WithEarlyTerminationClause == null || storeContract.WithEarlyTerminationClause == 0 ? "N" : "Y",
                LandlordEntity = storeContract.PartyAFullName,
                LastRemodeling = store.ReImageDate.HasValue ? store.ReImageDate.Value.ToString("yyyy-MM-dd") : ""
            });
        }
コード例 #20
0
ファイル: ReimageSummary.cs プロジェクト: XiaoYaTech/Demo
        public Attachment GenerateAttachment(out string filePath)
        {
            var info = ReimageInfo.FirstOrDefault(e => e.ProjectId == this.ProjectId);

            _refId = GetRefId(this.ProjectId);
            var    storeInfo        = StoreBasicInfo.GetStorInfo(info.USCode);
            string templateFileName = string.Concat(SiteFilePath.Template_DIRECTORY, "/", SiteFilePath.Reimage_Summary_Template);
            string fileName         = HttpContext.Current.Server.MapPath(string.Format("~/UploadFiles/{0}.xlsx", Guid.NewGuid()));
            var    extetion         = Path.GetExtension(fileName);
            var    internalName     = Path.GetFileName(fileName);

            File.Copy(templateFileName, fileName);
            FileInfo fileInfo = new FileInfo(fileName);
            ExcelDataInputDirector excelDirector = new ExcelDataInputDirector(fileInfo, ExcelDataInputType.ReimageSummary);
            ExcelInputDTO          excelDto      = new ExcelInputDTO();

            excelDto.USCode    = info.USCode;
            excelDto.ProjectId = info.ProjectId;
            excelDirector.Input(excelDto);
            var  att       = Attachment.FirstOrDefault(e => e.RefTableID == this.Id.ToString() && e.TypeCode == "ReimageSummary");
            bool hasAttach = true;

            if (att == null)
            {
                hasAttach = false;
                att       = new Attachment();
                att.ID    = Guid.NewGuid();
            }

            att.TypeCode        = "ReimageSummary";
            att.RefTableID      = this.Id.ToString();
            att.RefTableName    = "ReimageSummary";
            att.Name            = "Reimage Summary";
            att.Extension       = extetion;
            att.RelativePath    = "/";
            att.InternalName    = internalName;
            att.ContentType     = "application/vnd.ms-excel";
            att.Length          = (int)fileInfo.Length;
            att.CreatorID       = ClientCookie.UserCode;
            att.CreatorNameENUS = ClientCookie.UserNameENUS;
            att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
            att.CreateTime      = DateTime.Now;
            att.RequirementId   = new Guid("5647BDBB-5B5F-47CD-9AD2-3E35A16DD303");
            if (hasAttach)
            {
                att.Update();
            }
            else
            {
                att.Add();
            }
            //fileInfo = new FileInfo(fileName);
            //var importDirector = new ExcelDataImportDirector(fileInfo, ExcelDataImportType.FinancialPreAnalysis);
            //importDirector.FillEntityEvent += FillFinancialPreAnalysisEntity;
            //using (var scope = new TransactionScope())
            //{
            //    importDirector.ParseAndImport();
            //    scope.Complete();
            //}

            filePath = fileName;
            return(att);
        }
コード例 #21
0
ファイル: TempClosureInfo.cs プロジェクト: XiaoYaTech/Demo
        public static void Create(PostCreateWorkflow <TempClosureInfo> tempClosure)
        {
            using (TransactionScope tranScope = new TransactionScope())
            {
                var store = StoreBasicInfo.GetStorInfo(tempClosure.Entity.USCode);
                tempClosure.Entity.Id = Guid.NewGuid();
                tempClosure.Entity.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Entity.CreateTime        = DateTime.Now;

                tempClosure.Entity.StoreNameENUS = store.NameENUS;
                tempClosure.Entity.StoreNameZHCN = store.NameZHCN;

                tempClosure.Entity.AssetRepAccount  = tempClosure.Team.AssetRep.UserAccount;
                tempClosure.Entity.AssetRepNameENUS = tempClosure.Team.AssetRep.UserNameENUS;
                tempClosure.Entity.AssetRepNameZHCN = tempClosure.Team.AssetRep.UserNameZHCN;

                tempClosure.Entity.AssetActorAccount  = tempClosure.Team.AssetActor.UserAccount;
                tempClosure.Entity.AssetActorNameENUS = tempClosure.Team.AssetActor.UserNameENUS;
                tempClosure.Entity.AssetActorNameZHCN = tempClosure.Team.AssetActor.UserNameZHCN;

                tempClosure.Entity.FinanceAccount  = tempClosure.Team.Finance.UserAccount;
                tempClosure.Entity.FinanceNameENUS = tempClosure.Team.Finance.UserNameENUS;
                tempClosure.Entity.FinanceNameZHCN = tempClosure.Team.Finance.UserNameZHCN;

                tempClosure.Entity.PMAccount  = tempClosure.Team.PM.UserAccount;
                tempClosure.Entity.PMNameENUS = tempClosure.Team.PM.UserNameENUS;
                tempClosure.Entity.PMNameZHCN = tempClosure.Team.PM.UserNameZHCN;

                tempClosure.Entity.LegalAccount  = tempClosure.Team.Legal.UserAccount;
                tempClosure.Entity.LegalNameENUS = tempClosure.Team.Legal.UserNameENUS;
                tempClosure.Entity.LegalNameZHCN = tempClosure.Team.Legal.UserNameZHCN;

                tempClosure.Entity.AssetManagerAccount  = tempClosure.Team.AssetMgr.UserAccount;
                tempClosure.Entity.AssetManagerNameENUS = tempClosure.Team.AssetMgr.UserNameENUS;
                tempClosure.Entity.AssetManagerNameZHCN = tempClosure.Team.AssetMgr.UserNameZHCN;

                tempClosure.Entity.CMAccount  = tempClosure.Team.CM.UserAccount;
                tempClosure.Entity.CMNameENUS = tempClosure.Team.CM.UserNameENUS;
                tempClosure.Entity.CMNameZHCN = tempClosure.Team.CM.UserNameZHCN;

                var projectId = ProjectInfo.CreateMainProject(FlowCode.TempClosure, tempClosure.Entity.USCode, NodeCode.Start, tempClosure.Entity.CreateUserAccount);
                tempClosure.Entity.ProjectId = projectId;
                Add(tempClosure.Entity);

                List <ProjectUsers> projectUsers = new List <ProjectUsers>();

                tempClosure.Team.AssetRep.Id                = Guid.NewGuid();
                tempClosure.Team.AssetRep.ProjectId         = projectId;
                tempClosure.Team.AssetRep.CreateDate        = DateTime.Now;
                tempClosure.Team.AssetRep.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Team.AssetRep.RoleCode          = ProjectUserRoleCode.AssetRep;
                tempClosure.Team.AssetRep.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetRep, SystemLanguage.ENUS);
                tempClosure.Team.AssetRep.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetRep, SystemLanguage.ZHCN);
                projectUsers.Add(tempClosure.Team.AssetRep);

                tempClosure.Team.AssetActor.Id                = Guid.NewGuid();
                tempClosure.Team.AssetActor.ProjectId         = projectId;
                tempClosure.Team.AssetActor.CreateDate        = DateTime.Now;
                tempClosure.Team.AssetActor.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Team.AssetActor.RoleCode          = ProjectUserRoleCode.AssetActor;
                tempClosure.Team.AssetActor.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetActor, SystemLanguage.ENUS);
                tempClosure.Team.AssetActor.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetActor, SystemLanguage.ZHCN);
                projectUsers.Add(tempClosure.Team.AssetActor);

                tempClosure.Team.Finance.Id                = Guid.NewGuid();
                tempClosure.Team.Finance.ProjectId         = projectId;
                tempClosure.Team.Finance.CreateDate        = DateTime.Now;
                tempClosure.Team.Finance.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Team.Finance.RoleCode          = ProjectUserRoleCode.Finance;
                tempClosure.Team.Finance.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Finance, SystemLanguage.ENUS);
                tempClosure.Team.Finance.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Finance, SystemLanguage.ZHCN);
                projectUsers.Add(tempClosure.Team.Finance);

                tempClosure.Team.PM.Id                = Guid.NewGuid();
                tempClosure.Team.PM.ProjectId         = projectId;
                tempClosure.Team.PM.CreateDate        = DateTime.Now;
                tempClosure.Team.PM.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Team.PM.RoleCode          = ProjectUserRoleCode.PM;
                tempClosure.Team.PM.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.PM, SystemLanguage.ENUS);
                tempClosure.Team.PM.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.PM, SystemLanguage.ZHCN);
                projectUsers.Add(tempClosure.Team.PM);

                tempClosure.Team.Legal.Id                = Guid.NewGuid();
                tempClosure.Team.Legal.ProjectId         = projectId;
                tempClosure.Team.Legal.CreateDate        = DateTime.Now;
                tempClosure.Team.Legal.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Team.Legal.RoleCode          = ProjectUserRoleCode.Legal;
                tempClosure.Team.Legal.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Legal, SystemLanguage.ENUS);
                tempClosure.Team.Legal.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Legal, SystemLanguage.ZHCN);
                projectUsers.Add(tempClosure.Team.Legal);

                tempClosure.Team.AssetMgr.Id                = Guid.NewGuid();
                tempClosure.Team.AssetMgr.ProjectId         = projectId;
                tempClosure.Team.AssetMgr.CreateDate        = DateTime.Now;
                tempClosure.Team.AssetMgr.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Team.AssetMgr.RoleCode          = ProjectUserRoleCode.AssetManager;
                tempClosure.Team.AssetMgr.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetManager, SystemLanguage.ENUS);
                tempClosure.Team.AssetMgr.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetManager, SystemLanguage.ZHCN);
                projectUsers.Add(tempClosure.Team.AssetMgr);

                tempClosure.Team.CM.Id                = Guid.NewGuid();
                tempClosure.Team.CM.ProjectId         = projectId;
                tempClosure.Team.CM.CreateDate        = DateTime.Now;
                tempClosure.Team.CM.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Team.CM.RoleCode          = ProjectUserRoleCode.CM;
                tempClosure.Team.CM.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.CM, SystemLanguage.ENUS);
                tempClosure.Team.CM.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.CM, SystemLanguage.ZHCN);
                projectUsers.Add(tempClosure.Team.CM);
                ProjectUsers.Add(projectUsers.ToArray());

                tempClosure.Viewers.ForEach(v =>
                {
                    v.Id                = Guid.NewGuid();
                    v.ProjectId         = projectId;
                    v.CreateDate        = DateTime.Now;
                    v.CreateUserAccount = ClientCookie.UserCode;
                    v.RoleCode          = ProjectUserRoleCode.View;
                });
                ProjectUsers.Add(tempClosure.Viewers.ToArray());
                //tempClosure.NecessaryViewers.ForEach(v =>
                //{
                //    v.Id = Guid.NewGuid();
                //    v.ProjectId = projectId;
                //    v.CreateDate = DateTime.Now;
                //    v.CreateUserAccount = ClientCookie.UserCode;
                //    v.RoleCode = ProjectUserRoleCode.View;
                //});
                //ProjectUsers.Add(tempClosure.NecessaryViewers.ToArray());

                Remind.SendRemind(projectId, FlowCode.TempClosure, projectUsers);
                ProjectInfo.CreateSubProject(FlowCode.TempClosure_LegalReview, projectId, tempClosure.Entity.USCode, NodeCode.Start, ClientCookie.UserCode);
                TempClosureLegalReview.Create(projectId);
                ProjectInfo.CreateSubProject(FlowCode.TempClosure_ClosurePackage, projectId, tempClosure.Entity.USCode, NodeCode.Start, ClientCookie.UserCode);
                TempClosurePackage.Create(projectId);
                ProjectInfo.CreateSubProject(FlowCode.TempClosure_ClosureMemo, projectId, tempClosure.Entity.USCode, NodeCode.Start, ClientCookie.UserCode);
                ProjectInfo.CreateSubProject(FlowCode.TempClosure_ReopenMemo, projectId, tempClosure.Entity.USCode, NodeCode.Start, ClientCookie.UserCode);

                string taskUrl = TaskWork.BuildUrl(FlowCode.TempClosure_LegalReview, projectId, "");
                string title   = TaskWork.BuildTitle(projectId, store.NameZHCN, store.NameENUS);
                TaskWork.SendTask(projectId, title, store.StoreCode, taskUrl, tempClosure.Team.AssetActor, FlowCode.TempClosure, FlowCode.TempClosure_LegalReview, "Start");
                ProjectNode.GenerateOnCreate(FlowCode.TempClosure, projectId);
                tranScope.Complete();
            }
        }
コード例 #22
0
ファイル: V_AM_DL_Reimage.cs プロジェクト: XiaoYaTech/Demo
        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();
            }
        }
コード例 #23
0
ファイル: ClosureTool.cs プロジェクト: XiaoYaTech/Demo
        public override string Edit()
        {
            if (!PreEdit(this.ProjectId))
            {
                return("");
            }
            var closureEntity = ClosureInfo.GetByProjectId(this.ProjectId);
            var store         = StoreBasicInfo.GetStorInfo(closureEntity.USCode);
            var taskWork      = new TaskWork();
            var source        = FlowInfo.Get(FlowCode.Closure);
            var taskType      = FlowInfo.Get(FlowCode.Closure_ClosureTool);

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

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

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

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

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

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

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

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

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

            var newList = new List <Attachment>();

            foreach (var att in attList)
            {
                var newAtt = objCopy.AutoCopy(att);
                newAtt.RefTableID = newEntity.Id.ToString();
                newAtt.ID         = Guid.NewGuid();
                newList.Add(newAtt);
            }
            Attachment.AddList(newList);
            return(taskWork.Url);
        }
コード例 #24
0
        public Dictionary <string, string> GetPrintTemplateFields()
        {
            var project            = ProjectInfo.Get(this.ProjectId, FlowCode.TempClosure_ClosurePackage);
            var storeBasic         = StoreBasicInfo.FirstOrDefault(s => s.StoreCode == project.USCode);
            var storeContract      = StoreContractInfo.Get(storeBasic.StoreCode);
            var assetMgr           = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetManager);
            var assetActor         = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
            var assetRep           = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetRep);
            var tempClosurePackage = TempClosurePackage.Get(ProjectId);
            var tempClosure        = TempClosureInfo.Get(ProjectId);
            Dictionary <string, string> templateFileds = new Dictionary <string, string>();

            templateFileds.Add("WorkflowName", SystemCode.Instance.GetCodeName(FlowCode.TempClosure, ClientCookie.Language));
            templateFileds.Add("ProjectID", ProjectId);
            templateFileds.Add("USCode", storeBasic.StoreCode);
            templateFileds.Add("Region", storeBasic.Region);
            templateFileds.Add("StoreNameEN", storeBasic.NameENUS);
            templateFileds.Add("Market", storeBasic.Market);
            templateFileds.Add("City", storeBasic.CityZHCN);
            templateFileds.Add("StoreNameCN", storeBasic.NameZHCN);
            templateFileds.Add("StoreAge", Math.Floor((DateTime.Now - storeBasic.OpenDate).TotalDays / 365D).ToString());
            templateFileds.Add("OpenDate", storeBasic.OpenDate.ToString("yyyy-MM-dd"));
            var storeInfo = StoreBasicInfo.GetStore(project.USCode);

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

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

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

            return(templateFileds);
        }
コード例 #25
0
        public static RenewalGBMemo GetGBMemo(string projectId, string entityId = "")
        {
            var memo = (string.IsNullOrEmpty(entityId) ?
                        FirstOrDefault(e => e.ProjectId.Equals(projectId) && !e.IsHistory)
                : FirstOrDefault(e => e.Id.ToString().Equals(entityId))) ?? new RenewalGBMemo();

            memo.ProjectId = projectId;

            var rnInfo = RenewalInfo.Get(projectId);

            memo.Info   = rnInfo;
            memo.UsCode = rnInfo.USCode;

            memo.Store = StoreBasicInfo.GetStore(memo.UsCode);

            if (memo.Id == Guid.Empty)
            {
                memo.IsClosed      = (memo.Store.StoreBasicInfo.statusName == "Closed");
                memo.IsInOperation = false;
                var consInfo = new RenewalConsInfo();
                memo.ReinvestInfo = consInfo.GetReinvestmentBasicInfo(projectId);
                if (memo.ReinvestInfo != null)
                {
                    if ((memo.ReinvestInfo.NewAttachedKiosk.HasValue && memo.ReinvestInfo.NewAttachedKiosk.Value) ||
                        (memo.ReinvestInfo.NewRemoteKiosk.HasValue && memo.ReinvestInfo.NewRemoteKiosk.Value))
                    {
                        memo.IsKiosk = true;
                    }
                    memo.IsMcCafe = memo.ReinvestInfo.NewMcCafe.HasValue && memo.ReinvestInfo.NewMcCafe.Value;
                    memo.IsMDS    = memo.ReinvestInfo.NewMDS.HasValue && memo.ReinvestInfo.NewMDS.Value;
                    memo.Is24Hour = memo.ReinvestInfo.NewTwientyFourHour.HasValue &&
                                    memo.ReinvestInfo.NewTwientyFourHour.Value;
                    memo.GBDate = memo.ReinvestInfo.GBDate;
                    memo.ConstCompletionDate = memo.ReinvestInfo.ConsCompletionDate;
                    memo.ReopenDate          = memo.ReinvestInfo.ReopenDate;
                }
                memo.Save();
            }
            else
            {
                var projectInfo = ProjectInfo.FirstOrDefault(e => e.ProjectId == projectId &&
                                                             e.FlowCode == FlowCode.Renewal_GBMemo);

                if (projectInfo != null)
                {
                    if (ClientCookie.UserCode.Equals(rnInfo.PMAccount))
                    {
                        var isFlowFlinshed =
                            TaskWork.Any(e =>
                                         e.RefID == projectId && e.TypeCode == FlowCode.Renewal_GBMemo &&
                                         e.Status == TaskWorkStatus.K2ProcessApproved && e.ProcInstID == memo.ProcInstID);
                        var isExistTask = TaskWork.Any(e => e.RefID == projectId &&
                                                       e.TypeCode == FlowCode.Renewal_GBMemo &&
                                                       e.Status == TaskWorkStatus.UnFinish &&
                                                       e.ReceiverAccount == ClientCookie.UserCode &&
                                                       (e.ActivityName == WFMajorLeaseLegalReview.Act_Originator || e.ActivityName == WFMajorLeaseLegalReview.Act_Start));
                        memo.IsShowEdit   = isFlowFlinshed;
                        memo.IsShowRecall = !isFlowFlinshed && !isExistTask;
                    }
                }
            }
            //if (ClientCookie.UserCode.Equals(rnInfo.PMAccount))
            //    memo.IsShowSave = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_GBMemo);
            PopulateAppUsers(memo);
            return(memo);
        }
コード例 #26
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);
        }