public void UpdateStoreLLRecord() { var info = RenewalInfo.Get(this.ProjectId); var negotiations = RenewalLLNegotiationRecord.GetRecords(this.Id); if (negotiations.Count > 0) { StoreSTLLRecord record = StoreSTLLRecord.Get(info.USCode); if (record == null) { var storeBasic = StoreBasicInfo.GetStorInfo(info.USCode); record = new StoreSTLLRecord(); record.StoreCode = info.USCode; record.StoreID = storeBasic.StoreID; record.Id = Guid.NewGuid(); } record.LLparticipants = negotiations[0].LLParticipants; record.Location = negotiations[0].Location; record.McdParticipants = negotiations[0].McdParticipants; record.Content = negotiations[0].Content; record.CreatedTime = negotiations[0].CreateTime; record.Topic = negotiations[0].Topic; record.Save(); var storeNegos = negotiations.Select(n => new StoreSTNegotiation { Id = Guid.NewGuid(), StoreID = record.StoreID, StoreCode = record.StoreCode, IsBroker = record.IsBroker, BrokerName = record.BrokerName, DateTime = n.Date.Value.ToString("yyyy-MM-dd"), Location = n.Location, Topic = n.Topic, McdParticipants = n.McdParticipants, McdParticipantsAD = record.McdParticipantsAD, LLparticipants = n.LLParticipants, Content = n.Content, CreatedTime = n.CreateTime }).ToArray(); StoreSTNegotiation.Add(storeNegos); } }
public static StoreInfo GetStore(string usCode) { string _USCode = usCode; List <StoreBasicInfo> lsStoreBasicInfo = new List <StoreBasicInfo>(); StoreBasicInfo mStoreBasicInfo = new StoreBasicInfo(); lsStoreBasicInfo = StoreBasicInfo.Search(o => o.StoreCode.Contains(_USCode)).AsNoTracking().ToList <StoreBasicInfo>(); if (lsStoreBasicInfo.Count > 0) { mStoreBasicInfo = lsStoreBasicInfo[0]; } List <StoreDevelop> lsStoreDevelop = new List <StoreDevelop>(); StoreDevelop mStoreDevelop = new StoreDevelop(); lsStoreDevelop = StoreDevelop.Search(o => o.StoreCode.Contains(_USCode)).AsNoTracking().ToList <StoreDevelop>(); if (lsStoreDevelop.Count > 0) { mStoreDevelop = lsStoreDevelop[0]; } List <StoreOps> lsStoreOp = new List <StoreOps>(); StoreOps mStoreOp = new StoreOps(); lsStoreOp = StoreOps.Search(o => o.StoreCode.Contains(_USCode)).AsNoTracking().ToList <StoreOps>(); if (lsStoreOp.Count > 0) { mStoreOp = lsStoreOp[0]; } List <StoreContractInfo> lsStoreContractInfo = new List <StoreContractInfo>(); StoreContractInfo mStoreContractInfo = new StoreContractInfo(); lsStoreContractInfo = StoreContractInfo.Search(o => o.StoreCode.Contains(_USCode)).AsNoTracking() .OrderByDescending(o => o.CreatedTime).ToList <StoreContractInfo>(); if (lsStoreContractInfo.Count > 0) { mStoreContractInfo = lsStoreContractInfo[0]; } List <StoreSTLocation> lsStoreSTLocation = new List <StoreSTLocation>(); StoreSTLocation mStoreSTLocation = new StoreSTLocation(); lsStoreSTLocation = StoreSTLocation.Search(o => o.StoreCode.Contains(_USCode)).AsNoTracking().ToList <StoreSTLocation>(); if (lsStoreSTLocation.Count > 0) { mStoreSTLocation = lsStoreSTLocation[0]; } List <StoreSTLLRecord> lsStoreSTLLRecord = new List <StoreSTLLRecord>(); StoreSTLLRecord mStoreSTLLRecord = new StoreSTLLRecord(); lsStoreSTLLRecord = StoreSTLLRecord.Search(o => o.StoreCode.Contains(_USCode)).AsNoTracking().ToList <StoreSTLLRecord>(); if (lsStoreSTLLRecord.Count > 0) { mStoreSTLLRecord = lsStoreSTLLRecord[0]; } int?beId = StoreBEInfo.Search(o => o.StoreCode.Contains(_USCode)).AsNoTracking().Select(be => be.BEID).FirstOrDefault(); StoreBEContractInfo storeBeContractInfo = StoreBEContractInfo.FirstOrDefault(c => c.BEID == beId); //StoreContractRevision = new StoreContractRevision(), // StoreContractInfoAttached = new StoreContractInfoAttached() var lsStoreBEInfo = StoreBEInfo.Search(o => o.StoreCode == _USCode).AsNoTracking().ToList <StoreBEInfo>(); List <StoreBEInfo> remoteBeList = new List <StoreBEInfo>(); List <StoreBEInfo> attachedBeList = new List <StoreBEInfo>(); List <StoreBEInfo> mdsList = new List <StoreBEInfo>(); List <StoreBEInfo> mcCafeList = new List <StoreBEInfo>(); List <StoreBEInfo> hour24List = new List <StoreBEInfo>(); if (lsStoreBEInfo.Count > 0) { foreach (var beInfo in lsStoreBEInfo) { switch (beInfo.BETypeName) { case "Remote Kiosk": remoteBeList.Add(beInfo); break; case "Attached Kiosk": attachedBeList.Add(beInfo); break; case "MDS": mdsList.Add(beInfo); break; case "McCafe": mcCafeList.Add(beInfo); break; case "24 Hour": hour24List.Add(beInfo); break; } } } var resultStoreAllInfo = new StoreInfo { StoreBasicInfo = mStoreBasicInfo, StoreDevelop = mStoreDevelop, StoreOp = mStoreOp, StoreContractInfo = mStoreContractInfo, StoreSTLocation = mStoreSTLocation, StoreSTLLRecord = mStoreSTLLRecord, StoreBeContractInfo = storeBeContractInfo, StoreBEInfoList = lsStoreBEInfo, CurrentYear = DateTime.Now.Year, RemoteBeCount = remoteBeList.Count, AttachedBeCount = attachedBeList.Count, MDSBeCount = mdsList.Count, MCCafeCount = mcCafeList.Count, Hour24Count = hour24List.Count }; return(resultStoreAllInfo); }