public BtCFileInfo GetFackBtcFile(string UserName) { BOC.Entities.CompanyBtcFile lCompanyBtcFile = _BOCWebDBContext.CompanyBtcFiles.Where(e => e.CompanyName == UserName).FirstOrDefault(); int lCount = _BOCWebDBContext.CompanyBtcFileTradeds.Where(e => e.CompanyName == UserName).Count(); BtCFileInfo lBtCFileInfo = new BtCFileInfo(); lBtCFileInfo.CompanyBtCFile = new BOC.Entities.CompanyBtcFile(); lBtCFileInfo.CompanyBtCFile.CompanyLocalName = "******"; //lBtCFileInfo.CompanyBtCFile.CompanyProfile = "******"; //lBtCFileInfo.CompanyBtCFile.MainlyCutsTraded = "******"; lBtCFileInfo.CompanyBtCFile.CompanyYearFounded = "******"; if (lCompanyBtcFile != null) { lBtCFileInfo.CompanyBtCFile.CompanyType = lCompanyBtcFile.CompanyType; } else { lBtCFileInfo.CompanyBtCFile.CompanyType = "Not Set"; } lBtCFileInfo.CompanyBtCFileTradeList = new List<BOC.Entities.CompanyBtcFileTraded>(); if (lCount > 5) { lCount = 5; } for (int i = 0; i < lCount; i++) { BOC.Entities.CompanyBtcFileTraded lCompanyBtcFileTraded = new BOC.Entities.CompanyBtcFileTraded(); lBtCFileInfo.CompanyBtCFileTradeList.Add(lCompanyBtcFileTraded); } return lBtCFileInfo; }
private BtCFileInfo GetFackBtcFile(string UserName) { logger.InfoFormat("GetFackBtcFile [UserName:{0}]", UserName); BOC.Entities.CompanyBtcFile lCompanyBtcFile = _BOCWebDBContext.CompanyBtcFiles.Where(e => e.CompanyName == UserName).FirstOrDefault(); int lCount = _BOCWebDBContext.CompanyBtcFileTradeds.Where(e => e.CompanyName == UserName).Count(); BtCFileInfo lBtCFileInfo = new BtCFileInfo(); lBtCFileInfo.CompanyBtCFile = new BOC.Entities.CompanyBtcFile(); lBtCFileInfo.CompanyBtCFile.CompanyLocalName = "******"; lBtCFileInfo.CompanyBtCFile.CompanyYearFounded = "******"; if (lCompanyBtcFile != null) { lBtCFileInfo.CompanyBtCFile.CompanyType = lCompanyBtcFile.CompanyType; } else { lBtCFileInfo.CompanyBtCFile.CompanyType = "Not Set"; } if(lCompanyBtcFile != null) { if (lCompanyBtcFile.CompanyLocalName != null && lCompanyBtcFile.CompanyLocalName != "") { lBtCFileInfo.CompanyBtCFile.CompanyLocalName = "******"; } else { lBtCFileInfo.CompanyBtCFile.CompanyLocalName = "_none"; } if (lCompanyBtcFile.CompanyYearFounded != null && lCompanyBtcFile.CompanyYearFounded != "") { lBtCFileInfo.CompanyBtCFile.CompanyYearFounded = "******"; } else { lBtCFileInfo.CompanyBtCFile.CompanyYearFounded = "_none"; } if (lCompanyBtcFile.CompanyType != null && lCompanyBtcFile.CompanyType != "") { lBtCFileInfo.CompanyBtCFile.CompanyType = lCompanyBtcFile.CompanyType; } else { lBtCFileInfo.CompanyBtCFile.CompanyType = "_none"; } } else { lBtCFileInfo.CompanyBtCFile.CompanyLocalName = "_none"; lBtCFileInfo.CompanyBtCFile.CompanyYearFounded = "_none"; lBtCFileInfo.CompanyBtCFile.CompanyType = "_none"; } lBtCFileInfo.CompanyBtCFileTradeList = new List<BOC.Entities.CompanyBtcFileTraded>(); if (lCount > 5) { lCount = 5; } var lCompanyBtcFileTradeds = _BOCWebDBContext.CompanyBtcFileTradeds.Where(e => e.CompanyName == UserName); foreach (BOC.Entities.CompanyBtcFileTraded lCompanyBtcFileTraded in lCompanyBtcFileTradeds) { BOC.Entities.CompanyBtcFileTraded lCompanyBtcFileTradedTemp = new BOC.Entities.CompanyBtcFileTraded(); lCompanyBtcFileTradedTemp.IsCertificate = lCompanyBtcFileTraded.IsCertificate; lBtCFileInfo.CompanyBtCFileTradeList.Add(lCompanyBtcFileTradedTemp); } lBtCFileInfo.IsTrueBtcFile = false; return lBtCFileInfo; }
private CompanyAndBtcFile GetFackCompanyAndBtcFile(long CurrentOrderID, string SendUserName, string CurrentUserName) { CompanyAndBtcFile lCompanyAndBtcFile = new CompanyAndBtcFile(); BOC.Entities.Company TempCompany = _BOCWebDBContext.Companys.Where(e => e.LoginUserName == SendUserName).FirstOrDefault(); lCompanyAndBtcFile.Company = new BOC.Entities.Company(); if (TempCompany != null) { if (TempCompany.CompanyName != null && TempCompany.CompanyName != "") { lCompanyAndBtcFile.Company.CompanyName = "******"; } else { lCompanyAndBtcFile.Company.CompanyName = "_none"; } if (TempCompany.CompanyLocalName != null && TempCompany.CompanyLocalName != "") { lCompanyAndBtcFile.Company.CompanyLocalName = "******"; } else { lCompanyAndBtcFile.Company.CompanyLocalName = "_none"; } if (TempCompany.CompanyEmail != null && TempCompany.CompanyEmail != "") { lCompanyAndBtcFile.Company.CompanyEmail = "******"; } else { lCompanyAndBtcFile.Company.CompanyEmail = "_none"; } if (TempCompany.CompanyType != null && TempCompany.CompanyType != "") { lCompanyAndBtcFile.Company.CompanyType = "******"; } else { lCompanyAndBtcFile.Company.CompanyType = "_none"; } if (TempCompany.CompanyPhoneNumber != null && TempCompany.CompanyPhoneNumber != "") { lCompanyAndBtcFile.Company.CompanyPhoneNumber = "******"; } else { lCompanyAndBtcFile.Company.CompanyPhoneNumber = "_none"; } if (TempCompany.CompanyFaxNumber != null && TempCompany.CompanyFaxNumber != "") { lCompanyAndBtcFile.Company.CompanyFaxNumber = "******"; } else { lCompanyAndBtcFile.Company.CompanyFaxNumber = "_none"; } if (TempCompany.CompanyWebSite != null && TempCompany.CompanyWebSite != "") { lCompanyAndBtcFile.Company.CompanyWebSite = "******"; } else { lCompanyAndBtcFile.Company.CompanyWebSite = "_none"; } if (TempCompany.CompanyCountry != null && TempCompany.CompanyCountry != "") { lCompanyAndBtcFile.Company.CompanyCountry = TempCompany.CompanyCountry; } else { lCompanyAndBtcFile.Company.CompanyCountry = "_none"; } if (TempCompany.CompanyProvince != null && TempCompany.CompanyProvince != "") { if (lCompanyAndBtcFile.Company.CompanyCountry != "_china") { lCompanyAndBtcFile.Company.CompanyProvince = "******"; } else { lCompanyAndBtcFile.Company.CompanyProvince = TempCompany.CompanyProvince; } //lCompanyAndBtcFile.Company.CompanyProvince = TempCompany.CompanyProvince; } else { lCompanyAndBtcFile.Company.CompanyProvince = "_none"; } if (TempCompany.CompanyAddress != null && TempCompany.CompanyAddress != "") { lCompanyAndBtcFile.Company.CompanyAddress = "******"; } else { lCompanyAndBtcFile.Company.CompanyAddress = "_none"; } BOC.Entities.ContactPerson TempContactPerson = TempCompany.ContactPersons.FirstOrDefault(); lCompanyAndBtcFile.Company.ContactPersons = new List<BOC.Entities.ContactPerson>(); BOC.Entities.ContactPerson lContactPerson = new BOC.Entities.ContactPerson(); if (TempContactPerson != null) { if (TempContactPerson.ContactPersonName != null && TempContactPerson.ContactPersonName != "") { lContactPerson.ContactPersonName = "******"; } else { lContactPerson.ContactPersonName = "_none"; } if(TempContactPerson.ContactPersonEnglishName != null && TempContactPerson.ContactPersonEnglishName != "") { lContactPerson.ContactPersonEnglishName = "******"; } else { lContactPerson.ContactPersonEnglishName = "_none"; } if (TempContactPerson.ContactPersonCellPhoneNumber != null && TempContactPerson.ContactPersonCellPhoneNumber != "") { lContactPerson.ContactPersonCellPhoneNumber = "******"; } else { lContactPerson.ContactPersonCellPhoneNumber = "_none"; } } lCompanyAndBtcFile.Company.ContactPersons.Add(lContactPerson); } BOC.Entities.CompanyBtcFile lCompanyBtcFile = _BOCWebDBContext.CompanyBtcFiles.Where(e => e.CompanyName == SendUserName).FirstOrDefault(); lCompanyAndBtcFile.CompanyBtcFile = new BOC.Entities.CompanyBtcFile(); if (lCompanyBtcFile != null) { if (lCompanyBtcFile.CompanyName != null && lCompanyBtcFile.CompanyName != "") { lCompanyAndBtcFile.CompanyBtcFile.CompanyName = "******"; } else { lCompanyAndBtcFile.CompanyBtcFile.CompanyName = "_none"; } if (lCompanyBtcFile.CompanyBtCFile != null && lCompanyBtcFile.CompanyBtCFile != "") { lCompanyAndBtcFile.CompanyBtcFile.CompanyBtCFile = "******"; } else { lCompanyAndBtcFile.CompanyBtcFile.CompanyBtCFile = "_none"; } if (lCompanyBtcFile.CompanyLocalName != null && lCompanyBtcFile.CompanyLocalName != "") { lCompanyAndBtcFile.CompanyBtcFile.CompanyLocalName = "******"; } else { lCompanyAndBtcFile.CompanyBtcFile.CompanyLocalName = "_none"; } if (lCompanyBtcFile.CompanyType != null && lCompanyBtcFile.CompanyType != "") { lCompanyAndBtcFile.CompanyBtcFile.CompanyType = lCompanyBtcFile.CompanyType; } else { lCompanyAndBtcFile.CompanyBtcFile.CompanyType = "_none"; } if (lCompanyBtcFile.CompanyYearFounded != null && lCompanyBtcFile.CompanyYearFounded != "") { lCompanyAndBtcFile.CompanyBtcFile.CompanyYearFounded = "******"; } else { lCompanyAndBtcFile.CompanyBtcFile.CompanyYearFounded = "_none"; } lCompanyAndBtcFile.CompanyBtcFile.CompanyLocalNameCeritificate = lCompanyBtcFile.CompanyLocalNameCeritificate; lCompanyAndBtcFile.CompanyBtcFile.CompanyNameCeritificate = lCompanyBtcFile.CompanyNameCeritificate; lCompanyAndBtcFile.CompanyBtcFile.CompanyTypeCeritificate = lCompanyBtcFile.CompanyTypeCeritificate; lCompanyAndBtcFile.CompanyBtcFile.CompanyYearFoundedCeritificate = lCompanyBtcFile.CompanyYearFoundedCeritificate; } else { lCompanyAndBtcFile.CompanyBtcFile.CompanyName = "_none"; lCompanyAndBtcFile.CompanyBtcFile.CompanyBtCFile = "_none"; lCompanyAndBtcFile.CompanyBtcFile.CompanyLocalName = "_none"; lCompanyAndBtcFile.CompanyBtcFile.CompanyType = "_none"; lCompanyAndBtcFile.CompanyBtcFile.CompanyYearFounded = "_none"; } lCompanyAndBtcFile.CompanyBtcFileTradedList = new List<BOC.Entities.CompanyBtcFileTraded>(); List<BOC.Entities.CompanyBtcFileTraded> lCompanyBtcFileTradeds = _BOCWebDBContext.CompanyBtcFileTradeds .Where(e => e.CompanyName == SendUserName) .OrderByDescending(e => e.TradeYear) .ToList(); int lLastTradeYear = -1; decimal lTotalTradeQuantity = 0; foreach (BOC.Entities.CompanyBtcFileTraded CompanyBtcFileTraded in lCompanyBtcFileTradeds) { if (lLastTradeYear == -1) { lLastTradeYear = CompanyBtcFileTraded.TradeYear; } if (lLastTradeYear > CompanyBtcFileTraded.TradeYear) { lLastTradeYear = CompanyBtcFileTraded.TradeYear; } lTotalTradeQuantity += CompanyBtcFileTraded.Quantity; BOC.Entities.CompanyBtcFileTraded lCompanyBtcFileTraded = new BOC.Entities.CompanyBtcFileTraded(); lCompanyBtcFileTraded.IsCertificate = CompanyBtcFileTraded.IsCertificate; lCompanyAndBtcFile.CompanyBtcFileTradedList.Add(lCompanyBtcFileTraded); } lCompanyAndBtcFile.LastTradeYear = lLastTradeYear; lCompanyAndBtcFile.TotalTradeQuantity = lTotalTradeQuantity; lCompanyAndBtcFile.IsTrueBtcFile = false; return lCompanyAndBtcFile; }