Ejemplo n.º 1
0
        private void SendEmail(string ProjectId, string SerialNumber, int?ProcInstID, string receiverUserCode)
        {
            var project = ProjectInfo.Get(ProjectId, FlowCode.Reimage_ConsInvtChecking);

            var storeBasic = StoreBasicInfo.FirstOrDefault(s => s.StoreCode == project.USCode);

            using (EmailServiceClient emailClient = new EmailServiceClient())
            {
                EmailMessage email = new EmailMessage();
                //邮件模板中的数据
                Dictionary <string, string> bodyValues = new Dictionary <string, string>();
                //邮件内容中的键值对
                bodyValues.Add("ApproverName", ClientCookie.UserNameENUS);
                bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人
                bodyValues.Add("WorkflowName", "Reimage");
                bodyValues.Add("StoreCode", storeBasic.StoreCode);
                bodyValues.Add("StoreName", storeBasic.NameENUS + @" \ " + storeBasic.NameZHCN);
                bodyValues.Add("WorkflowName", Constants.Reimage_ConsInvtChecking); ////--流程名称
                bodyValues.Add("ProjectName", Constants.Reimage);                   //项目名称
                var viewPage = string.Format("{0}/Reimage/Main#/ConsInvtChecking/Process/Approval?projectId={1}&SN={2}&ProcInstID={3}",
                                             HttpContext.Current.Request.Url.AbsolutePath, ProjectId, SerialNumber, ProcInstID);
                bodyValues.Add("FormUrl", viewPage);
                email.EmailBodyValues = bodyValues;

                List <string> emailAddresses = Employee.Search(e => e.Code == receiverUserCode).Select(e => e.Mail).ToList();
                emailAddresses.Add("*****@*****.**");
                emailAddresses.Add("*****@*****.**");
                emailAddresses.Add("*****@*****.**");
                email.To = string.Join(";", emailAddresses);
                emailClient.SendNotificationEmail(email);
            }
        }
Ejemplo n.º 2
0
        public ActionResult StoreSTLicenseQuery(string _USCode)
        {
            List <StoreSTLicense> lsStoreSTLicense = new List <StoreSTLicense>();

            lsStoreSTLicense = StoreSTLicense.Search(o => o.StoreCode == _USCode).OrderBy(o => o.Title).ToList <StoreSTLicense>();

            if (lsStoreSTLicense.Count == 0)
            {
                var licenseList = new List <StoreSTLicense>();
                var store       = StoreBasicInfo.FirstOrDefault(i => i.StoreCode == _USCode);
                foreach (var dicItem in licenseDict)
                {
                    var storeLicense = new StoreSTLicense();
                    storeLicense.Id          = Guid.NewGuid();
                    storeLicense.StoreID     = store.StoreID;
                    storeLicense.StoreCode   = _USCode;
                    storeLicense.Title       = dicItem.Key;
                    storeLicense.CreatedTime = DateTime.Now;
                    storeLicense.DocType     = dicItem.Value;
                    licenseList.Add(storeLicense);
                }
                StoreSTLicense.Add(licenseList.ToArray());
                lsStoreSTLicense = licenseList;
            }

            string result = JsonConvert.SerializeObject(lsStoreSTLicense);

            return(Content(result));
        }
Ejemplo n.º 3
0
        public bool Add(MaterTrack materTrack)
        {
            using (TransactionScope tranScope = new TransactionScope())
            {
                materTrack.Id         = Guid.NewGuid();
                materTrack.CreateTime = DateTime.Now;
                MaterTrack.Add(materTrack);
                var project = ProjectInfo.Get(materTrack.WorkflowId, materTrack.WorkflowType);
                var store   = StoreBasicInfo.FirstOrDefault(s => s.StoreCode == project.USCode);
                var Codes   = materTrack.NodeType.Split('_');
                var url     = string.Format("/{0}/Main#/{1}/Process/View?projectId={2}", Codes[0], Codes[1], materTrack.WorkflowId);
                //if (Codes[0] == "Closure") //临时改动 只针对Closure,因为Closure 用的还是老的URL
                //{
                //    url = string.Format("/{0}/Main#/{0}/{1}/Process/View?projectId={2}", Codes[0], Codes[1], materTrack.WorkflowId);
                //}
                var title = TaskWork.BuildTitle(materTrack.WorkflowId, store.NameZHCN, store.NameENUS);
                switch (materTrack.TrackType)
                {
                case MaterTrackType.Rep:
                {
                    var actor = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == materTrack.WorkflowId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
                    TaskWork.SendTask(materTrack.WorkflowId, title, project.USCode, url, actor, materTrack.WorkflowType, materTrack.NodeType, "Start_MaterTrack_Rep");
                }
                break;

                case MaterTrackType.Feedback:
                {
                    var legal = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == materTrack.WorkflowId && pu.RoleCode == ProjectUserRoleCode.Legal);
                    TaskWork.Finish(t => t.RefID == materTrack.WorkflowId && t.SourceCode == materTrack.WorkflowType && t.TypeCode == materTrack.NodeType && t.ActivityName == "Start_MaterTrack_Rep" && t.Status == TaskWorkStatus.UnFinish);
                    if (TaskWork.Count(t => t.RefID == materTrack.WorkflowId && t.SourceCode == materTrack.WorkflowType && t.TypeCode == materTrack.NodeType && t.ActivityName == "Start_MaterTrack_Feedback" && t.Status == TaskWorkStatus.UnFinish) == 0)
                    {
                        TaskWork.SendTask(materTrack.WorkflowId, title, project.USCode, url, legal, materTrack.WorkflowType, materTrack.NodeType, "Start_MaterTrack_Feedback");
                    }
                }
                break;

                case MaterTrackType.Reply:
                {
                    var actor = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == materTrack.WorkflowId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
                    TaskWork.Finish(t => t.RefID == materTrack.WorkflowId && t.SourceCode == materTrack.WorkflowType && t.TypeCode == materTrack.NodeType && t.ActivityName == "Start_MaterTrack_Feedback" && t.Status == TaskWorkStatus.UnFinish);
                    if (TaskWork.Count(t => t.RefID == materTrack.WorkflowId && t.SourceCode == materTrack.WorkflowType && t.TypeCode == materTrack.NodeType && t.ActivityName == "Start_MaterTrack_Rep" && t.Status == TaskWorkStatus.UnFinish) == 0)
                    {
                        TaskWork.SendTask(materTrack.WorkflowId, title, project.USCode, url, actor, materTrack.WorkflowType, materTrack.NodeType, "Start_MaterTrack_Rep");
                    }
                }
                break;
                }
                tranScope.Complete();
                return(true);
            }
        }
Ejemplo n.º 4
0
        public IHttpActionResult GetStoreSTLocationInfo(string storeCode)
        {
            var entity = StoreSTLocation.GetStoreSTLocation(storeCode);

            if (entity != null)
            {
                var storeBasicInfo = StoreBasicInfo.FirstOrDefault(e => e.StoreCode == entity.StoreCode);
                if (storeBasicInfo != null)
                {
                    entity.StoreTypeName = storeBasicInfo.StoreTypeName;
                }
            }
            return(Ok(entity));
        }
Ejemplo n.º 5
0
        private void GenerateCover(string projectId, string refTableName)
        {
            string coverPath      = string.Empty;
            string coverName      = "Cover";
            string coverTempPath  = SiteFilePath.UploadFiles_DIRECTORY + "\\" + Guid.NewGuid() + ".xlsx";
            string coverExtention = Path.GetExtension(coverTempPath);

            switch (refTableName)
            {
            case "MajorLeaseChangePackage":
                coverPath = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.MajorLeaseChangeCove_Template;
                var majorLeaseChangePackage = MajorLeaseChangePackage.GetMajorPackageInfo(projectId);
                majorLeaseChangePackage.GenerateCoverEexcel(coverPath, coverTempPath);
                break;

            case "ReimagePackage":
                var rmgPackage = ReimagePackage.Get(projectId);
                if (rmgPackage == null)
                {
                    return;
                }
                if (!Attachment.Any(i => i.TypeCode == "Cover" && i.RefTableName == ReimagePackage.TableName && i.RefTableID.ToString() == rmgPackage.Id.ToString()))
                {
                    var reimageInfoEntity = ReimageInfo.GetReimageInfo(projectId);
                    //生成cover文件
                    coverPath = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.Store_Reimage_Cover_Template;
                    var store = StoreBasicInfo.FirstOrDefault(e => e.StoreCode == reimageInfoEntity.USCode);

                    File.Copy(coverPath, coverTempPath);
                    var excelOutputDirector = new ExcelDataInputDirector(new FileInfo(coverTempPath), ExcelDataInputType.ReimageCover);
                    var inputInfo           = new ExcelInputDTO
                    {
                        Region    = store.Region,
                        Province  = store.ProvinceENUS,
                        City      = store.CityENUS,
                        StoreName = store.NameENUS,
                        USCode    = reimageInfoEntity.USCode,
                        OpenDate  = store.OpenDate
                    };
                    excelOutputDirector.Input(inputInfo);

                    var coverItem = new Attachment();
                    coverItem.Name         = coverName + coverExtention;
                    coverItem.InternalName = Path.GetFileName(coverTempPath);
                    coverItem.RefTableName = ReimagePackage.TableName;
                    coverItem.RefTableID   = rmgPackage.Id.ToString();
                    coverItem.RelativePath = "//";
                    coverItem.Extension    = coverExtention;
                    coverItem.CreateTime   = DateTime.Now;

                    coverItem.TypeCode        = coverName;
                    coverItem.CreatorID       = ClientCookie.UserCode;
                    coverItem.RequirementId   = AttachmentRequirement.FirstOrDefault(e => e.FlowCode == FlowCode.Reimage_Package && e.NameENUS == "Cover").Id;
                    coverItem.CreatorNameENUS = ClientCookie.UserNameENUS;
                    coverItem.CreatorNameZHCN = ClientCookie.UserNameZHCN;

                    using (FileStream stream = new FileStream(coverTempPath, FileMode.Open))
                    {
                        coverItem.Length = (int)stream.Length;
                    }
                    Attachment.SaveSigleFile(coverItem);
                }
                break;

            case "TempClosurePackage":
                var tempClosurePackage = TempClosurePackage.Get(projectId);
                if (tempClosurePackage == null)
                {
                    return;
                }
                if (!Attachment.Any(i => i.TypeCode == "Cover" && i.RefTableName == tempClosurePackage.TableName && i.RefTableID.ToString() == tempClosurePackage.Id.ToString()))
                {
                    var tempClosureInfoEntity = TempClosureInfo.Get(projectId);
                    //生成cover文件
                    coverPath = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.Store_TempClosure_Cover_Template;
                    var store = StoreBasicInfo.FirstOrDefault(e => e.StoreCode == tempClosureInfoEntity.USCode);

                    File.Copy(coverPath, coverTempPath);
                    var excelOutputDirector = new ExcelDataInputDirector(new FileInfo(coverTempPath), ExcelDataInputType.TempClosureCover);
                    var inputInfo           = new ExcelInputDTO
                    {
                        StoreNameEN     = store.NameENUS,
                        USCode          = tempClosureInfoEntity.USCode,
                        City            = store.CityENUS,
                        Market          = store.MarketENUS,
                        ActualCloseDate = tempClosureInfoEntity.ActualTempClosureDate.ToString("yyyy-MM-dd")
                    };
                    excelOutputDirector.Input(inputInfo);

                    var coverItem = new Attachment();
                    coverItem.Name         = coverName + coverExtention;
                    coverItem.InternalName = Path.GetFileName(coverTempPath);
                    coverItem.RefTableName = tempClosurePackage.TableName;
                    coverItem.RefTableID   = tempClosurePackage.Id.ToString();
                    coverItem.RelativePath = "//";
                    coverItem.Extension    = coverExtention;
                    coverItem.CreateTime   = DateTime.Now;

                    coverItem.TypeCode  = coverName;
                    coverItem.CreatorID = ClientCookie.UserCode;
                    //coverItem.RequirementId = AttachmentRequirement.FirstOrDefault(e => e.FlowCode == FlowCode.TempClosure_ClosurePackage && e.NameENUS == "Cover").Id;
                    coverItem.CreatorNameENUS = ClientCookie.UserNameENUS;
                    coverItem.CreatorNameZHCN = ClientCookie.UserNameZHCN;

                    using (FileStream stream = new FileStream(coverTempPath, FileMode.Open))
                    {
                        coverItem.Length = (int)stream.Length;
                    }
                    Attachment.SaveSigleFile(coverItem);
                }
                break;

            case "ClosurePackage":
                var closurePackage = ClosurePackage.Get(projectId);
                if (closurePackage == null)
                {
                    return;
                }
                if (!Attachment.Any(i => i.TypeCode == "Cover" && i.RefTableName == ClosurePackage.TableName && i.RefTableID.ToString() == closurePackage.Id.ToString()))
                {
                    var closureInfoEntity = ClosureInfo.GetByProjectId(projectId);
                    //生成cover文件
                    coverPath = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.Store_Closure_Cover_Template;
                    var store = StoreBasicInfo.FirstOrDefault(e => e.StoreCode == closureInfoEntity.USCode);

                    File.Copy(coverPath, coverTempPath);
                    var excelOutputDirector = new ExcelDataInputDirector(new FileInfo(coverTempPath), ExcelDataInputType.ClosureCover);
                    var inputInfo           = new ExcelInputDTO
                    {
                        StoreNameEN     = store.NameENUS,
                        USCode          = closureInfoEntity.USCode,
                        City            = store.CityENUS,
                        Market          = store.MarketENUS,
                        ActualCloseDate = closureInfoEntity.ActualCloseDate.Value.ToString("yyyy-MM-dd")
                    };
                    excelOutputDirector.Input(inputInfo);

                    var coverItem = new Attachment();
                    coverItem.Name         = coverName + coverExtention;
                    coverItem.InternalName = Path.GetFileName(coverTempPath);
                    coverItem.RefTableName = ClosurePackage.TableName;
                    coverItem.RefTableID   = closurePackage.Id.ToString();
                    coverItem.RelativePath = "//";
                    coverItem.Extension    = coverExtention;
                    coverItem.CreateTime   = DateTime.Now;

                    coverItem.TypeCode  = coverName;
                    coverItem.CreatorID = ClientCookie.UserCode;
                    //coverItem.RequirementId = AttachmentRequirement.FirstOrDefault(e => e.FlowCode == FlowCode.TempClosure_ClosurePackage && e.NameENUS == "Cover").Id;
                    coverItem.CreatorNameENUS = ClientCookie.UserNameENUS;
                    coverItem.CreatorNameZHCN = ClientCookie.UserNameZHCN;

                    using (FileStream stream = new FileStream(coverTempPath, FileMode.Open))
                    {
                        coverItem.Length = (int)stream.Length;
                    }
                    Attachment.SaveSigleFile(coverItem);
                }
                break;
            }
        }
Ejemplo n.º 6
0
        public IHttpActionResult GetStoreProfitabilityAndLeaseInfo(string projectId, string pageType = "")
        {
            StoreProfitabilityAndLeaseInfo store = new StoreProfitabilityAndLeaseInfo();
            var reimageSummary = 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(Ok(store));
        }
Ejemplo n.º 7
0
        public override void Input(ExcelWorksheet worksheet, ExcelInputDTO inputInfo)
        {
            var projectInfo = ProjectInfo.FirstOrDefault(e => e.ProjectId == inputInfo.ProjectId);

            if (projectInfo == null)
            {
                throw new Exception("Cannot find the project info!");
            }
            var store = StoreBasicInfo.Search(e => e.StoreCode == projectInfo.USCode).FirstOrDefault();

            if (store == null)
            {
                throw new Exception("Cannot find Store info!");
            }

            var reimageSummary = BaseWFEntity.GetWorkflowEntity(inputInfo.ProjectId, FlowCode.Reimage_Summary) as ReimageSummary;

            if (reimageSummary == null)
            {
                throw new Exception("Cannot find Reimage Summary Info!");
            }
            var storeSTLocation = StoreSTLocation.GetStoreSTLocation(projectInfo.USCode);
            var storeLeaseInfo  = new StoreProfitabilityAndLeaseInfo();
            var reimageConsInfo = ReimageConsInfo.GetConsInfo(inputInfo.ProjectId);
            var reinvestment    = ReinvestmentBasicInfo.FirstOrDefault(e => e.ConsInfoID == reimageConsInfo.Id);

            if (reimageSummary != null)
            {
                storeLeaseInfo =
                    StoreProfitabilityAndLeaseInfo.FirstOrDefault(e => e.RefId == reimageSummary.Id);
                if (storeLeaseInfo != null)
                {
                    if (storeLeaseInfo.LastRemodelDate.HasValue && storeLeaseInfo.LastRemodelDate.Value.ToString("yyyy-MM-dd") != "1900-01-01")
                    {
                        worksheet.Cells["B43"].Value = storeLeaseInfo.LastRemodelDate;
                    }
                    worksheet.Cells["B44"].Value = storeLeaseInfo.RemainingLeaseYears;

                    worksheet.Cells["B46"].Value = storeLeaseInfo.TTMSOIPercent / 100;
                    worksheet.Cells["B47"].Value = storeLeaseInfo.AsOf;
                    worksheet.Cells["B48"].Value = reimageSummary.OperationRequirements;
                    var financial = FinancialPreanalysis.FirstOrDefault(e => e.RefId == reimageSummary.Id);
                    worksheet.Cells["B49"].Value = TryParseDecimal(financial.TotalSalesInc);
                    worksheet.Cells["B45"].Value = financial.TTMSales;
                    worksheet.Cells["B50"].Value = TryParseDecimal(financial.StoreCM) * 100 + "%";
                    worksheet.Cells["B51"].Value = financial.CurrentPriceTier;
                    worksheet.Cells["B52"].Value = string.IsNullOrEmpty(financial.SPTAR) ? 0 : financial.SPTAR.As <decimal>();
                    worksheet.Cells["B53"].Value = financial.PriceTierafterReimage;
                }
                //worksheet.Cells["E4"].Value = financial.MarginInc;
            }
            else
            {
                var reimageInfo       = ReimageInfo.FirstOrDefault(e => e.ProjectId == inputInfo.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;
                    }
                }

                DateTime?dt = storeBasicInfo.ReImageDate;
                if (dt != null)
                {
                    if (dt.ToString().Substring(0, 8) == "1/1/1900")
                    {
                        dt = null;
                    }
                }
                worksheet.Cells["B43"].Value = dt;
                worksheet.Cells["B44"].Value = Year;
                //storeLeaseInfo.LastRemodelDate = dt;
                //storeLeaseInfo.RemainingLeaseYears = Year;
            }
            ReinvestmentCost cost = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == reimageConsInfo.Id);

            worksheet.Cells["B2"].Value = store.Region;
            worksheet.Cells["B3"].Value = store.StoreCode;
            if (reinvestment != null)
            {
                worksheet.Cells["B8"].Value  = TryParseDecimal(reinvestment.RightSizingSeatNo);
                worksheet.Cells["B11"].Value = TryParseDecimal(reinvestment.EstimatedSeatNo);
                worksheet.Cells["B41"].Value = reinvestment.GBDate;
                worksheet.Cells["B42"].Value = reinvestment.ConsCompletionDate;
            }
            if (cost != null)
            {
                worksheet.Cells["B13"].Value = TryParseDecimal(cost.DesignFee);
                worksheet.Cells["B14"].Value = TryParseDecimal(cost.PublicBudget);
                worksheet.Cells["B15"].Value = TryParseDecimal(cost.BuildingFacade);
                worksheet.Cells["B16"].Value = TryParseDecimal(cost.SiteBudget);
                worksheet.Cells["B17"].Value = TryParseDecimal(cost.BuildingWork);
                worksheet.Cells["B18"].Value = TryParseDecimal(cost.PlumbingSystem);
                worksheet.Cells["B19"].Value = TryParseDecimal(cost.ElectricalSystem);
                worksheet.Cells["B20"].Value = TryParseDecimal(cost.HVACDuctSystem);
                worksheet.Cells["B21"].Value = TryParseDecimal(cost.Signage);
                worksheet.Cells["B22"].Value = TryParseDecimal(cost.Seating);
                worksheet.Cells["B23"].Value = TryParseDecimal(cost.Decor);
                worksheet.Cells["B24"].Value = TryParseDecimal(cost.Kiosk);
                worksheet.Cells["B25"].Value = TryParseDecimal(cost.McCafe);
                worksheet.Cells["B26"].Value = TryParseDecimal(cost.MDS);
                worksheet.Cells["B27"].Value = TryParseDecimal(cost.Playland);
                worksheet.Cells["B28"].Value = TryParseDecimal(cost.KitchenCapacityUpgrade);
                worksheet.Cells["B29"].Value = TryParseDecimal(cost.BuildingWorks);
                worksheet.Cells["B30"].Value = TryParseDecimal(cost.KitchenEquipment);
                worksheet.Cells["B31"].Value = TryParseDecimal(cost.HVAC);
                worksheet.Cells["B32"].Value = TryParseDecimal(cost.Plumbing);
                worksheet.Cells["B33"].Value = TryParseDecimal(cost.ElectricDistribution);
                worksheet.Cells["B34"].Value = TryParseDecimal(cost.Structure);
                worksheet.Cells["B35"].Value = TryParseDecimal(cost.Others);
                worksheet.Cells["B36"].Value = TryParseDecimal(cost.LHIPMAct);
                worksheet.Cells["B37"].Value = TryParseDecimal(cost.SignagePMAct);
                worksheet.Cells["B38"].Value = TryParseDecimal(cost.EquipmentPMAct);
                worksheet.Cells["B39"].Value = TryParseDecimal(cost.SeatingPackagePMAct);
                worksheet.Cells["B40"].Value = TryParseDecimal(cost.DecorPMAct);
            }
            worksheet.Cells["B5"].Value = storeSTLocation.TotalArea.As <decimal>();
            worksheet.Cells["B6"].Value = store.ProvinceZHCN;
            worksheet.Cells["B7"].Value = store.NameZHCN;

            worksheet.Cells["B4"].Value  = TryParseDecimal(storeSTLocation.TotalSeatsNo);
            worksheet.Cells["B9"].Value  = TryParseDecimal(storeSTLocation.KitchenArea);
            worksheet.Cells["B10"].Value = store.CityZHCN;

            if (!string.IsNullOrEmpty(storeSTLocation.DesignStyle))
            {
                var dict = Dictionary.FirstOrDefault(i => i.Code == storeSTLocation.DesignStyle);
                if (dict != null)
                {
                    worksheet.Cells["B12"].Value = dict.NameZHCN;
                }
                else
                {
                    worksheet.Cells["B12"].Value = storeSTLocation.DesignStyle;
                }
            }
            //worksheet.Cells["B24"].Value = reimageSummary.ReinvestmentBasicInfo.NewKiosk;
            //worksheet.Cells["B25"].Value = reimageSummary.ReinvestmentBasicInfo.NewMcCafe;
            //worksheet.Cells["B26"].Value = reimageSummary.ReinvestmentBasicInfo.NewMDS;
            //worksheet.Cells["B41"].Value = reimageSummary.ReinvestmentBasicInfo.GBDate;
            //worksheet.Cells["B42"].Value = reimageSummary.ReinvestmentBasicInfo.ConsCompletionDate;


            worksheet.Cells["B10"].Value = store.CityZHCN;
            //worksheet.Cells["B11"].Value = inputInfo.StoreType;
            //worksheet.Cells["B12"].Value = inputInfo.StoreType;
            //worksheet.Cells["B13"].Value = inputInfo.StoreType;
            //worksheet.Cells["B14"].Value = inputInfo.StoreType;
            //worksheet.Cells["B15"].Value = inputInfo.StoreType;
            //worksheet.Cells["B16"].Value = inputInfo.StoreType;
            //worksheet.Cells["B17"].Value = inputInfo.StoreType;
            //worksheet.Cells["B18"].Value = inputInfo.StoreType;
            //worksheet.Cells["B19"].Value = inputInfo.StoreType;
            //worksheet.Cells["B20"].Value = inputInfo.StoreType;
            //worksheet.Cells["B21"].Value = inputInfo.StoreType;
            //worksheet.Cells["B22"].Value = inputInfo.StoreType;
            //worksheet.Cells["B23"].Value = inputInfo.StoreType;

            //worksheet.Cells["B27"].Value = inputInfo.StoreType;
            //worksheet.Cells["B28"].Value = inputInfo.StoreType;
            //worksheet.Cells["B29"].Value = inputInfo.StoreType;
            //worksheet.Cells["B30"].Value = inputInfo.StoreType;
            //worksheet.Cells["B31"].Value = inputInfo.StoreType;
            //worksheet.Cells["B32"].Value = inputInfo.StoreType;
            //worksheet.Cells["B33"].Value = inputInfo.StoreType;
            //worksheet.Cells["B34"].Value = inputInfo.StoreType;
            //worksheet.Cells["B35"].Value = inputInfo.StoreType;
            //worksheet.Cells["B36"].Value = inputInfo.StoreType;
            //worksheet.Cells["B37"].Value = inputInfo.StoreType;
            //worksheet.Cells["B38"].Value = inputInfo.StoreType;
            //worksheet.Cells["B39"].Value = inputInfo.StoreType;
            //worksheet.Cells["B40"].Value = inputInfo.StoreType;

            //if (reimageSummary.StoreProfitabilityAndLeaseInfo != null)
            //{
            //    worksheet.Cells["B43"].Value = reimageSummary.StoreProfitabilityAndLeaseInfo.LastRemodelDate;
            //    worksheet.Cells["B44"].Value = reimageSummary.StoreProfitabilityAndLeaseInfo.RemainingLeaseYears;
            //    worksheet.Cells["B45"].Value = reimageSummary.StoreProfitabilityAndLeaseInfo.TTMSales;
            //    worksheet.Cells["B46"].Value = reimageSummary.StoreProfitabilityAndLeaseInfo.TTMSOIPercent;
            //    worksheet.Cells["B47"].Value = reimageSummary.StoreProfitabilityAndLeaseInfo.AsOf;
            //}

            ////worksheet.Cells["B48"].Value = reimageSummary.OperationRequirements;
            //if (reimageSummary.FinancialPreanalysis != null)
            //{
            //    worksheet.Cells["B49"].Value = reimageSummary.FinancialPreanalysis.TotalSalesInc;
            //    worksheet.Cells["B50"].Value = reimageSummary.FinancialPreanalysis.StoreCM;
            //    worksheet.Cells["B51"].Value = reimageSummary.FinancialPreanalysis.CurrentPriceTier;
            //    worksheet.Cells["B52"].Value = reimageSummary.FinancialPreanalysis.ISDWIP;
            //    worksheet.Cells["B53"].Value = reimageSummary.FinancialPreanalysis.SPTAR;

            //}
        }
Ejemplo n.º 8
0
        //private string GetCellValue(decimal? val)
        //{
        //    string result = string.Empty;
        //    if (val.HasValue)
        //    {
        //        result = val.Value.ToString("f2");
        //    }
        //    return result;
        //}
        public override void Input(OfficeOpenXml.ExcelWorksheet worksheet, ExcelInputDTO inputInfo)
        {
            var         closureInfo   = ClosureInfo.GetByProjectId(inputInfo.ProjectId);
            var         storeInfo     = StoreBasicInfo.FirstOrDefault(s => s.StoreCode == closureInfo.USCode);
            var         storeContract = StoreContractInfo.Get(storeInfo.StoreCode);
            ClosureTool closureTool   = ClosureTool.Get(inputInfo.ProjectId);

            //ClosureWOCheckList closureWoCheckList = ClosureWOCheckList.Get(inputInfo.ProjectId);
            worksheet.Cells["B2"].Value = storeInfo.Market;
            worksheet.Cells["B3"].Value = storeInfo.StoreCode;
            worksheet.Cells["B4"].Value = storeInfo.NameZHCN;

            worksheet.Cells["B5"].Value = storeInfo.OpenDate.ToString("yyyy-MM-dd");
            if (storeContract != null)
            {
                worksheet.Cells["B6"].Value = storeContract.PartyAFullName;
                worksheet.Cells["B7"].Value = storeContract.EndDate.HasValue ? storeContract.EndDate.Value.ToString("yyyy-MM-dd") : "";
            }
            worksheet.Cells["B8"].Value = closureInfo.ClosureTypeNameZHCN;

            if (closureInfo.ActualCloseDate != null)
            {
                worksheet.Cells["B9"].Value = closureInfo.ActualCloseDate.Value.ToString("yyyy-MM-dd");
            }
            worksheet.Cells["B10"].Value = closureTool.Product_Sales_RMB_Adjustment;
            worksheet.Cells["B11"].Value = closureTool.PAC_RMB_Adjustment;


            worksheet.Cells["B12"].Value = closureTool.Rent_RMB_Adjustment;



            worksheet.Cells["B13"].Value = closureTool.DepreciationLHI_RMB_Adjustment;


            worksheet.Cells["B14"].Value = closureTool.InterestLHI_RMB_Adjustment;



            //INTEREST LHI
            // worksheet.Cells[15, 2].Value = closureTool..ToString();

            worksheet.Cells["B15"].Value = closureTool.ServiceFee_RMB_Adjustment;


            worksheet.Cells["B16"].Value = closureTool.Accounting_RMB_Adjustment;


            worksheet.Cells["B17"].Value = closureTool.Accounting_RMB_Adjustment;


            worksheet.Cells["B18"].Value = closureTool.TaxesLicenses_RMB_Adjustment;


            worksheet.Cells["B19"].Value = closureTool.Depreciation_ESSD_RMB_Adjustment;


            worksheet.Cells["B20"].Value = closureTool.Interest_ESSD_RMB_Adjustment;


            worksheet.Cells["B21"].Value = closureTool.OtherIncExp_RMB_Adjustment;

            worksheet.Cells["B22"].Value = closureTool.NonProduct_Sales_RMB_Adjustment;
            worksheet.Cells["B23"].Value = closureTool.NonProduct_Costs_RMB_Adjustment;
            worksheet.Cells["B24"].Value = closureTool.CompSalesMacket_Adjustment;
            worksheet.Cells["B25"].Value = closureTool.CompCG_Adjustment;
            worksheet.Cells["B26"].Value = closureTool.CompCGMacket_Adjustment;
            worksheet.Cells["B27"].Value = closureTool.PACMarket_Adjustment;
            worksheet.Cells["B28"].Value = closureTool.SOIMarket_Adjustment;
            worksheet.Cells["B29"].Value = closureTool.TotalSales_TTMY1;
            worksheet.Cells["B30"].Value = closureTool.CompSales_TTMY1;
            worksheet.Cells["B31"].Value = closureTool.CompSales_Market_TTMY1;
            worksheet.Cells["B32"].Value = closureTool.CompGC_TTMY1;
            worksheet.Cells["B33"].Value = closureTool.CompGCMarket_TTMY1;

            worksheet.Cells["B34"].Value = closureTool.PAC_TTMY1;
            worksheet.Cells["B35"].Value = closureTool.PACMarket_TTMY1;

            worksheet.Cells["B36"].Value = closureTool.SOI_TTMY1;
            worksheet.Cells["B37"].Value = closureTool.SOIMarket_TTMY1;

            worksheet.Cells["B38"].Value = closureTool.CashFlow_TTMY1;
            worksheet.Cells["B39"].Value = closureTool.TotalSales_TTMY2;
            //sheet.Cells[36, 2].Value = closureTool.cashflow.ToString();


            worksheet.Cells["B40"].Value = closureTool.CompSales_TTMY2;
            worksheet.Cells["B41"].Value = closureTool.CompSales_Market_TTMY2;

            worksheet.Cells["B42"].Value = closureTool.CompGC_TTMY2;
            worksheet.Cells["B43"].Value = closureTool.CompGCMarket_TTMY2;

            worksheet.Cells["B44"].Value = closureTool.PAC_TTMY2;
            worksheet.Cells["B45"].Value = closureTool.PACMarket_TTMY2;

            worksheet.Cells["B46"].Value = closureTool.SOI_TTMY2;
            worksheet.Cells["B47"].Value = closureTool.SOIMarket_TTMY2;

            worksheet.Cells["B48"].Value = closureTool.CashFlow_TTMY2;
            worksheet.Cells["B49"].Value = DateTime.Now.Year + " July";
            var woEntity = ClosureWOCheckList.Get(closureTool.ProjectId);

            if (woEntity != null)
            {
                worksheet.Cells["B50"].Value = woEntity.RE_Original;
                worksheet.Cells["B51"].Value = woEntity.LHI_Original;
                worksheet.Cells["B52"].Value = woEntity.ESSD_Original;
                worksheet.Cells["B53"].Value = woEntity.RE_NBV;
                worksheet.Cells["B54"].Value = woEntity.LHI_NBV;
                worksheet.Cells["B55"].Value = woEntity.ESSD_NBV;
                worksheet.Cells["B56"].Value = woEntity.EquipmentTransfer;
                worksheet.Cells["B57"].Value = woEntity.ClosingCost;
            }

            var list = ClosureToolImpactOtherStore.Search(e => e.ClosureId == closureTool.Id).AsNoTracking().ToList();

            if (list.Count > 0)
            {
                worksheet.Cells["B58"].Value = list[0].StoreCode;
                worksheet.Cells["B59"].Value = list[0].NameZHCN;
                worksheet.Cells["B60"].Value = list[0].ImpactSaltes;
            }

            if (list.Count > 1)
            {
                worksheet.Cells["B61"].Value = list[1].StoreCode;
                worksheet.Cells["B62"].Value = list[1].NameZHCN;
                worksheet.Cells["B63"].Value = list[1].ImpactSaltes;
            }



            worksheet.Cells["B64"].Value = closureTool.McppcoMargin;


            worksheet.Cells["B65"].Value = closureTool.MccpcoCashFlow;

            worksheet.Cells["B66"].Value = closureTool.Compensation;


            worksheet.Cells["B67"].Value = closureTool.CompAssumption;


            worksheet.Cells["B68"].Value = closureTool.CashflowGrowth;

            if (closureTool.IsOptionOffered.HasValue)
            {
                worksheet.Cells["B69"].Value = closureTool.IsOptionOffered.Value ? "Yes" : "No";
            }
            worksheet.Cells["B70"].Value = closureTool.LeaseTerm;


            worksheet.Cells["B71"].Value = closureTool.Investment;


            worksheet.Cells["B72"].Value = closureTool.NPVRestaurantCashflows;

            if (closureTool.Yr1SOI != null)
            {
                worksheet.Cells["B73"].Value = closureTool.Yr1SOI;
            }

            if (closureTool.Yr1SOI != null)
            {
                worksheet.Cells["B74"].Value = closureTool.IRR;
            }

            if (closureTool.ConclusionComment != null)
            {
                worksheet.Cells["B76"].Value = closureTool.ConclusionComment;
            }
        }