Esempio n. 1
0
        public void Save(string action = "")
        {
            using (var scope = new TransactionScope())
            {
                if (this.Id == Guid.Empty)
                {
                    Id                = Guid.NewGuid();
                    CreateTime        = DateTime.Now;
                    LastUpdateTime    = DateTime.Now;
                    CreateUserAccount = ClientCookie.UserCode;

                    IsHistory = false;

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

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

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

                scope.Complete();
            }
        }
Esempio n. 2
0
        public StoreProfitabilityAndLeaseInfo GetStore(string projectId)
        {
            string pageType       = "";
            var    store          = new StoreProfitabilityAndLeaseInfo();
            var    reimageSummary = FirstOrDefault(e => e.ProjectId == projectId && e.IsHistory == false);

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

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

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

                //store.AsOf =DateTime.Parse(DateTime.Now.Year + "/" + latestMonth + "/01");
                //store.TTMSales = data.Total_Sales_TTM.As<decimal>();
                //store.TTMSOIPercent = data.SOIPct_TTM.As<decimal>();
                if (store == null)
                {
                    store = new StoreProfitabilityAndLeaseInfo();
                }
                DateTime?dt = storeBasicInfo.ReImageDate;
                if (dt != null)
                {
                    if (dt.ToString().Substring(0, 8) == "1/1/1900")
                    {
                        dt = null;
                    }
                }
                store.LastRemodelDate = dt;
                //store.RemainingLeaseYears = Year;
            }
            return(store);
        }