コード例 #1
0
        public IHttpActionResult GetById(string Id)
        {
            Guid _Id;

            if (!Guid.TryParse(Id, out _Id))
            {
                return(Ok());
            }
            var entity = ClosureWOCheckList.Get(_Id);

            if (entity != null)
            {
                ProjectCommentCondition condition = new ProjectCommentCondition();
                condition.RefTableId   = entity.Id;
                condition.RefTableName = ClosureWOCheckList.TableName;
                condition.UserAccount  = ClientCookie.UserCode;
                condition.Status       = ProjectCommentStatus.Save;
                var commentList = ProjectComment.SearchList(condition);
                if (commentList != null && commentList.Count > 0)
                {
                    entity.Comments = commentList[0].Content;
                }
                var closureEntity = ClosureInfo.GetByProjectId(entity.ProjectId);
                entity.USCode      = closureEntity.USCode;
                entity.UserAccount = ClientCookie.UserCode;
            }
            return(Ok(entity));
        }
コード例 #2
0
        public IHttpActionResult GetOnline(string projectID)
        {
            var closure    = ClosureInfo.GetByProjectId(projectID);
            var store      = StoreBasicInfo.GetStore(closure.USCode);
            var toolEntity = ClosureTool.Get(closure.ProjectId);
            var woEntity   = ClosureWOCheckList.Get(closure.ProjectId);

            List <StoreBEInfo> remoteBeList   = new List <StoreBEInfo>();
            List <StoreBEInfo> attachedBeList = new List <StoreBEInfo>();
            StoreBEInfo        mds            = null;
            StoreBEInfo        mcCafe         = null;
            StoreBEInfo        hour24         = null;

            if (store.StoreBEInfoList.Count > 0)
            {
                foreach (var beInfo in store.StoreBEInfoList)
                {
                    switch (beInfo.BETypeName)
                    {
                    case "Remote Kiosk":
                        remoteBeList.Add(beInfo);
                        break;

                    case "Attach Kiosk":
                        attachedBeList.Add(beInfo);
                        break;

                    case "MDS":
                        mds = beInfo;
                        break;

                    case "McCafe":
                        mcCafe = beInfo;
                        break;

                    case "24 Hour":
                        hour24 = beInfo;
                        break;
                    }
                }
            }
            return(Ok(new
            {
                Store = store,
                ClosureTool = toolEntity,
                WOCheckList = woEntity,
                RemoteBeList = remoteBeList,
                AttachedBeList = attachedBeList,
                MDS = mds,
                McCafe = mcCafe,
                Hour24 = hour24
            }));
        }
コード例 #3
0
        public IHttpActionResult UploadClosingCost(string projectid)
        {
            HttpRequest        request     = System.Web.HttpContext.Current.Request;
            HttpFileCollection FileCollect = request.Files;
            int    result       = 0;
            string resultStr    = string.Empty;
            string internalName = string.Empty;


            if (FileCollect.Count > 0) //如果集合的数量大于0
            {
                var woEntity = ClosureWOCheckList.Get(projectid);

                //用key获取单个文件对象HttpPostedFile
                HttpPostedFile fileSave      = FileCollect[0];
                string         fileExtension = Path.GetExtension(fileSave.FileName);
                string         fileName      = "ClosingCost" + fileExtension;
                var            current       = System.Web.HttpContext.Current;

                internalName = Guid.NewGuid() + fileExtension;
                string absolutePath = current.Server.MapPath("~/") + "UploadFiles/" + internalName;

                fileSave.SaveAs(absolutePath);

                Attachment att = new Attachment();
                att.InternalName    = internalName;
                att.RefTableName    = ClosureWOCheckList.TableName;
                att.RefTableID      = woEntity.Id.ToString();
                att.RelativePath    = "//";
                att.Name            = fileName;
                att.Extension       = fileExtension;
                att.Length          = FileCollect[0].ContentLength;
                att.CreateTime      = DateTime.Now;
                att.TypeCode        = "ClosingCost";
                att.CreatorNameENUS = ClientCookie.UserNameENUS;
                att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
                att.CreatorID       = ClientCookie.UserCode;

                Attachment.SaveSigleFile(att);

                var currentNode = NodeInfo.GetCurrentNode(projectid, FlowCode.Closure_WOCheckList);
                var newNode     = NodeInfo.GetNodeInfo(NodeCode.Closure_WOCheckList_ClosingCost);
                if (newNode.Sequence > currentNode.Sequence)
                {
                    ProjectInfo.FinishNode(projectid, FlowCode.Closure_WOCheckList,
                                           NodeCode.Closure_WOCheckList_ClosingCost);
                }
            }

            return(Ok(NodeCode.Closure_WOCheckList_Approve));
        }
コード例 #4
0
        public IHttpActionResult UploadAttachement(string id)
        {
            HttpRequest        request     = System.Web.HttpContext.Current.Request;
            HttpFileCollection FileCollect = request.Files;
            int    result       = 0;
            string resultStr    = string.Empty;
            string internalName = string.Empty;

            if (FileCollect.Count > 0) //如果集合的数量大于0
            {
                var woEntity = ClosureWOCheckList.Get(id);


                for (int i = 0; i < FileCollect.Count; i++)
                {
                    var fileSave = FileCollect[i];
                    //用key获取单个文件对象HttpPostedFile

                    string fileName      = Path.GetFileName(fileSave.FileName);
                    string fileExtension = Path.GetExtension(fileSave.FileName);
                    var    current       = System.Web.HttpContext.Current;
                    internalName = Guid.NewGuid() + fileExtension;
                    string absolutePath = current.Server.MapPath("~/") + "UploadFiles/" + internalName;

                    fileSave.SaveAs(absolutePath);

                    Attachment att = new Attachment();
                    att.InternalName    = internalName;
                    att.RefTableName    = ClosureWOCheckList.TableName;
                    att.RefTableID      = woEntity.Id.ToString();
                    att.RelativePath    = "//";
                    att.Name            = fileName;
                    att.Extension       = fileExtension;
                    att.Length          = FileCollect[0].ContentLength;
                    att.CreateTime      = DateTime.Now;
                    att.ID              = Guid.NewGuid();
                    att.TypeCode        = "Attachment";
                    att.CreatorNameENUS = ClientCookie.UserNameENUS;
                    att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
                    att.CreatorID       = ClientCookie.UserCode;
                    _db.Attachment.Add(att);
                    result = _db.SaveChanges();
                }

                resultStr = SiteInfo.WebUrl + "UploadFiles/" + internalName;
            }
            return(Ok(resultStr));
        }
コード例 #5
0
        public IHttpActionResult GetHistoryTemplates(Guid entityId)
        {
            Attachment att = new Attachment();

            var entity = ClosureWOCheckList.Get(entityId);

            List <Attachment> list = null;

            if (entity != null)
            {
                list = Attachment.GetList(ClosureWOCheckList.TableName, entity.Id.ToString(), "Template");
                foreach (var item in list)
                {
                    //item.FileURL = SiteFilePath.UploadFiles_URL + item.InternalName;
                    item.FileURL = SiteInfo.ServiceUrl + "api/attachment/download?id=" + item.ID;
                }
            }
            return(Ok(list));
        }
コード例 #6
0
        public IHttpActionResult GetByProjectId(string projectId)
        {
            var entity = ClosureWOCheckList.Get(projectId);

            if (entity != null)
            {
                ProjectCommentCondition condition = new ProjectCommentCondition();
                condition.RefTableId   = entity.Id;
                condition.RefTableName = ClosureWOCheckList.TableName;
                condition.UserAccount  = ClientCookie.UserCode;
                condition.Status       = ProjectCommentStatus.Save;
                var commentList = ProjectComment.SearchList(condition);
                if (commentList != null && commentList.Count > 0)
                {
                    entity.Comments = commentList[0].Content;
                }
                var closureEntity = ClosureInfo.GetByProjectId(entity.ProjectId);
                entity.USCode      = closureEntity.USCode;
                entity.UserAccount = ClientCookie.UserCode;

                if (string.IsNullOrEmpty(entity.PMSupervisorAccount))
                {
                    var puser = ProjectUsers.FirstOrDefault(i => i.ProjectId == entity.ProjectId && i.RoleCode == ProjectUserRoleCode.CM);
                    if (puser != null)
                    {
                        entity.PMSupervisorAccount = puser.UserAccount;
                    }
                }
                // entity.Comments = GetCommers(entity);
                //string pmAccount = closureEntity.PMAccount;
                //entity.PMSupervisorAccount = userPositionHandler.GetReportToAccounts(pmAccount);
                //string[] accounts = {UserPositionHandler.IT,UserPositionHandler.MCCL_Construction_Mgr};



                //var positionlist = userPositionHandler.SearchUserPosition(closureEntity.USCode,accounts);
                //string mcclApprover = userPositionHandler.GetAccounts(positionlist);
                //entity.MCCLApproverAccount = mcclApprover;
            }
            return(Ok(entity));
        }
コード例 #7
0
        public IHttpActionResult DownLoadTemplate(string projectID)
        {
            var    current = System.Web.HttpContext.Current;
            string path    = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.Executive_Summary_Template;

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

            File.Copy(path, tempFilePath);
            var fileInfo      = new FileInfo(tempFilePath);
            var excelDirector = new ExcelDataInputDirector(fileInfo, ExcelDataInputType.ClosureExecutiveSummary);

            var closure   = ClosureInfo.GetByProjectId(projectID);
            var store     = StoreBasicInfo.GetStore(closure.USCode);
            var inputInfo = new ExcelInputDTO
            {
                StoreNameCN   = store.StoreBasicInfo.NameZHCN,
                USCode        = store.StoreBasicInfo.StoreCode,
                City          = store.StoreBasicInfo.CityENUS,
                Market        = store.StoreBasicInfo.MarketENUS,
                OpenDate      = store.StoreBasicInfo.OpenDate,
                Floor         = store.StoreSTLocation.Floor,
                TotalArea     = store.StoreSTLocation.TotalArea,
                TotalSeatsNo  = store.StoreSTLocation.TotalSeatsNo,
                BE            = store.StoreBEInfoList.Count,
                RentType      = store.StoreContractInfo.RentType,
                RentStructure = store.StoreContractInfo.RentStructure
            };


            var leaseRecapID = StoreContractInfo.SearchByProject(projectID).FirstOrDefault().LeaseRecapID ?? 0;
            var storeAtt     = StoreContractInfoAttached.Search(c => c.LeaseRecapID == leaseRecapID.ToString()).OrderByDescending(e => e.CreateDate).FirstOrDefault();

            if (storeAtt != null)
            {
                inputInfo.LeasingTerm = store.StoreContractInfo.LeasePurchaseTerm;
            }
            if (store.StoreContractInfo.RentCommencementDate.HasValue)
            {
                inputInfo.RentCommencementDate = store.StoreContractInfo.RentCommencementDate.Value;
            }

            if (store.StoreContractInfo.EndDate.HasValue)
            {
                inputInfo.LeaseExpirationDate = store.StoreContractInfo.EndDate.Value;
            }


            var toolEntity = ClosureTool.Get(closure.ProjectId);

            if (toolEntity != null)
            {
                if (toolEntity.TotalSales_Adjustment_RMB != null)
                {
                    inputInfo.TotalSales_TTM = string.Format("{0:f}", toolEntity.TotalSales_Adjustment_RMB);
                }
                if (toolEntity.CompSales_Adjustment != null)
                {
                    inputInfo.SalesComp_TTM = string.Format("{0:f}", toolEntity.CompSales_Adjustment);
                }
                if (toolEntity.CompCG_Adjustment != null)
                {
                    inputInfo.GCComp_TTM = string.Format("{0:f}", toolEntity.CompCG_Adjustment);
                }
                if (toolEntity.PAC_RMB_Adjustment != null)
                {
                    inputInfo.PAC_TTM = string.Format("{0:f}", toolEntity.PAC_RMB_Adjustment);
                }
                if (toolEntity.SOI_Adjustment != null)
                {
                    inputInfo.SOI_TTM = string.Format("{0:f}", toolEntity.SOI_Adjustment);
                }
                if (toolEntity.CashFlow_RMB_Adjustment != null)
                {
                    inputInfo.CASHFLOW_TTM = string.Format("{0:f}", toolEntity.CashFlow_RMB_Adjustment);
                }
                if (toolEntity.TotalSales_TTMY1 != null)
                {
                    inputInfo.TotalSales_TTMY1 = string.Format("{0:f}", toolEntity.TotalSales_TTMY1);
                }
                if (toolEntity.CompSales_TTMY1 != null)
                {
                    inputInfo.CompSales_TTMY1 = string.Format("{0:f}", toolEntity.CompSales_TTMY1);
                }
                if (toolEntity.CompGC_TTMY1 != null)
                {
                    inputInfo.CompGC_TTMY1 = string.Format("{0:f}", toolEntity.CompGC_TTMY1);
                }
                if (toolEntity.PAC_TTMY1 != null)
                {
                    inputInfo.PAC_TTMY1 = string.Format("{0:f}", toolEntity.PAC_TTMY1);
                }
                if (toolEntity.SOI_TTMY1 != null)
                {
                    inputInfo.SOI_TTMY1 = string.Format("{0:f}", toolEntity.SOI_TTMY1);
                }
                if (toolEntity.CashFlow_TTMY1 != null)
                {
                    inputInfo.CashFlow_TTMY1 = string.Format("{0:f}", toolEntity.CashFlow_TTMY1);
                }
                if (toolEntity.TotalSales_TTMY2 != null)
                {
                    inputInfo.TotalSales_TTMY2 = string.Format("{0:f}", toolEntity.TotalSales_TTMY2);
                }
                if (toolEntity.CompSales_TTMY2 != null)
                {
                    inputInfo.CompSales_TTMY2 = string.Format("{0:f}", toolEntity.CompSales_TTMY2);
                }
                if (toolEntity.CompGC_TTMY2 != null)
                {
                    inputInfo.CompGC_TTMY2 = string.Format("{0:f}", toolEntity.CompGC_TTMY2);
                }
                if (toolEntity.PAC_TTMY2 != null)
                {
                    inputInfo.PAC_TTMY2 = string.Format("{0:f}", toolEntity.PAC_TTMY2);
                }
                if (toolEntity.SOI_TTMY2 != null)
                {
                    inputInfo.SOI_TTMY2 = string.Format("{0:f}", toolEntity.SOI_TTMY2);
                }
                if (toolEntity.CashFlow_TTMY2 != null)
                {
                    inputInfo.CashFlow_TTMY2 = string.Format("{0:f}", toolEntity.CashFlow_TTMY2);
                }


                List <StoreBEInfo> remoteBeList   = new List <StoreBEInfo>();
                List <StoreBEInfo> attachedBeList = new List <StoreBEInfo>();
                StoreBEInfo        mds            = null;
                StoreBEInfo        mcCafe         = null;
                StoreBEInfo        hour24         = null;
                if (store.StoreBEInfoList.Count > 0)
                {
                    foreach (var beInfo in store.StoreBEInfoList)
                    {
                        switch (beInfo.BETypeName)
                        {
                        case "Remote Kiosk":
                            remoteBeList.Add(beInfo);
                            break;

                        case "Attached Kiosk":
                            attachedBeList.Add(beInfo);
                            break;

                        case "MDS":
                            mds = beInfo;
                            break;

                        case "McCafe":
                            mcCafe = beInfo;
                            break;

                        case "24 Hour":
                            hour24 = beInfo;
                            break;
                        }
                    }
                }
                if (remoteBeList.Count > 0)
                {
                    inputInfo.RemoteKiosk1_Status   = remoteBeList[0].IsSingleContract == 1 ? "Yes" : "No";
                    inputInfo.RemoteKiosk1_OpenDate = remoteBeList[0].LaunchDate;
                    if (remoteBeList.Count > 1)
                    {
                        inputInfo.RemoteKiosk2_Status   = remoteBeList[1].IsSingleContract == 1 ? "Yes" : "No";
                        inputInfo.RemoteKiosk2_OpenDate = remoteBeList[1].LaunchDate;

                        if (remoteBeList.Count > 2)
                        {
                            inputInfo.RemoteKiosk3_Status   = remoteBeList[2].IsSingleContract == 1 ? "Yes" : "No";
                            inputInfo.RemoteKiosk3_OpenDate = remoteBeList[2].LaunchDate;
                        }
                    }
                }

                if (attachedBeList.Count > 0)
                {
                    inputInfo.AttachedKiosk1_Status   = attachedBeList[0].IsSingleContract == 1 ? "Yes" : "No";
                    inputInfo.AttachedKiosk1_OpenDate = attachedBeList[0].LaunchDate;
                    if (attachedBeList.Count > 1)
                    {
                        inputInfo.AttachedKiosk2_Status   = attachedBeList[1].IsSingleContract == 1 ? "Yes" : "No";
                        inputInfo.AttachedKiosk2_OpenDate = attachedBeList[1].LaunchDate;

                        if (attachedBeList.Count > 2)
                        {
                            inputInfo.AttachedKiosk3_Status   = attachedBeList[2].IsSingleContract == 1 ? "Yes" : "No";
                            inputInfo.AttachedKiosk3_OpenDate = attachedBeList[2].LaunchDate;
                        }
                    }
                }
                if (mds != null)
                {
                    inputInfo.MDS_Status   = mds.IsSingleContract == 1 ? "Yes" : "No";
                    inputInfo.MDS_OpenDate = mds.LaunchDate;
                }
                if (mcCafe != null)
                {
                    inputInfo.McCafe_Status   = mcCafe.IsSingleContract == 1 ? "Yes" : "No";
                    inputInfo.McCafe_OpenDate = mcCafe.LaunchDate;
                }
                if (hour24 != null)
                {
                    inputInfo.TwentyFourHour_Status   = hour24.IsSingleContract == 1 ? "Yes" : "No";
                    inputInfo.TwentyFourHour_OpenDate = hour24.LaunchDate;
                }


                var woEntity = ClosureWOCheckList.Get(closure.ProjectId);
                if (woEntity != null)
                {
                    if (woEntity.LHI_NBV != null)
                    {
                        inputInfo.LHI_NBV = string.Format("{0:f}", woEntity.LHI_NBV);
                    }
                    if (woEntity.ESSD_NBV != null)
                    {
                        inputInfo.ESSD_NBV = string.Format("{0:f}", woEntity.ESSD_NBV);
                    }
                    if (woEntity.TotalCost_NBV != null)
                    {
                        inputInfo.TotalCost_NBV = string.Format("{0:f}", woEntity.TotalCost_NBV);
                    }
                }
            }

            excelDirector.Input(inputInfo);


            current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + DataConverter.ToHexString(SiteFilePath.Executive_Summary_Template));
            current.Response.ContentType = "application/octet-stream";
            current.Response.WriteFile("" + tempFilePath + "");
            current.Response.End();
            return(Ok());
        }
コード例 #8
0
        public IHttpActionResult GenExecutiveSummaty(ClosureExecutiveSummary entity)
        {
            if (!ClosureExecutiveSummary.Any(i => i.ProjectId == entity.ProjectId && i.IsHistory == false))
            {
                if (entity.Id == Guid.Empty || entity.Id == null)
                {
                    entity.Id = Guid.NewGuid();
                }
                entity.CreateTime     = DateTime.Now;
                entity.CreatorAccount = ClientCookie.UserCode;
                ClosureExecutiveSummary.Add(entity);
            }
            else
            {
                ClosureExecutiveSummary.Update(entity);
            }

            var    current          = System.Web.HttpContext.Current;
            string path             = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.Executive_Summary_Template;
            string internalFileName = Guid.NewGuid() + ".xlsx";
            string filePath         = SiteFilePath.UploadFiles_DIRECTORY + "\\" + internalFileName;

            File.Copy(path, filePath);
            var fileInfo         = new FileInfo(filePath);
            var excelPMTDirector = new ExcelDataInputDirector(fileInfo, ExcelDataInputType.ClosureExecutiveSummary);

            var closure   = ClosureInfo.GetByProjectId(entity.ProjectId);
            var store     = StoreBasicInfo.GetStore(closure.USCode);
            var inputInfo = new ExcelInputDTO
            {
                StoreNameCN        = store.StoreBasicInfo.NameZHCN,
                USCode             = store.StoreBasicInfo.StoreCode,
                City               = store.StoreBasicInfo.CityENUS,
                Market             = store.StoreBasicInfo.MarketENUS,
                OpenDate           = store.StoreBasicInfo.OpenDate,
                Floor              = store.StoreSTLocation.Floor,
                TotalArea          = store.StoreSTLocation.TotalArea,
                TotalSeatsNo       = store.StoreSTLocation.TotalSeatsNo,
                BE                 = store.StoreBEInfoList.Count,
                RentType           = store.StoreContractInfo.RentType,
                RentStructure      = store.StoreContractInfo.RentStructure,
                MiniMarket         = entity.MiniMarket,
                StoreLocation      = entity.StoreLocation,
                CurrentSituation   = entity.CurrentSituation,
                NegotiationHistory = entity.NegotiationHistory,
                ProposedSolution   = entity.ProposedSolution,
                SalesTransfer      = entity.SalesTransfer
            };


            var leaseRecapID = StoreContractInfo.SearchByProject(entity.ProjectId).FirstOrDefault().LeaseRecapID ?? 0;
            var storeAtt     = StoreContractInfoAttached.Search(c => c.LeaseRecapID == leaseRecapID.ToString()).OrderByDescending(e => e.CreateDate).FirstOrDefault();

            if (storeAtt != null)
            {
                inputInfo.LeasingTerm = store.StoreContractInfo.LeasePurchaseTerm;
            }
            if (store.StoreContractInfo.RentCommencementDate.HasValue)
            {
                inputInfo.RentCommencementDate = store.StoreContractInfo.RentCommencementDate.Value;
            }

            if (store.StoreContractInfo.EndDate.HasValue)
            {
                inputInfo.LeaseExpirationDate = store.StoreContractInfo.EndDate.Value;
            }


            var toolEntity = ClosureTool.Get(closure.ProjectId);

            if (toolEntity != null)
            {
                if (toolEntity.TotalSales_Adjustment_RMB != null)
                {
                    inputInfo.TotalSales_TTM = string.Format("{0:f}", toolEntity.TotalSales_Adjustment_RMB);
                }
                if (toolEntity.CompSales_Adjustment != null)
                {
                    inputInfo.SalesComp_TTM = string.Format("{0:f}", toolEntity.CompSales_Adjustment);
                }
                if (toolEntity.CompCG_Adjustment != null)
                {
                    inputInfo.GCComp_TTM = string.Format("{0:f}", toolEntity.CompCG_Adjustment);
                }
                if (toolEntity.PAC_Adjustment != null)
                {
                    inputInfo.PAC_TTM = string.Format("{0:f}", toolEntity.PAC_Adjustment);
                }
                if (toolEntity.SOI_Adjustment != null)
                {
                    inputInfo.SOI_TTM = string.Format("{0:f}", toolEntity.SOI_Adjustment);
                }
                if (toolEntity.CashFlow_RMB_Adjustment != null)
                {
                    inputInfo.CASHFLOW_TTM = string.Format("{0:f}", toolEntity.CashFlow_RMB_Adjustment);
                }
                if (toolEntity.TotalSales_TTMY1 != null)
                {
                    inputInfo.TotalSales_TTMY1 = string.Format("{0:f}", toolEntity.TotalSales_TTMY1);
                }
                if (toolEntity.CompSales_TTMY1 != null)
                {
                    inputInfo.CompSales_TTMY1 = string.Format("{0:f}", toolEntity.CompSales_TTMY1);
                }
                if (toolEntity.CompGC_TTMY1 != null)
                {
                    inputInfo.CompGC_TTMY1 = string.Format("{0:f}", toolEntity.CompGC_TTMY1);
                }
                if (toolEntity.PAC_TTMY1 != null)
                {
                    inputInfo.PAC_TTMY1 = string.Format("{0:f}", toolEntity.PAC_TTMY1);
                }
                if (toolEntity.SOI_TTMY1 != null)
                {
                    inputInfo.SOI_TTMY1 = string.Format("{0:f}", toolEntity.SOI_TTMY1);
                }
                if (toolEntity.CashFlow_TTMY1 != null)
                {
                    inputInfo.CashFlow_TTMY1 = string.Format("{0:f}", toolEntity.CashFlow_TTMY1);
                }
                if (toolEntity.TotalSales_TTMY2 != null)
                {
                    inputInfo.TotalSales_TTMY2 = string.Format("{0:f}", toolEntity.TotalSales_TTMY2);
                }
                if (toolEntity.CompSales_TTMY2 != null)
                {
                    inputInfo.CompSales_TTMY2 = string.Format("{0:f}", toolEntity.CompSales_TTMY2);
                }
                if (toolEntity.CompGC_TTMY2 != null)
                {
                    inputInfo.CompGC_TTMY2 = string.Format("{0:f}", toolEntity.CompGC_TTMY2);
                }
                if (toolEntity.PAC_TTMY2 != null)
                {
                    inputInfo.PAC_TTMY2 = string.Format("{0:f}", toolEntity.PAC_TTMY2);
                }
                if (toolEntity.SOI_TTMY2 != null)
                {
                    inputInfo.SOI_TTMY2 = string.Format("{0:f}", toolEntity.SOI_TTMY2);
                }
                if (toolEntity.CashFlow_TTMY2 != null)
                {
                    inputInfo.CashFlow_TTMY2 = string.Format("{0:f}", toolEntity.CashFlow_TTMY2);
                }


                List <StoreBEInfo> remoteBeList   = new List <StoreBEInfo>();
                List <StoreBEInfo> attachedBeList = new List <StoreBEInfo>();
                StoreBEInfo        mds            = null;
                StoreBEInfo        mcCafe         = null;
                StoreBEInfo        hour24         = null;
                if (store.StoreBEInfoList.Count > 0)
                {
                    foreach (var beInfo in store.StoreBEInfoList)
                    {
                        switch (beInfo.BETypeName)
                        {
                        case "Remote Kiosk":
                            remoteBeList.Add(beInfo);
                            break;

                        case "Attach Kiosk":
                            attachedBeList.Add(beInfo);
                            break;

                        case "MDS":
                            mds = beInfo;
                            break;

                        case "McCafe":
                            mcCafe = beInfo;
                            break;

                        case "24 Hour":
                            hour24 = beInfo;
                            break;
                        }
                    }
                }
                inputInfo.RemoteKiosk1_Status   = "No";
                inputInfo.RemoteKiosk2_Status   = "No";
                inputInfo.RemoteKiosk3_Status   = "No";
                inputInfo.AttachedKiosk1_Status = "No";
                inputInfo.AttachedKiosk2_Status = "No";
                inputInfo.AttachedKiosk3_Status = "No";
                inputInfo.MDS_Status            = "No";
                inputInfo.McCafe_Status         = "No";
                inputInfo.TwentyFourHour_Status = "No";

                if (remoteBeList.Count > 0)
                {
                    inputInfo.RemoteKiosk1_Status   = "Yes";
                    inputInfo.RemoteKiosk1_OpenDate = remoteBeList[0].LaunchDate;
                    if (remoteBeList.Count > 1)
                    {
                        inputInfo.RemoteKiosk2_Status   = "Yes";
                        inputInfo.RemoteKiosk2_OpenDate = remoteBeList[1].LaunchDate;

                        if (remoteBeList.Count > 2)
                        {
                            inputInfo.RemoteKiosk3_Status   = "Yes";
                            inputInfo.RemoteKiosk3_OpenDate = remoteBeList[2].LaunchDate;
                        }
                    }
                }

                if (attachedBeList.Count > 0)
                {
                    inputInfo.AttachedKiosk1_Status   = "Yes";
                    inputInfo.AttachedKiosk1_OpenDate = attachedBeList[0].LaunchDate;
                    if (attachedBeList.Count > 1)
                    {
                        inputInfo.AttachedKiosk2_Status   = "Yes";
                        inputInfo.AttachedKiosk2_OpenDate = attachedBeList[1].LaunchDate;

                        if (attachedBeList.Count > 2)
                        {
                            inputInfo.AttachedKiosk3_Status   = "Yes";
                            inputInfo.AttachedKiosk3_OpenDate = attachedBeList[2].LaunchDate;
                        }
                    }
                }
                if (mds != null)
                {
                    inputInfo.MDS_Status   = "Yes";
                    inputInfo.MDS_OpenDate = mds.LaunchDate;
                }
                if (mcCafe != null)
                {
                    inputInfo.McCafe_Status   = "Yes";
                    inputInfo.McCafe_OpenDate = mcCafe.LaunchDate;
                }
                if (hour24 != null)
                {
                    inputInfo.TwentyFourHour_Status   = "Yes";
                    inputInfo.TwentyFourHour_OpenDate = hour24.LaunchDate;
                }


                var woEntity = ClosureWOCheckList.Get(closure.ProjectId);
                if (woEntity != null)
                {
                    if (woEntity.LHI_NBV != null)
                    {
                        inputInfo.LHI_NBV = string.Format("{0:f}", woEntity.LHI_NBV);
                    }
                    if (woEntity.ESSD_NBV != null)
                    {
                        inputInfo.ESSD_NBV = string.Format("{0:f}", woEntity.ESSD_NBV);
                    }
                    if (woEntity.TotalCost_NBV != null)
                    {
                        inputInfo.TotalCost_NBV = string.Format("{0:f}", woEntity.TotalCost_NBV);
                    }
                }
            }

            excelPMTDirector.Input(inputInfo);

            Attachment att = Attachment.GetAttachment("ClosureExecutiveSummary", entity.Id.ToString(), "Template");

            if (att == null)
            {
                att = new Attachment();
                att.RefTableName    = "ClosureExecutiveSummary";
                att.RefTableID      = entity.Id.ToString();
                att.CreateTime      = DateTime.Now;
                att.ID              = Guid.NewGuid();
                att.TypeCode        = "Template";
                att.CreatorID       = ClientCookie.UserCode;
                att.CreatorNameENUS = ClientCookie.UserNameENUS;
                att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
                att.Name            = SiteFilePath.Executive_Summary_Template;
                att.InternalName    = internalFileName;
                att.Extension       = fileInfo.Extension;
                att.Length          = Convert.ToInt32(fileInfo.Length);
                att.RequirementId   = new Guid("79258ffb-c2ef-4eff-897d-ba8376c90071");
                Attachment.Add(att);
            }
            else
            {
                att.CreateTime      = DateTime.Now;
                att.CreatorID       = ClientCookie.UserCode;
                att.CreatorNameENUS = ClientCookie.UserNameENUS;
                att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
                att.Name            = SiteFilePath.Executive_Summary_Template;
                att.InternalName    = internalFileName;
                att.Extension       = fileInfo.Extension;
                att.Length          = Convert.ToInt32(fileInfo.Length);
                att.RequirementId   = new Guid("79258ffb-c2ef-4eff-897d-ba8376c90071");
                Attachment.Update(att);
            }

            ProjectInfo.FinishNode(entity.ProjectId, FlowCode.Closure_ExecutiveSummary, NodeCode.Closure_ExecutiveSummary_Generate);

            return(Ok());
        }
コード例 #9
0
        public IHttpActionResult DownLoadTemplate(string projectId)
        {
            var current = System.Web.HttpContext.Current;
            //string path = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.FAWrite_offTool_Template;


            //Excel excel = new Excel();
            //string templatePath = path;

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

            //var closure = ClosureInfo.GetByProjectId(projectId);
            //excel.Open(path);
            //excel.Save(tempFilePath);

            //var store = StoreBasicInfo.FirstOrDefault(e => e.StoreCode == closure.USCode);


            //Excel tempExcel = new Excel();
            //tempExcel.Open(tempFilePath);
            //var sheet = tempExcel.Sheets["PMT"];

            //sheet.Cells[1, 1].StrValue = store.RegionENUS;
            //sheet.Cells[2, 1].StrValue = store.MarketENUS;
            //sheet.Cells[3, 1].StrValue = store.NameZHCN;
            //sheet.Cells[4, 1].StrValue = closure.USCode;
            //sheet.Cells[5, 1].StrValue = store.StoreTypeName;
            //if (closure.ActualCloseDate != null)
            //{
            //    sheet.Cells[6, 1].StrValue = closure.ActualCloseDate.Value.ToString("yyyy-MM-dd");
            //}
            //sheet.Cells[7, 1].StrValue = "";//TODO::-Cary  GetPM

            //sheet.Cells[0, 7].StrValue = ConsInvtCheckingVersion;

            //tempExcel.Save(tempFilePath);


            //直接下载writeoff文件
            McdAMEntities _db         = new McdAMEntities();
            var           closureInfo = ClosureInfo.GetByProjectId(projectId);
            var           wo          = ClosureWOCheckList.Get(projectId);

            if (wo != null)
            {
                var att = _db.Attachment.FirstOrDefault(a => a.RefTableID == wo.Id.ToString() && a.TypeCode == "Template");

                string absolutePath = current.Server.MapPath("~/") + "UploadFiles/" + att.InternalName;
                string tempFilePath = current.Server.MapPath("~/") + "Temp\\" + Guid.NewGuid() + Path.GetExtension(absolutePath);

                File.Copy(absolutePath, tempFilePath);
                ExcelHelper.UpdateExcelVersionNumber(tempFilePath, ConsInvtCheckingVersion);

                var currentNode = NodeInfo.GetCurrentNode(projectId, FlowCode.Closure_ConsInvtChecking);
                var newNode     = NodeInfo.GetNodeInfo(NodeCode.Closure_ConsInvtChecking_DownLoadTemplate);
                if (newNode.Sequence > currentNode.Sequence)
                {
                    ProjectInfo.FinishNode(projectId, FlowCode.Closure_ConsInvtChecking, NodeCode.Closure_ConsInvtChecking_DownLoadTemplate);
                }

                current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + SiteFilePath.GetTemplateFileName(closureInfo.USCode, FlowCode.Closure_ConsInvtChecking, SiteFilePath.FAWrite_offTool_Template));
                current.Response.ContentType = "application/octet-stream";
                current.Response.WriteFile("" + tempFilePath + "");
                current.Response.End();
            }
            else
            {
                string path = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.FAWrite_offTool_Template;
                current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + SiteFilePath.GetTemplateFileName(closureInfo.USCode, FlowCode.Closure_ConsInvtChecking, SiteFilePath.FAWrite_offTool_Template));
                current.Response.ContentType = "application/octet-stream";
                current.Response.WriteFile("" + path + "");
                current.Response.End();
            }
            return(Ok());
        }
コード例 #10
0
        public IHttpActionResult UploadTemplate(string projectid)
        {
            HttpRequest        request      = System.Web.HttpContext.Current.Request;
            HttpFileCollection FileCollect  = request.Files;
            string             resultStr    = string.Empty;
            string             internalName = string.Empty;

            ClosureConsInvtChecking woEntity = null;
            bool isNew = false;

            if (FileCollect.Count > 0) //如果集合的数量大于0
            {
                //用key获取单个文件对象HttpPostedFile
                HttpPostedFile fileSave      = FileCollect[0];
                string         fileName      = Path.GetFileName(fileSave.FileName);
                string         fileExtension = Path.GetExtension(fileSave.FileName);
                var            current       = System.Web.HttpContext.Current;

                internalName = Guid.NewGuid() + fileExtension;
                string filePath = current.Server.MapPath("~/") + "UploadFiles\\" + internalName;
                //通过此对象获取文件名

                fileSave.SaveAs(filePath);

                string column = "E";
                woEntity = ClosureConsInvtChecking.Get(projectid);

                var fileInfo = new FileInfo(filePath);
                //验证上传EXCEL版本
                var vn = ExcelHelper.GetExcelVersionNumber(filePath);
                if (vn != ConsInvtCheckingVersion)
                {
                    PluploadHandler.WriteErrorMsg("上传附件版本号不一致");
                }

                var importDirector = new ExcelDataImportDirector(fileInfo, ExcelDataImportType.ClosureWOCheckList);

                if (woEntity == null)
                {
                    isNew                      = true;
                    woEntity                   = new ClosureConsInvtChecking();
                    woEntity.ProjectId         = projectid;
                    woEntity.Id                = Guid.NewGuid();
                    woEntity.CreateTime        = DateTime.Now;
                    woEntity.CreateUserAccount = ClientCookie.UserCode;

                    woEntity.IsHistory = false;
                }

                woEntity.TotalOriginalBudget = GetDecimalValue(importDirector, 16, column);
                woEntity.TotalNBVBudget      = GetDecimalValue(importDirector, 17, column);
                woEntity.TotalWriteoffBudget = GetDecimalValue(importDirector, 18, column);
                var woCheckList = ClosureWOCheckList.Get(projectid);
                if (woCheckList != null)
                {
                    if (!EqualValue(woCheckList.TotalCost_Original, woEntity.TotalOriginalBudget))
                    {
                        PluploadHandler.WriteErrorMsg("Total Budget 数据验证不通过,请检查后重试!");
                    }

                    if (!EqualValue(woCheckList.TotalCost_NBV, woEntity.TotalNBVBudget))
                    {
                        PluploadHandler.WriteErrorMsg("Total NBV(Closure Data) 数据验证不通过,请检查后重试!");
                    }

                    if (!EqualValue(woCheckList.TotalCost_WriteOFF, woEntity.TotalWriteoffBudget))
                    {
                        PluploadHandler.WriteErrorMsg("Total Write off 数据验证不通过,请检查后重试!");
                    }
                }
                woEntity.RECostBudget      = GetDecimalValue(importDirector, 19, column);
                woEntity.LHIBudget         = GetDecimalValue(importDirector, 20, column);
                woEntity.ESSDBudget        = GetDecimalValue(importDirector, 21, column);
                woEntity.EquipmentBudget   = GetDecimalValue(importDirector, 22, column);
                woEntity.SignageBudget     = GetDecimalValue(importDirector, 23, column);
                woEntity.SeatingBudget     = GetDecimalValue(importDirector, 24, column);
                woEntity.DecorationBudget  = GetDecimalValue(importDirector, 25, column);
                woEntity.ClosingCostBudegt = GetDecimalValue(importDirector, 26, column);

                woEntity.ClosingCostActual = GetDecimalValue(importDirector, 27, column);
                woEntity.TotalActual       = GetDecimalValue(importDirector, 28, column);

                woEntity.RECostActual     = GetDecimalValue(importDirector, 29, column);
                woEntity.LHIActual        = GetDecimalValue(importDirector, 30, column);
                woEntity.EquipmentActual  = GetDecimalValue(importDirector, 31, column);
                woEntity.SignageActual    = GetDecimalValue(importDirector, 32, column);
                woEntity.SeatingActual    = GetDecimalValue(importDirector, 33, column);
                woEntity.DecorationActual = GetDecimalValue(importDirector, 34, column);
                woEntity.RECostVsBudget   = GetDecimalValue(importDirector, 35, column);
                woEntity.LHIWOVsBudget    = GetDecimalValue(importDirector, 36, column);

                woEntity.ESSDWOVsBudget   = GetDecimalValue(importDirector, 37, column);
                woEntity.TTLWOVsBudget    = GetDecimalValue(importDirector, 38, column);
                woEntity.REExplanation    = GetStringValue(importDirector, 39, column);
                woEntity.LHIExplanation   = GetStringValue(importDirector, 40, column);
                woEntity.ESSDExplanation  = GetStringValue(importDirector, 41, column);
                woEntity.TotalExplanation = GetStringValue(importDirector, 42, column);


                Attachment att = Attachment.GetAttachment("ClosureConsInvtChecking", woEntity.Id.ToString(), "Template");
                if (att == null)
                {
                    att              = new Attachment();
                    att.ID           = Guid.NewGuid();
                    att.TypeCode     = "Template";
                    att.RefTableName = ClosureConsInvtChecking.TableName;
                    att.RefTableID   = woEntity.Id.ToString();
                    att.RelativePath = "//";
                }
                att.InternalName    = internalName;
                att.Name            = fileName;
                att.Extension       = fileExtension;
                att.Length          = FileCollect[0].ContentLength;
                att.CreateTime      = DateTime.Now;
                att.CreatorID       = ClientCookie.UserCode;
                att.CreatorNameENUS = ClientCookie.UserNameENUS;
                att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
                Attachment.SaveSigleFile(att);

                var currentNode = NodeInfo.GetCurrentNode(projectid, FlowCode.Closure_ConsInvtChecking);
                var newNode     = NodeInfo.GetNodeInfo(NodeCode.Closure_ConsInvtChecking_ResultUpload);
                if (newNode.Sequence > currentNode.Sequence)
                {
                    ProjectInfo.FinishNode(projectid, FlowCode.Closure_ConsInvtChecking, NodeCode.Closure_ConsInvtChecking_DownLoadTemplate);
                    ProjectInfo.FinishNode(projectid, FlowCode.Closure_ConsInvtChecking, NodeCode.Closure_ConsInvtChecking_WriteOffData);
                    ProjectInfo.FinishNode(projectid, FlowCode.Closure_ConsInvtChecking, NodeCode.Closure_ConsInvtChecking_ResultUpload);
                }

                if (isNew)
                {
                    ClosureConsInvtChecking.Add(woEntity);
                }
                else
                {
                    ClosureConsInvtChecking.Update(woEntity);
                }
            }
            return(Ok(woEntity));
        }
コード例 #11
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);
        }
コード例 #12
0
ファイル: ProjectController.cs プロジェクト: XiaoYaTech/Demo
        public IHttpActionResult RecallProject(PostSimpleWorkflowData postData)
        {
            ApiProxy.SetCookies(Request.RequestUri.Host, HttpContext.Current.Request.Cookies);
            var rootPath = string.Concat(HttpContext.Current.Request.Url.Scheme, @"://", HttpContext.Current.Request.Url.Authority, HttpContext.Current.Request.ApplicationPath);

            switch (postData.FlowCode)
            {
                #region Closure
            case FlowCode.Closure_WOCheckList:
            {
                var entity = ClosureWOCheckList.Get(postData.ProjectId);
                entity.Comments = postData.ProjectComment;
                var postDataBytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(entity));
                ApiProxy.Call(rootPath + "api/ClosureWOCheckList/Recall", "POST", null, postDataBytes);
            }
            break;

            case FlowCode.Closure_LegalReview:
            {
                var entity = ClosureLegalReview.Get(postData.ProjectId);
                entity.Comments = postData.ProjectComment;
                var postDataBytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(entity));
                ApiProxy.Call(rootPath + "api/LegalReview/Recall", "POST", null, postDataBytes);
            }
            break;

            case FlowCode.Closure_ClosurePackage:
            {
                var entity = ClosurePackage.Get(postData.ProjectId);
                entity.Comments = postData.ProjectComment;
                var postDataBytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(entity));
                ApiProxy.Call(rootPath + "api/ClosurePackage/Recall", "POST", null, postDataBytes);
            }
            break;

            case FlowCode.Closure_ConsInvtChecking:
            {
                var entity = ClosureConsInvtChecking.Get(postData.ProjectId);
                entity.Comments = postData.ProjectComment;
                var postDataBytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(entity));
                ApiProxy.Call(rootPath + "api/ClosureConsInvtChecking/Recall", "POST", null, postDataBytes);
            }
            break;

            case FlowCode.Closure_ClosureTool:
            {
                var entity = ClosureTool.Get(postData.ProjectId);
                entity.Comments = postData.ProjectComment;
                var postDataBytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(entity));
                ApiProxy.Call(rootPath + "api/closureTool/Recall", "POST", null, postDataBytes);
            }
            break;

                #endregion Closure
            default:
                var wfEntity = BaseWFEntity.GetWorkflowEntity(postData.ProjectId, postData.FlowCode);
                wfEntity.Recall(postData.ProjectComment);
                break;
            }
            return(Ok());
        }
コード例 #13
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;
            }
        }