Esempio n. 1
0
        public IHttpActionResult GetConsInfo(string projectId, string entityId = "")
        {
            var entity = ReimageConsInfo.GetConsInfo(projectId, entityId);

            if (entity != null)
            {
                var condition = new ProjectCommentCondition();
                condition.SourceCode  = FlowCode.Reimage;
                condition.UserAccount = ClientCookie.UserCode;

                condition.RefTableId   = entity.Id;
                condition.RefTableName = "ReimageConsInfo";

                var comments = ProjectComment.SearchList(condition);
                if (comments != null && comments.Count > 0)
                {
                    entity.ProjectComments = comments;

                    var saveComment =
                        comments.OrderByDescending(e => e.CreateTime)
                        .FirstOrDefault(e => e.Status == ProjectCommentStatus.Save);
                    if (saveComment != null)
                    {
                        entity.Comments = saveComment.Content;
                    }
                }
            }

            return(Ok(entity));
        }
Esempio n. 2
0
 public IHttpActionResult RecallConsInfo(ReimageConsInfo consinfo)
 {
     try
     {
         consinfo.Recall(consinfo.Comments);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Esempio n. 3
0
        public IHttpActionResult GetSummaryReinvestmentCost(string projectId)
        {
            var reimageConsInfo       = ReimageConsInfo.GetConsInfo(projectId, "");
            ReinvestmentCost rein     = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == reimageConsInfo.Id);
            WriteOffAmount   writeoff = WriteOffAmount.FirstOrDefault(e => e.ConsInfoID == reimageConsInfo.Id);

            return(Ok(new
            {
                Rein = rein,
                Writeoff = writeoff
            }));
        }
Esempio n. 4
0
 public IHttpActionResult SaveConsInfo(ReimageConsInfo consinfo)
 {
     try
     {
         consinfo.Save();
         return(Ok());
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Esempio n. 5
0
        public IHttpActionResult SubmitConsInfo(ReimageConsInfo entity)
        {
            try
            {
                entity.Submit();

                return(Ok(entity));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Esempio n. 6
0
        public IHttpActionResult GetReimageInfo(string projectId)
        {
            var reimageInfo = ReimageInfo.FirstOrDefault(e => e.ProjectId.Equals(projectId));

            if (reimageInfo != null)
            {
                reimageInfo.IsSiteInfoSaveable = ProjectInfo.IsFlowSavable(projectId, FlowCode.Reimage_SiteInfo);

                var siteInfo = ProjectInfo.FirstOrDefault(e => e.ProjectId.Equals(projectId) &&
                                                          e.FlowCode == FlowCode.Reimage_SiteInfo);

                if (siteInfo != null)
                {
                    reimageInfo.SiteInfoId = siteInfo.Id;

                    var estimatedVsActualConstruction =
                        EstimatedVsActualConstruction.FirstOrDefault(e => e.RefId == siteInfo.Id);

                    if (estimatedVsActualConstruction == null)
                    {
                        var consInfo      = ReimageConsInfo.GetConsInfo(projectId);
                        var reinBasicInfo = consInfo.ReinBasicInfo;
                        var gbMemo        = ReimageGBMemo.GetGBMemo(projectId);
                        var storeInfo     = StoreSTLocation.FirstOrDefault(e => e.StoreCode == siteInfo.USCode);

                        var summary = ReimageSummary.GetReimageSummaryInfo(projectId);
                        var afterReimagePriceTier = summary.FinancialPreanalysis != null
                            ? summary.FinancialPreanalysis.PriceTierafterReimage
                            : null;


                        estimatedVsActualConstruction = new EstimatedVsActualConstruction
                        {
                            RefId                 = siteInfo.Id,
                            GBDate                = gbMemo.GBDate,
                            CompletionDate        = gbMemo.ConstCompletionDate,
                            ARDC                  = reinBasicInfo.NewDesignType,
                            OriginalOperationSize = storeInfo.TotalArea,
                            OriginalSeatNumber    = storeInfo.TotalSeatsNo,
                            ARPT                  = afterReimagePriceTier
                        };
                    }

                    reimageInfo.EstimatedVsActualConstruction = estimatedVsActualConstruction;
                }
            }

            return(Ok(reimageInfo));
        }
Esempio n. 7
0
 public IHttpActionResult EditConsInfo(ReimageConsInfo consinfo)
 {
     try
     {
         var taskUrl = consinfo.Edit();
         return(Ok(new ProjectEditResult
         {
             TaskUrl = taskUrl
         }));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Esempio n. 8
0
        public IHttpActionResult GetFinancialPreAnalysis(string projectId, string usCode, string pageType = "")
        {
            var financial  = new FinancialPreanalysis();
            var reimageSum = ReimageSummary.FirstOrDefault(e => e.ProjectId == projectId && e.IsHistory == false);

            if (reimageSum != null)
            {
                financial = FinancialPreanalysis.FirstOrDefault(e => e.RefId == reimageSum.Id);
            }
            if (financial != null)
            {
                if (financial.Id != 0)
                {
                    pageType = "save";
                }
            }
            if (pageType == "")
            {
                //FinancialPreanalysis financial = reimageSummary.LoadFinancialPreanalysisInfo();

                var enti = ReimageConsInfo.FirstOrDefault(e => e.ProjectId.Equals(projectId) && e.IsHistory == true);
                if (enti == null)
                {
                    enti = ReimageConsInfo.FirstOrDefault(e => e.ProjectId.Equals(projectId) && e.IsHistory == false);
                }
                WriteOffAmount writeOff = WriteOffAmount.FirstOrDefault(e => e.ConsInfoID == enti.Id);
                if (financial == null)
                {
                    financial = new FinancialPreanalysis();
                }
                if (writeOff != null)
                {
                    financial.EstimatedWriteOffCost = writeOff.TotalII;
                }
                var ContributionMargin    = StoreCM.Get(usCode).ContributionMargin.ToString();
                var reimageConsInfo       = ReimageConsInfo.GetConsInfo(projectId, "");
                var reinvestmentBasicInfo = ReinvestmentBasicInfo.FirstOrDefault(e => e.ConsInfoID == reimageConsInfo.Id);

                //ReinvestmentCost reinCost = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == enti.Id);
                financial.IsMcCafe = reinvestmentBasicInfo.NewMcCafe;

                financial.IsKiosk           = reinvestmentBasicInfo.NewKiosk;
                financial.IsMDS             = reinvestmentBasicInfo.NewMDS;
                financial.IsTwientyFourHour = reinvestmentBasicInfo.NewTwientyFourHour;
                financial.StoreCM           = ContributionMargin;
            }
            return(Ok(financial));
        }
Esempio n. 9
0
        public IHttpActionResult GetKeyMeasuresInfo(string projectId)
        {
            var reimage = ReimageConsInfo.GetConsInfo(projectId, "");
            ReinvestmentCost reinCost = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == reimage.Id);
            var entity = ReimageSummary.FirstOrDefault(e => e.ProjectId.Equals(projectId) && e.IsHistory == false);
            var financialPreanalysis = new FinancialPreanalysis();

            if (entity != null)
            {
                financialPreanalysis = FinancialPreanalysis.FirstOrDefault(e => e.RefId.Equals(entity.Id));
            }
            if (reinCost != null)
            {
                financialPreanalysis.TotalReinvestmentNorm = reinCost.TotalReinvestmentNorm;
            }
            return(Ok(financialPreanalysis));
        }
Esempio n. 10
0
        public IHttpActionResult GetEstimatedVsActualConstruction(string projectId, Guid identifier)
        {
            var reimageInfo = ReimageInfo.FirstOrDefault(e => e.ProjectId.Equals(projectId));

            var estimatedVsActualConstruction = EstimatedVsActualConstruction.FirstOrDefault(e => e.RefId == identifier);

            if (estimatedVsActualConstruction == null)
            {
                var reimageConsInfo = ReimageConsInfo.GetConsInfo(projectId);
                var storeInfo       = StoreSTLocation.FirstOrDefault(e => e.StoreCode == reimageInfo.USCode);
                estimatedVsActualConstruction = new EstimatedVsActualConstruction
                {
                    GBDate                = reimageConsInfo.ReinBasicInfo != null ? reimageConsInfo.ReinBasicInfo.GBDate : null,
                    CompletionDate        = reimageConsInfo.ReinBasicInfo != null ? reimageConsInfo.ReinBasicInfo.ConsCompletionDate : null,
                    ARDC                  = reimageConsInfo.ReinBasicInfo != null ? reimageConsInfo.ReinBasicInfo.NewDesignType : null,
                    OriginalOperationSize = storeInfo.TotalArea,
                    OriginalSeatNumber    = storeInfo.TotalSeatsNo
                };
            }

            return(Ok(estimatedVsActualConstruction));
        }
Esempio n. 11
0
        public IHttpActionResult GetConsInfoAgreementList(string projectId, string typeCode)
        {
            var entity = ReimageConsInfo.FirstOrDefault(e => e.ProjectId.Equals(projectId) && e.IsHistory == false);
            var list   = new List <Attachment>();

            if (entity != null)
            {
                list = Attachment.GetList("ReimageConsInfo", entity.Id.ToString(), typeCode);
                foreach (var item in list)
                {
                    if (item.InternalName.IndexOf(".") != -1)
                    {
                        item.FileURL = SiteFilePath.UploadFiles_URL + "/" + item.InternalName;
                    }
                    else
                    {
                        item.FileURL = SiteFilePath.UploadFiles_URL + "/" + item.InternalName + item.Extension;
                    }
                }
            }
            return(Ok(list));
        }
Esempio n. 12
0
        public IHttpActionResult Upload(string projectId, string refTableName, Guid?requirementId = null)
        {
            using (TransactionScope tranScope = new TransactionScope())
            {
                var refTableId = Attachment.GetRefTableId(refTableName, projectId);
                if (refTableId == Guid.Empty.ToString())
                {
                    var newId = Guid.NewGuid();
                    refTableId = newId.ToString();
                    switch (refTableName)
                    {
                    case "MajorLeaseChangePackage":
                    {
                        var entity = new MajorLeaseChangePackage();
                        entity.ProjectId         = projectId;
                        entity.Id                = newId;
                        entity.CreateTime        = DateTime.Now;
                        entity.CreateUserAccount = ClientCookie.UserCode;
                        entity.IsHistory         = false;
                        entity.Add();
                    }
                    break;

                    case "ReimageSummary":
                    {
                        var entity = new ReimageSummary();
                        entity.ProjectId         = projectId;
                        entity.Id                = newId;
                        entity.CreateTime        = DateTime.Now;
                        entity.CreateUserAccount = ClientCookie.UserCode;
                        entity.IsHistory         = false;
                        entity.Add();
                    }
                    break;

                    case "ReimageConsInfo":
                    {
                        var entity = new ReimageConsInfo();
                        entity.ProjectId         = projectId;
                        entity.Id                = newId;
                        entity.CreateTime        = DateTime.Now;
                        entity.CreateUserAccount = ClientCookie.UserCode;
                        entity.IsHistory         = false;
                        entity.Add();
                    }
                    break;

                    case "ReimagePackage":
                    {
                        var entity = new ReimagePackage();
                        entity.ProjectId         = projectId;
                        entity.Id                = newId;
                        entity.CreateTime        = DateTime.Now;
                        entity.CreateUserAccount = ClientCookie.UserCode;
                        entity.IsHistory         = false;
                        entity.Add();
                    }
                    break;

                    case "RebuildLegalReview":
                    {
                        var entity = new RebuildLegalReview();
                        entity.ProjectId         = projectId;
                        entity.Id                = newId;
                        entity.CreateTime        = DateTime.Now;
                        entity.CreateUserAccount = ClientCookie.UserCode;
                        entity.IsHistory         = false;
                        entity.Add();
                    }
                    break;

                    case "ClosureLegalReview":
                    {
                        var entity = new ClosureLegalReview();
                        entity.ProjectId         = projectId;
                        entity.Id                = newId;
                        entity.CreateTime        = DateTime.Now;
                        entity.CreateUserAccount = ClientCookie.UserCode;
                        entity.IsHistory         = false;
                        entity.Add();
                    }
                    break;

                    case "ClosureExecutiveSummary":
                    {
                        var entity = new ClosureExecutiveSummary();
                        entity.ProjectId      = projectId;
                        entity.Id             = newId;
                        entity.CreateTime     = DateTime.Now;
                        entity.CreatorAccount = ClientCookie.UserCode;
                        entity.IsHistory      = false;
                        entity.Add();
                    }
                    break;

                    case "ClosurePackage":
                    {
                        var entity = new ClosurePackage();
                        entity.ProjectId         = projectId;
                        entity.Id                = newId;
                        entity.CreateTime        = DateTime.Now;
                        entity.CreateUserAccount = ClientCookie.UserCode;
                        entity.IsHistory         = false;
                        entity.Add();
                    }
                    break;
                    }
                }
                var userRole = ProjectUsers.Get(ClientCookie.UserCode, projectId);
                var files    = HttpContext.Current.Request.Files;
                if (requirementId.HasValue)
                {
                    var attReq      = AttachmentRequirement.Get(requirementId.Value);
                    var projectInfo = ProjectInfo.Get(projectId, attReq.FlowCode);
                    var store       = StoreBasicInfo.GetStorInfo(projectInfo.USCode);
                    var attachNode  = NodeInfo.FirstOrDefault(n => n.FlowCode == attReq.FlowCode && n.Code == attReq.NodeCode);
                    if (attachNode != null)
                    {
                        ProjectInfo.FinishNode(projectId, attReq.FlowCode, attReq.NodeCode);
                    }
                    var    file          = files[0];
                    string fileName      = Path.GetFileName(file.FileName);
                    string fileExtension = Path.GetExtension(file.FileName);
                    var    current       = System.Web.HttpContext.Current;
                    string internalName  = Guid.NewGuid() + fileExtension;
                    string absolutePath  = current.Server.MapPath("~/") + "UploadFiles/" + internalName;

                    file.SaveAs(absolutePath);

                    Attachment att = Attachment.Get(refTableId, requirementId.Value);

                    if (att == null)
                    {
                        att = new Attachment();
                        att.InternalName    = internalName;
                        att.RefTableName    = refTableName;
                        att.RefTableID      = refTableId;
                        att.RelativePath    = "//";
                        att.Name            = fileName;
                        att.Extension       = fileExtension;
                        att.Length          = file.ContentLength;
                        att.CreateTime      = DateTime.Now;
                        att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
                        att.CreatorNameENUS = ClientCookie.UserNameENUS;
                        att.CreatorID       = ClientCookie.UserCode;
                        att.ID            = Guid.NewGuid();
                        att.RequirementId = requirementId;
                        att.TypeCode      = "";
                        Attachment.Add(att);
                    }
                    else
                    {
                        att.InternalName    = internalName;
                        att.RefTableName    = refTableName;
                        att.RefTableID      = refTableId;
                        att.RelativePath    = "//";
                        att.Name            = fileName;
                        att.Extension       = fileExtension;
                        att.Length          = file.ContentLength;
                        att.CreateTime      = DateTime.Now;
                        att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
                        att.CreatorNameENUS = ClientCookie.UserNameENUS;
                        att.CreatorID       = ClientCookie.UserCode;
                        Attachment.Update(att);
                    }
                    //TempClosure上传SignAgreement
                    //if (requirementId.Value.Equals(new Guid("1E9B17AF-357A-4DC9-8A60-17766663FB75")))
                    //{
                    //    var url = "/TempClosure/Main#/ClosureMemo?projectId=" + projectId;
                    //    var actor = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == projectId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
                    //    var title = string.Concat(projectId, " ", store.NameZHCN, " ", store.NameENUS);
                    //    TaskWork.Finish(t => t.ReceiverAccount == ClientCookie.UserCode && t.RefID == projectId && t.Status == TaskWorkStatus.UnFinish && t.TypeCode == FlowCode.TempClosure_ClosurePackage);
                    //    //TaskWork.SendTask(projectId, title, projectInfo.USCode, url, actor, FlowCode.TempClosure, FlowCode.TempClosure_ClosureMemo, "Start");
                    //}
                }
                else
                {
                    List <Attachment> attachments = new List <Attachment>();
                    string            typeCode    = "";
                    if (refTableName == "RebuildLegalReview")
                    {
                        typeCode = "Contract";
                    }
                    for (int i = 0; i < files.Count; i++)
                    {
                        var    file          = files[i];
                        string fileName      = Path.GetFileName(file.FileName);
                        string fileExtension = Path.GetExtension(file.FileName);
                        var    current       = System.Web.HttpContext.Current;
                        string internalName  = Guid.NewGuid() + fileExtension;
                        string absolutePath  = current.Server.MapPath("~/") + "UploadFiles/" + internalName;

                        file.SaveAs(absolutePath);

                        Attachment att = new Attachment();
                        att.InternalName    = internalName;
                        att.RefTableName    = refTableName;
                        att.RefTableID      = refTableId;
                        att.RelativePath    = "//";
                        att.Name            = fileName;
                        att.Extension       = fileExtension;
                        att.Length          = file.ContentLength;
                        att.CreateTime      = DateTime.Now;
                        att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
                        att.CreatorNameENUS = ClientCookie.UserNameENUS;
                        att.CreatorID       = ClientCookie.UserCode;
                        att.ID            = Guid.NewGuid();
                        att.RequirementId = requirementId;
                        att.TypeCode      = typeCode;
                        attachments.Add(att);
                    }
                    Attachment.Add(attachments.ToArray());
                }
                tranScope.Complete();
                return(Ok());
            }
        }
Esempio n. 13
0
        public IHttpActionResult DownLoadTemplate(string templateType, string projectId, string consInfoID = "", string NormType = "", string flowCode = "")
        {
            var current = HttpContext.Current;
            ExcelDataInputType outputType;

            if (!Enum.TryParse(templateType, out outputType))
            {
                throw new Exception("Cannot find the specific template type!");
            }

            if (string.IsNullOrEmpty(projectId))
            {
                throw new Exception("Porject Id is Empty !");
            }
            var siteFilePath = default(string);

            switch (outputType)
            {
            case ExcelDataInputType.WriteOffAmount:
                siteFilePath = SiteFilePath.FAWrite_offTool_Template_X;
                break;

            case ExcelDataInputType.ReinvestmentCost:
                siteFilePath = SiteFilePath.FATool_Update_Template;
                break;

            case ExcelDataInputType.ClosureWOCheckList:
                siteFilePath = SiteFilePath.Closure_FAWrite_offTool_Template;
                break;
            }
            var path = string.Format(@"{0}\{1}", SiteFilePath.Template_DIRECTORY, siteFilePath);

            var tempFilePath = current.Server.MapPath("~/") + "Temp\\" + Guid.NewGuid() + ".xlsx";

            bool isNotUploadExcel = false;

            if (!string.IsNullOrEmpty(consInfoID))
            {
                string refTableName = "MajorLeaseConsInfo";
                if (projectId.ToLower().IndexOf("rebuild") != -1)
                {
                    refTableName = "RebuildConsInfo";
                }
                if (projectId.ToLower().IndexOf("reimage") != -1)
                {
                    refTableName = "ReimageConsInfo";
                }

                var strFileName = GetAttatchFile(refTableName, templateType, consInfoID);//download consifno upload file
                if (string.IsNullOrEmpty(strFileName))
                {
                    isNotUploadExcel = true;
                    tempFilePath     = current.Server.MapPath("~/") + "UploadFiles\\" + Guid.NewGuid() + ".xlsx";
                }
                else
                {
                    tempFilePath = current.Server.MapPath("~/") + "UploadFiles\\" + strFileName;
                }
            }

            if (isNotUploadExcel)
            {
                consInfoID = null;// if not upload file in consinfo flow,then we get empty template
            }
            var projectInfo = ProjectInfo.FirstOrDefault(e => e.ProjectId == projectId);

            if (projectInfo == null)
            {
                throw new Exception("Cannot find the project info!");
            }
            if (string.IsNullOrEmpty(consInfoID))
            {
                File.Copy(path, tempFilePath);

                var excelOutputDirector = new ExcelDataInputDirector(new FileInfo(tempFilePath), outputType);
                var store = StoreBasicInfo.Search(e => e.StoreCode == projectInfo.USCode).FirstOrDefault();
                if (store == null)
                {
                    throw new Exception("Cannot find Store info!");
                }

                var inputInfo = new ExcelInputDTO
                {
                    Region        = store.RegionENUS,
                    Market        = store.MarketENUS,
                    City          = store.CityENUS,
                    StoreNameCN   = store.NameZHCN,
                    StoreNameEN   = store.NameENUS,
                    StoreName     = store.NameZHCN,
                    USCode        = store.StoreCode,
                    StoreType     = store.StoreType,
                    StoreTypeName = store.StoreTypeName,
                    OpenDate      = store.OpenDate,
                    ClosureDate   = store.CloseDate.HasValue ? store.CloseDate.Value : default(DateTime)
                };

                switch (outputType)
                {
                case ExcelDataInputType.ReinvestmentCost:
                    Guid consInfoId = Guid.Empty;
                    if (projectId.ToLower().IndexOf("rebuild") != -1)
                    {
                        var rbdInfo = new RebuildConsInfo();
                        consInfoId = rbdInfo.GetConsInfo(projectId).Id;
                    }
                    else if (projectId.ToLower().IndexOf("majorlease") != -1)
                    {
                        var mjInfo = new MajorLeaseConsInfo();
                        consInfoId = mjInfo.GetConsInfo(projectId).Id;
                    }
                    else if (projectId.ToLower().IndexOf("reimage") != -1)
                    {
                        consInfoId = ReimageConsInfo.GetConsInfo(projectId).Id;
                    }
                    var reinvestmentBasicInfo = ReinvestmentBasicInfo.FirstOrDefault(e => e.ConsInfoID == consInfoId);
                    if (reinvestmentBasicInfo != null)
                    {
                        inputInfo.NewDesignType      = reinvestmentBasicInfo.NewDesignType;
                        inputInfo.NormType           = MappingNormType(NormType);
                        inputInfo.GBDate             = reinvestmentBasicInfo.GBDate;
                        inputInfo.ConsCompletionDate = reinvestmentBasicInfo.ConsCompletionDate;
                        inputInfo.EstimatedSeatNO    = reinvestmentBasicInfo.EstimatedSeatNo;
                        inputInfo.NewDTSiteArea      = reinvestmentBasicInfo.NewDTSiteArea;
                        inputInfo.NewOperationArea   = reinvestmentBasicInfo.NewOperationSize;
                        inputInfo.NewDiningArea      = reinvestmentBasicInfo.NewDiningArea;
                        inputInfo.WallPanelArea      = reinvestmentBasicInfo.WallPanelArea;
                        inputInfo.WallGraphicArea    = reinvestmentBasicInfo.WallGraphicArea;
                        inputInfo.FacadeACMArea      = reinvestmentBasicInfo.FacadeACMArea;
                        inputInfo.NewRemoteKiosk     = reinvestmentBasicInfo.NewRemoteKiosk;
                        inputInfo.NewAttachedKiosk   = reinvestmentBasicInfo.NewAttachedKiosk;
                        inputInfo.NewMcCafe          = reinvestmentBasicInfo.NewMcCafe;
                        inputInfo.NewMDS             = reinvestmentBasicInfo.NewMDS;
                    }

                    break;

                case ExcelDataInputType.WriteOffAmount:
                    string pmName = string.Empty;
                    if (projectId.ToLower().IndexOf("rebuild") != -1)
                    {
                        var rbdInfo = new RebuildInfo();
                        pmName = rbdInfo.GetRebuildInfo(projectId).PMNameENUS;
                    }
                    else if (projectId.ToLower().IndexOf("majorlease") != -1)
                    {
                        var mjInfo = new MajorLeaseInfo();
                        pmName = mjInfo.GetMajorLeaseInfo(projectId).PMNameENUS;
                    }
                    else if (projectId.ToLower().IndexOf("reimage") != -1)
                    {
                        pmName = ReimageInfo.GetReimageInfo(projectId).PMNameENUS;
                    }
                    inputInfo.PMNameENUS = pmName;
                    break;

                case ExcelDataInputType.ClosureWOCheckList:
                    var closure = ClosureInfo.GetByProjectId(projectId);
                    if (closure != null)
                    {
                        inputInfo.ActualCloseDate = closure.ActualCloseDate.HasValue ? closure.ActualCloseDate.Value.ToString("yyyy-MM-dd") : "";
                        inputInfo.PMNameENUS      = closure.PMNameENUS;
                    }
                    break;
                }

                excelOutputDirector.Input(inputInfo);
            }

            current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + SiteFilePath.GetTemplateFileName(projectInfo.USCode, flowCode, siteFilePath));
            current.Response.ContentType = "application/octet-stream";
            current.Response.WriteFile("" + tempFilePath + "");
            current.Response.End();

            return(Ok());
        }
Esempio n. 14
0
        public IHttpActionResult NotifyGBMemo(PostMemo <ReimageGBMemo> postData)
        {
            var actor = ProjectUsers.GetProjectUser(postData.Entity.ProjectId, ProjectUserRoleCode.AssetActor);

            using (TransactionScope tranScope = new TransactionScope())
            {
                Dictionary <string, string> pdfData = new Dictionary <string, string>();
                pdfData.Add("WorkflowName", Constants.Reimage);
                pdfData.Add("ProjectID", postData.Entity.ProjectId);
                pdfData.Add("RegionNameENUS", postData.Entity.Store.StoreBasicInfo.RegionENUS);
                pdfData.Add("RegionNameZHCN", postData.Entity.Store.StoreBasicInfo.RegionZHCN);
                pdfData.Add("MarketNameENUS", postData.Entity.Store.StoreBasicInfo.MarketENUS);
                pdfData.Add("MarketNameZHCN", postData.Entity.Store.StoreBasicInfo.MarketZHCN);
                pdfData.Add("ProvinceNameENUS", postData.Entity.Store.StoreBasicInfo.ProvinceENUS);
                pdfData.Add("ProvinceNameZHCN", postData.Entity.Store.StoreBasicInfo.ProvinceZHCN);
                pdfData.Add("CityNameENUS", postData.Entity.Store.StoreBasicInfo.CityENUS);
                pdfData.Add("CityNameZHCN", postData.Entity.Store.StoreBasicInfo.CityZHCN);
                pdfData.Add("StoreNameENUS", postData.Entity.Store.StoreBasicInfo.NameENUS);
                pdfData.Add("StoreNameZHCN", postData.Entity.Store.StoreBasicInfo.NameZHCN);
                pdfData.Add("USCode", postData.Entity.Store.StoreBasicInfo.StoreCode);

                pdfData.Add("IsClosed", postData.Entity.IsClosed ? "Y" : "N");
                pdfData.Add("IsInOperation", postData.Entity.IsInOperation ? "Y" : "N");
                pdfData.Add("IsMcCafe", postData.Entity.IsMcCafe ? "Y" : "N");
                pdfData.Add("IsKiosk", postData.Entity.IsKiosk ? "Y" : "N");
                pdfData.Add("IsMDS", postData.Entity.IsMDS ? "Y" : "N");
                pdfData.Add("Is24Hour", postData.Entity.Is24Hour ? "Y" : "N");
                var consInfo = ReimageConsInfo.GetConsInfo(postData.Entity.ProjectId);
                postData.Entity.ReinvestInfo = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id);
                pdfData.Add("GBDate", postData.Entity.rmgInfo.GBDate.HasValue ? postData.Entity.rmgInfo.GBDate.Value.ToString("yyyy-MM-dd") : "");
                pdfData.Add("ConstCompletionDate", postData.Entity.ReinvestInfo.ConsCompletionDate.HasValue ? postData.Entity.ReinvestInfo.ConsCompletionDate.Value.ToString("yyyy-MM-dd") : "");
                pdfData.Add("ReopenDate", postData.Entity.rmgInfo.ReopenDate.HasValue ? postData.Entity.rmgInfo.ReopenDate.Value.ToString("yyyy-MM-dd") : "");

                string pdfPath = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.GBMemo, pdfData, null);
                EmailSendingResultType result;
                //邮件模板中的数据
                Dictionary <string, string> bodyValues = new Dictionary <string, string>();
                //邮件内容中的键值对
                bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人
                bodyValues.Add("StoreCode", postData.Entity.Store.StoreBasicInfo.StoreCode);
                bodyValues.Add("StoreName", postData.Entity.Store.StoreBasicInfo.NameENUS);
                bodyValues.Add("Actor", actor.RoleNameENUS);              ////--呈递人
                bodyValues.Add("WorkflowName", Constants.Reimage_GBMemo); ////--流程名称
                bodyValues.Add("ProjectName", Constants.Reimage);         //项目名称

                string viewPage = string.Format("{0}/Reimage/Main#/GBMemo/Process/View?projectId={1}",
                                                ConfigurationManager.AppSettings["webHost"], postData.Entity.ProjectId);
                bodyValues.Add("FormUrl", viewPage);

                //调用邮件服务发送邮件
                using (EmailServiceClient client = new EmailServiceClient())
                {
                    EmailMessage  message = new EmailMessage();
                    StringBuilder sbTo    = new StringBuilder();
                    Dictionary <string, string> attachments = new Dictionary <string, string>();
                    foreach (Employee emp in postData.Receivers)
                    {
                        if (sbTo.Length > 0)
                        {
                            sbTo.Append(";");
                        }
                        if (!string.IsNullOrEmpty(emp.Mail))
                        {
                            sbTo.Append(emp.Mail);
                        }
                    }
                    if (sbTo.Length > 0)
                    {
                        sbTo.Append(";");
                    }
                    message.EmailBodyValues = bodyValues;
                    string strTitle = FlowCode.Reimage_GBMemo;
                    attachments.Add(pdfPath, strTitle + "_" + postData.Entity.ProjectId + ".pdf");
                    message.AttachmentsDict = attachments;
                    message.To           = sbTo.ToString();
                    message.TemplateCode = EmailTemplateCode.GBMemoNotification;
                    result = client.SendGBMemoNotificationEmail(message);
                }

                if (!result.Successful)
                {
                    return(BadRequest(result.ErrorMessage + " " + pdfPath));
                }
                postData.Entity.CompleteNotifyTask(postData.Entity.ProjectId);
                tranScope.Complete();
            }
            return(Ok());
        }
Esempio n. 15
0
        public Guid?GetRefId(string projectId, string flowTable)
        {
            Guid?refId = null;

            switch (flowTable)
            {
            case "MajorLeaseConsInfo":
                var majorConsInfo = MajorLeaseConsInfo.FirstOrDefault(e => e.ProjectId == projectId && !e.IsHistory);
                if (majorConsInfo != null && majorConsInfo.Id != Guid.Empty)
                {
                    refId = majorConsInfo.Id;
                }
                else
                {
                    refId         = Guid.NewGuid();
                    majorConsInfo = new MajorLeaseConsInfo
                    {
                        Id         = refId.Value,
                        ProjectId  = projectId,
                        CreateTime = DateTime.Now,
                        IsHistory  = false
                    };
                    MajorLeaseConsInfo.Add(majorConsInfo);
                }
                break;

            case "MajorLeaseConsInvtChecking":
                var checkInfo = MajorLeaseConsInvtChecking.Search(e => e.ProjectId == projectId && !e.IsHistory).FirstOrDefault();
                if (checkInfo != null && checkInfo.Id != Guid.Empty)
                {
                    refId = checkInfo.Id;
                }
                else
                {
                    refId     = Guid.NewGuid();
                    checkInfo = new MajorLeaseConsInvtChecking
                    {
                        Id         = refId.Value,
                        ProjectId  = projectId,
                        CreateTime = DateTime.Now,
                        IsHistory  = false
                    };

                    MajorLeaseConsInvtChecking.Add(checkInfo);
                }
                break;

            case "ReimageConsInfo":
                var reimageConsInfo = ReimageConsInfo.FirstOrDefault(e => e.ProjectId == projectId && !e.IsHistory);
                if (reimageConsInfo != null && reimageConsInfo.Id != Guid.Empty)
                {
                    refId = reimageConsInfo.Id;
                }
                else
                {
                    refId           = Guid.NewGuid();
                    reimageConsInfo = new ReimageConsInfo
                    {
                        Id                = refId.Value,
                        ProjectId         = projectId,
                        IsHistory         = false,
                        CreateTime        = DateTime.Now,
                        CreateUserAccount = ClientCookie.UserCode
                    };
                    ReimageConsInfo.Add(reimageConsInfo);
                }
                break;

            case "ReimageConsInvtChecking":
                var reimageCheckInfo = ReimageConsInvtChecking.Search(e => e.ProjectId == projectId && !e.IsHistory).FirstOrDefault();
                if (reimageCheckInfo != null && reimageCheckInfo.Id != Guid.Empty)
                {
                    refId = reimageCheckInfo.Id;
                }
                else
                {
                    refId            = Guid.NewGuid();
                    reimageCheckInfo = new ReimageConsInvtChecking
                    {
                        Id         = refId.Value,
                        ProjectId  = projectId,
                        CreateTime = DateTime.Now,
                        IsHistory  = false
                    };

                    ReimageConsInvtChecking.Add(reimageCheckInfo);
                }
                break;

            case "RebuildConsInfo":
                var rbdConsInfo = RebuildConsInfo.FirstOrDefault(e => e.ProjectId == projectId && !e.IsHistory);
                if (rbdConsInfo != null && rbdConsInfo.Id != Guid.Empty)
                {
                    refId = rbdConsInfo.Id;
                }
                else
                {
                    refId       = Guid.NewGuid();
                    rbdConsInfo = new RebuildConsInfo
                    {
                        Id                 = refId.Value,
                        ProjectId          = projectId,
                        IsHistory          = false,
                        CreateTime         = DateTime.Now,
                        LastUpdateTime     = DateTime.Now,
                        CreateUserAccount  = ClientCookie.UserCode,
                        CreateUserNameENUS = ClientCookie.UserNameENUS,
                        CreateUserNameZHCN = ClientCookie.UserNameZHCN
                    };
                    RebuildConsInfo.Add(rbdConsInfo);
                }
                break;

            case "RebuildConsInvtChecking":
                var rbdCheckInfo = RebuildConsInvtChecking.Search(e => e.ProjectId == projectId && !e.IsHistory).FirstOrDefault();
                if (rbdCheckInfo != null && rbdCheckInfo.Id != Guid.Empty)
                {
                    refId = rbdCheckInfo.Id;
                }
                else
                {
                    refId        = Guid.NewGuid();
                    rbdCheckInfo = new RebuildConsInvtChecking
                    {
                        Id                 = refId.Value,
                        ProjectId          = projectId,
                        IsHistory          = false,
                        CreateTime         = DateTime.Now,
                        LastUpdateTime     = DateTime.Now,
                        CreateUserAccount  = ClientCookie.UserCode,
                        CreateUserNameENUS = ClientCookie.UserNameENUS,
                        CreateUserNameZHCN = ClientCookie.UserNameZHCN
                    };

                    RebuildConsInvtChecking.Add(rbdCheckInfo);
                }
                ProjectInfo.FinishNode(projectId, FlowCode.Rebuild_ConsInvtChecking,
                                       NodeCode.Rebuild_ConsInvtChecking_Downlod);
                ProjectInfo.FinishNode(projectId, FlowCode.Rebuild_ConsInvtChecking,
                                       NodeCode.Rebuild_ConsInvtChecking_Input);
                ProjectInfo.FinishNode(projectId, FlowCode.Rebuild_ConsInvtChecking,
                                       NodeCode.Rebuild_ConsInvtChecking_Upload);
                break;

            case "ClosureWOCheckList":
                var closureWOCheckList = ClosureWOCheckList.Get(projectId);
                if (closureWOCheckList != null && closureWOCheckList.Id != Guid.Empty)
                {
                    refId        = closureWOCheckList.Id;
                    _woCheckList = closureWOCheckList;
                }
                else
                {
                    refId = Guid.NewGuid();
                    closureWOCheckList = new ClosureWOCheckList
                    {
                        Id                = refId.Value,
                        ProjectId         = projectId,
                        CreateTime        = DateTime.Now,
                        CreateUserAccount = ClientCookie.UserCode,
                        CreateUserName    = ClientCookie.UserNameENUS,
                        IsHistory         = false
                    };
                    ClosureWOCheckList.Add(closureWOCheckList);
                }
                break;
            }

            return(refId);
        }
Esempio n. 16
0
        private string GenPrintReimageAttachment(ReimageInfo reimageInfo, ReimagePackage entity, PrintFileType fileType)
        {
            var            storeInfo = StoreBasicInfo.GetStore(reimageInfo.USCode);
            StoreBasicInfo store     = storeInfo.StoreBasicInfo;

            //生成Print文件
            var printDic = new Dictionary <string, string>();

            printDic.Add("WorkflowName", FlowCode.Reimage);
            printDic.Add("ProjectID", entity.ProjectId);
            printDic.Add("USCode", reimageInfo.USCode);
            printDic.Add("Region", store.RegionENUS);
            printDic.Add("Market", store.MarketENUS);
            printDic.Add("City", store.CityENUS);
            printDic.Add("AddressZHCN", store.AddressZHCN);
            printDic.Add("OpenDate", store.OpenDate.ToString("yyyy-MM-dd"));
            if (store.CloseDate.HasValue && store.CloseDate.Value.Year == 1900)
            {
                printDic.Add("ClosureDate", string.Empty);
            }
            else
            {
                printDic.Add("ClosureDate", store.CloseDate.HasValue ? (store.CloseDate.Value.ToString("yyyy-MM-dd")) : "");
            }
            printDic.Add("AssetsManager", storeInfo.StoreDevelop.AssetMgrName);
            printDic.Add("AssetsRep", storeInfo.StoreDevelop.AssetRepName);
            printDic.Add("StoreAge", (DateTime.Now.Year - store.OpenDate.Year).ToString());
            var currentLeaseENDYear = storeInfo.CurrentYear - int.Parse(storeInfo.StoreContractInfo.EndYear);

            printDic.Add("CurrentLeaseENDYear", currentLeaseENDYear.ToString());
            printDic.Add("StoreNameEN", store.NameENUS);
            printDic.Add("StoreNameCN", store.NameENUS);
            var RmgSummaryentity     = ReimageSummary.FirstOrDefault(e => e.ProjectId.Equals(entity.ProjectId) && e.IsHistory == false);
            var financialPreanalysis = FinancialPreanalysis.FirstOrDefault(e => e.RefId.Equals(RmgSummaryentity.Id));

            printDic.Add("SalesBuildingInvestment", financialPreanalysis.SalesBuildingInvestment);
            printDic.Add("NoneSalesBuildingInvst", financialPreanalysis.NoneSalesBuildingInvst);
            printDic.Add("TTMSales", financialPreanalysis.TTMSales.HasValue ? Math.Round(financialPreanalysis.TTMSales.Value, 2).ToString() : string.Empty);
            var reimage = ReimageConsInfo.GetConsInfo(entity.ProjectId, "");
            ReinvestmentCost reinCost = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == reimage.Id);

            printDic.Add("TotalReinvestmentNorm", reinCost.TotalReinvestmentNorm);
            printDic.Add("TotalSalesInc", financialPreanalysis.TotalSalesInc);
            printDic.Add("ROI", financialPreanalysis.ROI);
            ////printDic.Add("SalesInc", financialPreanalysis.ROI);
            printDic.Add("PaybackYears", financialPreanalysis.PaybackYears);
            printDic.Add("StoreCM", financialPreanalysis.StoreCM);
            printDic.Add("EstimatedWriteOffCost", financialPreanalysis.EstimatedWriteOffCost);
            printDic.Add("MarginInc", financialPreanalysis.MarginInc);
            printDic.Add("ISDWIP", financialPreanalysis.ISDWIP);
            printDic.Add("CurrStorePricingTier", financialPreanalysis.CurrentPriceTier);
            printDic.Add("SPTAR", financialPreanalysis.SPTAR);

            //Submission and Approval Records - 只显示通过意见
            List <SubmissionApprovalRecord> recordList = new List <SubmissionApprovalRecord>();
            //Submission and Approval Records Details — 所有意见
            List <SubmissionApprovalRecord> recordDetailList = new List <SubmissionApprovalRecord>();

            ProjectComment          projectCommentBll = new ProjectComment();
            ProjectCommentCondition condition         = new ProjectCommentCondition();
            var package = ReimagePackage.Get(entity.ProjectId);

            condition.RefTableName = ReimagePackage.TableName;
            condition.RefTableId   = entity.Id;
            condition.SourceCode   = FlowCode.Reimage;

            var commentList       = VProjectComment.SearchVListForPDF(condition);
            var commentDetailList = VProjectComment.SearchVList(condition);

            SubmissionApprovalRecord record = null;

            foreach (var item in commentList)
            {
                record            = new SubmissionApprovalRecord();
                record.ActionName = item.ActionDesc;
                if (item.CreateTime != null)
                {
                    record.OperationDate = item.CreateTime.Value;
                }
                record.OperatorID    = item.UserAccount;
                record.OperatorName  = item.UserNameENUS;
                record.OperatorTitle = item.PositionName;
                record.Comments      = item.Content;
                recordList.Add(record);
            }
            foreach (var item in commentDetailList)
            {
                record            = new SubmissionApprovalRecord();
                record.ActionName = item.ActionDesc;
                if (item.CreateTime != null)
                {
                    record.OperationDate = item.CreateTime.Value;
                }
                record.OperatorID    = item.UserAccount;
                record.OperatorName  = item.UserNameENUS;
                record.OperatorTitle = item.PositionName;
                record.Comments      = item.Content;
                recordDetailList.Add(record);
            }



            string result = string.Empty;

            if (fileType == PrintFileType.Pdf)
            {
                result = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.Reimage, printDic, recordList, recordDetailList);
            }
            else
            {
                result = HtmlConversionUtility.ConvertToImage(HtmlTempalteType.Reimage, printDic, recordList, recordDetailList);
            }
            return(result);
        }
Esempio n. 17
0
 public IHttpActionResult ApproveConsInfo(ReimageConsInfo entity)
 {
     // entity.ExecuteProcess(ClientCookie.UserCode, sn, "Approve", comment);
     entity.ApproveConsInfo(ClientCookie.UserCode);
     return(Ok(entity));
 }
Esempio n. 18
0
        public IHttpActionResult ResubmitConsInfo(ReimageConsInfo entity)
        {
            entity.ResubmitConsInfo(ClientCookie.UserCode);

            return(Ok(entity));
        }
Esempio n. 19
0
        protected static BaseWFEntity GetEmptyWorkflowEntity(string flowCode)
        {
            BaseWFEntity wfEntity = null;

            switch (flowCode)
            {
            case FlowCode.MajorLease:
                wfEntity = new MajorLeaseInfo();
                wfEntity.IsMainProject = true;
                break;

            case FlowCode.MajorLease_LegalReview:
                wfEntity = new MajorLeaseLegalReview();
                break;

            case FlowCode.MajorLease_FinanceAnalysis:
                wfEntity = new MajorLeaseFinancAnalysis();
                break;

            case FlowCode.MajorLease_ConsInfo:
                wfEntity = new MajorLeaseConsInfo();
                break;

            case FlowCode.MajorLease_Package:
                wfEntity = new MajorLeaseChangePackage();
                break;

            case FlowCode.MajorLease_ConsInvtChecking:
                wfEntity = new MajorLeaseConsInvtChecking();
                break;

            case FlowCode.MajorLease_GBMemo:
                wfEntity = new MajorLeaseGBMemo();
                break;

            case FlowCode.Closure:
                wfEntity = new ClosureInfo();
                wfEntity.IsMainProject = true;
                break;

            case FlowCode.Closure_ClosurePackage:
                wfEntity = new ClosurePackage();
                break;

            case FlowCode.Closure_ClosureTool:
                wfEntity = new ClosureTool();
                break;

            case FlowCode.Closure_ConsInvtChecking:
                wfEntity = new ClosureConsInvtChecking();
                break;

            case FlowCode.Closure_LegalReview:
                wfEntity = new ClosureLegalReview();
                break;

            case FlowCode.Closure_WOCheckList:
                wfEntity = new ClosureWOCheckList();
                break;

            case FlowCode.Closure_ExecutiveSummary:
                wfEntity = new ClosureExecutiveSummary();
                break;

            case FlowCode.TempClosure:
                wfEntity = new TempClosureInfo();
                wfEntity.IsMainProject = true;
                break;

            case FlowCode.TempClosure_LegalReview:
                wfEntity = new TempClosureLegalReview();
                break;

            case FlowCode.TempClosure_ClosurePackage:
                wfEntity = new TempClosurePackage();
                break;

            case FlowCode.Rebuild:
                wfEntity = new RebuildInfo();
                wfEntity.IsMainProject = true;
                break;

            case FlowCode.Rebuild_LegalReview:
                wfEntity = new RebuildLegalReview();
                break;

            case FlowCode.Rebuild_FinanceAnalysis:
                wfEntity = new RebuildFinancAnalysis();
                break;

            case FlowCode.Rebuild_ConsInfo:
                wfEntity = new RebuildConsInfo();
                break;

            case FlowCode.Rebuild_Package:
                wfEntity = new RebuildPackage();
                break;

            case FlowCode.Rebuild_ConsInvtChecking:
                wfEntity = new RebuildConsInvtChecking();
                break;

            case FlowCode.Rebuild_GBMemo:
                wfEntity = new GBMemo();
                break;

            case FlowCode.Renewal:
                wfEntity = new RenewalInfo();
                wfEntity.IsMainProject = true;
                break;

            case FlowCode.Renewal_Letter:
                wfEntity = new RenewalLetter();
                break;

            case FlowCode.Renewal_LLNegotiation:
                wfEntity = new RenewalLLNegotiation();
                break;

            case FlowCode.Renewal_ConsInfo:
                wfEntity = new RenewalConsInfo();
                break;

            case FlowCode.Renewal_Tool:
                wfEntity = new RenewalTool();
                break;

            case FlowCode.Renewal_Analysis:
                wfEntity = new RenewalAnalysis();
                break;

            case FlowCode.Renewal_ClearanceReport:
                wfEntity = new RenewalClearanceReport();
                break;

            case FlowCode.Renewal_ConfirmLetter:
                wfEntity = new RenewalConfirmLetter();
                break;

            case FlowCode.Renewal_LegalApproval:
                wfEntity = new RenewalLegalApproval();
                break;

            case FlowCode.Renewal_Package:
                wfEntity = new RenewalPackage();
                break;

            case FlowCode.Renewal_GBMemo:
                wfEntity = new RenewalGBMemo();
                break;

            case FlowCode.Reimage:
                wfEntity = new ReimageInfo();
                wfEntity.IsMainProject = true;
                break;

            case FlowCode.Reimage_ConsInfo:
                wfEntity = new ReimageConsInfo();
                break;

            case FlowCode.Reimage_Summary:
                wfEntity = new ReimageSummary();
                break;

            case FlowCode.Reimage_Package:
                wfEntity = new ReimagePackage();
                break;

            case FlowCode.Reimage_ConsInvtChecking:
                wfEntity = new ReimageConsInvtChecking();
                break;

            case FlowCode.Reimage_GBMemo:
                wfEntity = new ReimageGBMemo();
                break;
            }
            return(wfEntity);
        }
Esempio n. 20
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;

            //}
        }