public ActionResult ExtendLifetime(List <bool> Check, int Value, List <int> ID, List <short> RowVersion) { var svHotFeat = new HotFeaProductService(); var listID = new List <int>(); for (int i = 0; i < ID.Count(); i++) { if (Check[i] == true) { listID.Add(ID[i]); } } svHotFeat.ExtendLifeTime(listID, Value); if (svHotFeat.IsResult) { #region Send Mail //for (int i = 0; i < Company.Count(); i++) //{ // // SendMailAlerts(Company[i].MemberID, Company[i].Email, 3, Value); //} #endregion } return(Json(new { Result = svHotFeat.IsResult })); }
public void LoadFeatureProduct() { #region Load Feature var feature = new List <view_HotFeaProduct>(); if (MemoryCache.Default["LoadFeature"] != null) { feature = (List <view_HotFeaProduct>)MemoryCache.Default["LoadFeature"]; feature = feature.OrderBy(x => Guid.NewGuid()).ToList(); feature = feature.OrderByDescending(m => m.Price).ToList(); } else { var svHotFeat = new HotFeaProductService(); var SQLSelect_Feat = ""; //if (Base.AppLang == "en-US") // SQLSelect_Feat = "ProductID,ProductName,CompID,ProductImgPath,ProRowFlag,CompRowFlag,ProvinceName,Price,Ispromotion,PromotionPrice"; //else SQLSelect_Feat = " ProductID,ProductName,CompID,ProductImgPath,ProRowFlag,CompRowFlag,ProvinceName,Price,Ispromotion,PromotionPrice,HotPrice"; feature = svHotFeat.SelectHotProduct <view_HotFeaProduct>(SQLSelect_Feat, "Rowflag = 3 AND Status = 'F' AND ProductID > 0 AND ProRowFlag in(2,4) AND CompRowFlag in(2,4) AND ProductDelete = 0", "NEWID(),HotPrice DESC", 1, 20);//"" if (svHotFeat.TotalRow > 0) { MemoryCache.Default.Add("LoadFeature", feature, DateTime.Now.AddMinutes(10)); } } ViewBag.FeatProducts = feature; #endregion }
public void List_DoloadData() { var svHotFeat = new HotFeaProductService(); string sqlSelect, sqlWhere, sqlOrderBy = ""; sqlSelect = @" HotFeaProductID,ProductID,ProductName,Price_One,Qty,QtyUnit,Price,CompID," + "CompName,ActivatedDate,ExpiredDate,RowFlag,IsDelete,Status,PackageCount,CategoryType,HotPrice,ProductDelete"; sqlWhere = svHotFeat.InitialWhere(); sqlOrderBy = " ModifiedDate DESC "; #region DoWhereCause sqlWhere += svHotFeat.CreateWhereCauseHotFeat((string)ViewBag.TextSearch, (string)ViewBag.SearchType, (string)ViewBag.PStatus, int.Parse(ViewBag.ExpireStatus), (string)ViewBag.SearchStatus); if (!string.IsNullOrEmpty(ViewBag.Period)) { sqlWhere += SQLWhereDateTimeFromPeriod(ViewBag.Period, "ModifiedDate"); } #endregion var HotFeats = svHotFeat.SelectData <view_HotFeaProduct>(sqlSelect, sqlWhere, sqlOrderBy, (int)ViewBag.PageIndex, (int)ViewBag.PageSize); ViewBag.HotFeats = HotFeats; ViewBag.LogonCompID = LogonCompID; ViewBag.TotalRow = svHotFeat.TotalRow; ViewBag.TotalPage = svHotFeat.TotalPage; }
public ActionResult SaveHotFeat(List <int> CompID, List <int> Expire, List <int> ProductID, List <string> Type, List <string> HotPrice) { var svHotFeat = new HotFeaProductService(); var Msg = string.Empty; try { svHotFeat.SaveHotFeat(CompID, Expire, ProductID, Type, HotPrice, LogonCompCode); if (!string.IsNullOrEmpty(svHotFeat.Msg)) { svHotFeat.IsResult = false; } //อีเมล์แจ้งเพิ่ม HotFeat var data = svHotFeat.SelectData <b2bHotFeaProduct>("HotFeaProductID", "Isdelete = 0", "CreatedDate DESC", 1, CompID.Count()); for (int i = 0; i < data.Count(); i++) { SendMailAddHotFeat(data[i].HotFeaProductID, Expire[i]); } } catch (Exception ex) { Msg = res.Admin.lblCannot_save; svHotFeat.IsResult = false; CreateLogFiles(ex); } return(Json(new { IsResult = svHotFeat.IsResult, CountSuccess = svHotFeat.CountSuccess, CountProductExist = svHotFeat.Msg })); }
public ActionResult EditExpiredDate(List <int> HotFeaProductID, int NumMonth, int SendMailExpire, string EditStatus, string EditHotprice) { var svHotFeat = new HotFeaProductService(); try { foreach (var item in HotFeaProductID) { if (NumMonth != 0) { svHotFeat.EditExpiredDate(item, NumMonth); } svHotFeat.EditStatusHotprice(item, EditStatus, EditHotprice); // แจ้ง HotFeat ต่ออายุแล้วการใช้งาน if (svHotFeat.IsResult && SendMailExpire == 1) { SendMailAlerts(item, 3, NumMonth); //return Json(new { Result = true }); } } DoloadExpireHotFeat(); } catch (Exception ex) { CreateLogFiles(ex); } return(Json(new { IsResult = svHotFeat.IsResult, MsgError = "", Count_to_Exp = ViewBag.Count_to_Exp, Count_Exp_today = ViewBag.Count_Exp_today, Count_Exp = ViewBag.Count_Exp })); }
public void LoadFeatureProduct() { #region Load Feature var svHotFeat = new HotFeaProductService(); var FeatProducts = svHotFeat.SelectData <view_HotFeaProduct>(" ProductID,ProductName,CompID,ProductImgPath ", "Rowflag = 3 AND Status = 'F' AND ProductID > 0", " NEWID() ", 1, 10); ViewBag.FeatProducts = FeatProducts; #endregion }
public JsonResult GetEditByID(string HotFeaProductID = "") { var svHotFeat = new HotFeaProductService(); CommonService svCommon = new CommonService(); var EnumHotFeatStatus = svCommon.SelectEnum(CommonService.EnumType.HotFeatStatus); var data = svHotFeat.SelectData <view_HotFeaProduct>("HotPrice,Status", "IsDelete = 0 AND HotFeaProductID=" + HotFeaProductID); return(Json(new { IsResult = true, HotPrice = data.First().HotPrice, Status = data.First().Status, EnumHotFeatStatus = EnumHotFeatStatus })); }
public ActionResult DeleteHotFeat(int HotFeaProductID) { var svHotFeat = new HotFeaProductService(); try { svHotFeat.DeleteHotFeat(HotFeaProductID); } catch (Exception ex) { CreateLogFiles(ex); } return(Json(new { IsResult = svHotFeat.IsResult, MsgError = "" })); }
public ActionResult UpdateStatusHotFeat(int HotFeaProductID, string Status) { var svHotFeat = new HotFeaProductService(); try { svHotFeat.UpdateStatusHotFeat(HotFeaProductID, Status); } catch (Exception ex) { CreateLogFiles(ex); } return(Json(new { IsResult = svHotFeat.IsResult, MsgError = "" })); }
public ActionResult SaveProductHotFeat(string ProductID, string HotFeaProductID) { var svHotFeat = new HotFeaProductService(); try { svHotFeat.UpdateProductHotFeat(ProductID, HotFeaProductID); } catch (Exception ex) { CreateLogFiles(ex); } return(Json(new { IsResult = svHotFeat.IsResult, MsgError = "" })); }
public ActionResult DeleteAll(List <int> ID) { var svHotFeat = new HotFeaProductService(); try { svHotFeat.DeleteHotFeatAll(ID, LogonCompCode); } catch (Exception ex) { CreateLogFiles(ex); } return(Json(new { IsResult = svHotFeat.IsResult, MsgError = "" })); }
public void DoloadExpireHotFeat() { var svHotFeat = new HotFeaProductService(); #region Count_Exp ViewBag.Count_to_Exp = svHotFeat.CountData <view_HotFeaProduct>(" * ", @" IsDelete = 0 AND (Status = 'H' OR Status = 'F') AND ExpiredDate Between '" + DateTime.Now.AddDays(1).ToShortDateString() + "' AND '" + DateTime.Now.AddDays(7).ToShortDateString() + "'"); #endregion #region Count_Exp_today ViewBag.Count_Exp_today = svHotFeat.CountData <view_HotFeaProduct>(" * ", @"IsDelete = 0 AND (Status = 'H' OR Status = 'F') AND ExpiredDate Between '" + DateTime.Now.ToShortDateString() + " 00:00:00' AND '" + DateTime.Now.ToShortDateString() + " 23:59:59'"); #endregion #region Count_Exp ViewBag.Count_Exp = svHotFeat.CountData <view_HotFeaProduct>(" * ", "IsDelete = 0 AND (Status = 'H' OR Status = 'F') AND ExpiredDate < '" + DateTime.Now.Date.ToShortDateString() + "'"); #endregion }
public void LoadFeatureProduct() { #region Load Feature var feature = new List <view_HotFeaProduct>(); if (MemoryCache.Default["LoadFeature"] != null) { feature = (List <view_HotFeaProduct>)MemoryCache.Default["LoadFeature"]; feature = feature.OrderBy(x => Guid.NewGuid()).ToList(); } else { var svHotFeat = new HotFeaProductService(); feature = svHotFeat.SelectData <view_HotFeaProduct>(" ProductID,ProductName,CompID,ProductImgPath,ProRowFlag,CompRowFlag,ProvinceName,Price,Ispromotion,PromotionPrice", "Rowflag = 3 AND Status = 'F' AND ProductID > 0 AND ProRowFlag in(2,4) AND CompRowFlag in(2,4)", " NEWID()", 1, 20); if (svHotFeat.TotalRow > 0) { MemoryCache.Default.Add("LoadFeature", feature, DateTime.Now.AddMinutes(10)); } } ViewBag.FeatProducts = feature; #endregion }
public void LoadHotProduct() { var svHotFeat = new HotFeaProductService(); var name = "hotfeat"; List <view_HotFeaProduct> data; if (MemoryCache.Default[name] != null) { data = (List <view_HotFeaProduct>)MemoryCache.Default[name]; } else { data = svHotFeat.SelectData <view_HotFeaProduct>(" ProductID,ProductName,CompID,ProductImgPath", "Rowflag = 3 AND Status = 'H' AND ProductID > 0 AND IsDelete=0", " CreatedDate DESC ", 1, 20); if (data != null && data.Count > 0) { MemoryCache.Default.Add(name, data, DateTime.Now.AddHours(4)); } } ViewBag.HotProducts = data; ViewBag.HotProductsCount = svHotFeat.TotalRow; }
public bool SendEmailApproveBuylead(b2bBuylead model) { #region variable bool IsSend = true; var Detail = ""; var url = ""; var urlBuylead = ""; var mailTo = new List <string>(); var mailCC = new List <string>(); var svHotFeat = new HotFeaProductService(); var SQLSelect_Feat = ""; SQLSelect_Feat = " ProductID,ProductName,CompID,ProductImgPath,ProRowFlag,CompRowFlag,ProvinceName,Price,Ispromotion,PromotionPrice,HotPrice"; var HotProduct = svHotFeat.SelectHotProduct <view_HotFeaProduct>(SQLSelect_Feat, "Rowflag = 3 AND Status = 'H' AND ProductID > 0 AND ProRowFlag in(2,4) AND CompRowFlag in(2,4) AND ProductDelete = 0", "NEWID(),HotPrice DESC", 1, 4); #endregion #region Set Content & Value For Send Email string urlb2bthai = res.Pageviews.UrlWeb; url = urlb2bthai + "/MyB2B/buylead"; urlBuylead = urlb2bthai + "/Purchase/Search/Detail/" + model.BuyleadID + "?name=" + model.BuyleadName; //test path logo string b2bthai_url = res.Pageviews.UrlWeb; string pathlogo = b2bthai_url + "/Content/Default/logo/Ouikum/img_Logo120x74.png"; Hashtable EmailDetail = new Hashtable(); EmailDetail["Name"] = model.BuyleadContactPerson; EmailDetail["CompName"] = model.BuyleadCompanyName; EmailDetail["BuyleadCode"] = model.BuyleadCode; EmailDetail["BuyleadName"] = model.BuyleadName; EmailDetail["Remark"] = model.Remark; EmailDetail["pathLogo"] = pathlogo; EmailDetail["url"] = url; EmailDetail["urlBuylead"] = urlBuylead; if (model.RowFlag == 4) { EmailDetail["Title"] = "แจ้งผลอนุมัติประกาศซื้อสินค้าของคุณ"; EmailDetail["Result"] = res.Admin.lblApprove; } else if (model.RowFlag == 3) { EmailDetail["Title"] = "แจ้งผลไม่อนุมัติประกาศซื้อสินค้าของคุณ"; EmailDetail["Result"] = res.Admin.lblReject; } ViewBag.Data = EmailDetail; ViewBag.HotProduct = HotProduct; string Subject = "แจ้งผลการตรวจสอบประกาศซื้อสินค้า B2BThai.com"; Detail = PartialViewToString("UC/Email/SendApproveBuylead"); var mailFrom = res.Config.EmailNoReply; mailTo.Add(model.BuyleadEmail); #endregion IsSend = OnSendByAlertEmail(Subject, mailFrom, mailTo, mailCC, Detail); return(IsSend); }
public ActionResult List(int?Sort = 1, int PIndex = 1, int PSize = 20, string txtSearch = "", int?BizTypeID = 0, int CateLevel = 0, int CategoryID = 0, int?CompLevelID = 0, int ProvinceID = 0) { ViewBag.Title = res.Common.lblSearchProduct; if (!string.IsNullOrEmpty(txtSearch)) { txtSearch = txtSearch.Trim(); LoadHotProduct(txtSearch, CategoryID, CateLevel); } GetStatusUser(); CommonService svCommon = new CommonService(); ViewBag.EnumSortByProduct = svCommon.SelectEnum(CommonService.EnumType.SortByProduct); sqlSelect = @"ProductID,ProductName,ProductNameEng,ProductCount,CompID,CompName,CompLevel,BizTypeName,CompProvinceID,ListNo," + "BizTypeOther,ShortDescription,ProductImgPath,ProvinceName,CateLV3,ViewCount,ModifiedDate,CreatedDate,ContactCount,Price,IsPromotion,PromotionPrice"; #region DoWhereCause sqlWhere = svProduct.CreateWhereAction(ProductAction.FrontEnd, 0); sqlWhere += svProduct.CreateWhereCause(0, txtSearch, 0, 0, (int)CateLevel, (int)CategoryID, (int)BizTypeID, (int)CompLevelID, (int)ProvinceID); #endregion #region Sort By sqlOrderBy += " ListNo DESC "; if (CompLevelID == 3) { sqlOrderBy += " ,Complevel DESC "; } switch (Sort) { case 1: sqlOrderBy += svProduct.CreateOrderby(OrderBy.ComplevelDESC); break; case 2: sqlOrderBy += svProduct.CreateOrderby(OrderBy.CreatedDateDESC); break; case 3: sqlOrderBy += svProduct.CreateOrderby(OrderBy.ViewCountDESC); break; case 4: sqlOrderBy += svProduct.CreateOrderby(OrderBy.ContactCountDESC); break; } #endregion sqlOrderBy += " , ModifiedDate DESC "; #region Get b2bProduct FindCateName(CategoryID, CateLevel); ViewBag.Sort = Convert.ToString(Sort); var data = svProduct.SearchProduct(ProductAction.FrontEnd, txtSearch, (int)CateLevel, (int)CategoryID, (int)BizTypeID, (int)ProvinceID, 0, PIndex, PSize, sqlOrderBy); var products = MappingProduct(data); //var mgKeyword = new KeywordMongo(); // var products = new List<Models.tbProduct>(); //var mongoProducts = mgKeyword.SearchProductMongo(Sort, PIndex, PSize, txtSearch, BizTypeID, CateLevel, CategoryID, CompLevelID, ProvinceID); //var products = MappingProductMongo(mongoProducts); ViewBag.Products = products; if (svProduct.TotalRow > 0) { var product = products.First(); if (BizTypeID > 0) { ViewBag.Title += " " + product.BizTypeName; } if (ProvinceID > 0) { ViewBag.Title += " " + product.ProvinceName; } } ViewBag.Title += " | " + res.Common.lblDomainShortName; #endregion #region Set ViewBag ViewBag.TextSearch = txtSearch; ViewBag.PageIndex = PIndex; ViewBag.PageSize = PSize; ViewBag.CateID = CategoryID; ViewBag.TotalRow = svProduct.TotalRow; ViewBag.TotalPage = svProduct.TotalPage; //ViewBag.TotalRow = mgKeyword.TotalRow; //ViewBag.TotalPage = mgKeyword.TotalPage; if (CategoryID == 0) { ViewBag.CateParentLevel = 0; } else { ViewBag.CateParentLevel = CateLevel; } ViewBag.MetaKeyword = ViewBag.Title; ViewBag.MetaDescription = ViewBag.Title; #endregion #region Load Feature var feature = new List <view_HotFeaProduct>(); if (MemoryCache.Default["LoadFeatureSearch"] != null) { feature = (List <view_HotFeaProduct>)MemoryCache.Default["LoadFeatureSearch"]; feature = feature.OrderBy(x => Guid.NewGuid()).ToList(); feature = feature.OrderByDescending(m => m.Price).ToList(); } else { var svHotFeat = new HotFeaProductService(); var SQLSelect_Feat = ""; SQLSelect_Feat = " ProductID,ProductName,CompID,ProductImgPath,ProRowFlag,CompRowFlag,ProvinceName,Price,Ispromotion,PromotionPrice,HotPrice"; feature = svHotFeat.SelectHotProduct <view_HotFeaProduct>(SQLSelect_Feat, "Rowflag = 3 AND Status = 'H' AND ProductID > 0 AND ProRowFlag in(2,4) AND CompRowFlag in(2,4) AND ProductDelete = 0", "NEWID(),HotPrice DESC", 1, 10);//"" if (svHotFeat.TotalRow > 0) { MemoryCache.Default.Add("LoadFeatureSearch", feature, DateTime.Now.AddMinutes(10)); } } ViewBag.FeatProducts = feature; #endregion //stopwatch.Stop(); //if (Request.Browser.IsMobileDevice) //{ // return PartialView("UC_mobile/ProductListUC"); //}else{ return(PartialView("Search/ProductListUC")); //} }
public ActionResult Index(int?Category, int?CateLevel, string CategoryName, string TextSearch, int?Province) { if (RedirectToProduction()) { return(Redirect(UrlProduction)); } CommonService svCommon = new CommonService(); GetStatusUser(); int ProvinceID = (Province != null || Province == 0) ? (int)Province : 0; int CateID = (Category != null || Category == 0) ? (int)Category : 0; int CateLV = (CateLevel != null) ? (int)CateLevel : 0; string txtSearch = (TextSearch != null) ? TextSearch.Trim() : ""; if (txtSearch == "") { ViewBag.TextSearch = ""; if (CateID == 0) { ViewBag.Title = MvcHtmlString.Create(res.Common.lblSearchProduct + " | " + res.Common.lblDomainShortName); } } else { ViewBag.TextSearch = txtSearch; ViewBag.Relate = txtSearch; ViewBag.Title = MvcHtmlString.Create(ViewBag.TextSearch + " | " + res.Common.lblDomainShortName); } //#region query Product var data = svProduct.SearchProduct(ProductAction.FrontEnd, txtSearch, CateLV, CateID, 0, 0, 0, 1, 20); ViewBag.Status = svProduct.CodeError; var products = MappingProduct(data); ViewBag.Products = products; //#endregion #region query Product Mongo //var mgKeywod = new KeywordMongo(); //var mongoProducts = mgKeywod.SearchProductMongo(1, 1, 20, txtSearch, 0, CateLV, CateID, 0, ProvinceID); //var products = MappingProductMongo(mongoProducts); ViewBag.Status = svProduct.CodeError; ViewBag.Products = products; #endregion #region Category var ParentCate = svCategory.GetCategoryByLevel(1); ViewBag.Category = ParentCate; #endregion #region query Biztype var Biztype = svBizType.GetBiztypeAll(); ViewBag.Biztype = Biztype; #endregion #region query Province //ViewBag.Province = svAddress.GetProvinceAll(); LoadProvinces(); #endregion ViewBag.EnumServiceType = svCommon.SelectEnum(CommonService.EnumType.SearchByServiceType); ViewBag.EnumSortByProduct = svCommon.SelectEnum(CommonService.EnumType.SortByProduct); if (TextSearch != "") { // LoadFeatureProduct(TextSearch, Category, CateLevel); LoadHotProduct(TextSearch, Category, CateLevel); } FindCateName(CateID, CateLV); if ((Category == 1083 || Category == 1165)) { ViewBag.ShowBranner = "Show"; ViewBag.CateBanner = Category; } #region Set ViewBag ViewBag.CateLV = CateLV; ViewBag.CateID = CateID; ViewBag.PageIndex = 1; ViewBag.PageSize = 20; ViewBag.TotalRow = svProduct.TotalRow; ViewBag.TotalPage = svProduct.TotalPage; //ViewBag.TotalRow = mgKeywod.TotalRow; //ViewBag.TotalPage = mgKeywod.TotalPage; ViewBag.MetaKeyword = ViewBag.Title; ViewBag.MetaDescription = ViewBag.Title; #endregion // GetStatusUser(); #region Load Feature var feature = new List <view_HotFeaProduct>(); if (MemoryCache.Default["LoadFeatureSearch"] != null) { feature = (List <view_HotFeaProduct>)MemoryCache.Default["LoadFeatureSearch"]; feature = feature.OrderBy(x => Guid.NewGuid()).ToList(); feature = feature.OrderByDescending(m => m.Price).ToList(); } else { var svHotFeat = new HotFeaProductService(); var SQLSelect_Feat = ""; //if (Base.AppLang == "en-US") // SQLSelect_Feat = "ProductID,ProductName,CompID,ProductImgPath,ProRowFlag,CompRowFlag,ProvinceName,Price,Ispromotion,PromotionPrice"; //else SQLSelect_Feat = " ProductID,ProductName,CompID,ProductImgPath,ProRowFlag,CompRowFlag,ProvinceName,Price,Ispromotion,PromotionPrice,HotPrice"; feature = svHotFeat.SelectHotProduct <view_HotFeaProduct>(SQLSelect_Feat, "Rowflag = 3 AND Status = 'H' AND ProductID > 0 AND ProRowFlag in(2,4) AND CompRowFlag in(2,4) AND ProductDelete = 0", "NEWID(),HotPrice DESC", 1, 10);//"" if (svHotFeat.TotalRow > 0) { MemoryCache.Default.Add("LoadFeatureSearch", feature, DateTime.Now.AddMinutes(10)); } } ViewBag.FeatProducts = feature; #endregion return(View()); }
public ActionResult Contact(int?ToCompID, string ProductID, string type, string BuyleadID) { if (RedirectToProduction()) { return(Redirect(UrlProduction)); } CommonService svCommon = new CommonService(); #region Company Info if (ToCompID > 0) { svCompany = new CompanyService(); string sqlSelect = "CompID,CompName,ContactEmail,CompPhone"; string sqlWhere = svCompany.CreateWhereAction(CompStatus.Online, ToCompID); var countcompany = svCompany.CountData <view_Company>(sqlSelect, sqlWhere); if (countcompany > 0) { var company = svCompany.SelectData <view_Company>(sqlSelect, sqlWhere).First(); ViewBag.Company = company; ViewBag.CompName = company.CompName; } else { return(Redirect("~/Default/NotFound")); } } #endregion #region Load Feature var feature = new List <view_HotFeaProduct>(); if (MemoryCache.Default["LoadFeatureMessage"] != null) { feature = (List <view_HotFeaProduct>)MemoryCache.Default["LoadFeatureMessage"]; feature = feature.OrderBy(x => Guid.NewGuid()).ToList(); feature = feature.OrderByDescending(m => m.HotPrice).ToList(); } else { var svHotFeat = new HotFeaProductService(); var SQLSelect_Feat = ""; SQLSelect_Feat = " ProductID,ProductName,CompID,ProductImgPath,ProRowFlag,CompRowFlag,ProvinceName,Price,Ispromotion,PromotionPrice,HotPrice"; feature = svHotFeat.SelectHotProduct <view_HotFeaProduct>(SQLSelect_Feat, "Rowflag = 3 AND Status = 'P' AND ProductID > 0 AND ProRowFlag in(4) AND CompRowFlag in(2,4) AND ProductDelete = 0", "NEWID(),HotPrice DESC", 1, 3);//"" if (svHotFeat.TotalRow > 0) { MemoryCache.Default.Add("LoadFeatureMessage", feature, DateTime.Now.AddMinutes(10)); } } ViewBag.FeatProducts = feature; #endregion #region Product if (!string.IsNullOrEmpty(ProductID)) { svProduct = new ProductService(); #region Set Cookie ProductID Response.Cookies["MsgContactProID"].Value = ProductID; Response.Cookies["MsgContactProID"].Expires = DateTime.Now.AddHours(1); #endregion string[] strProductID = ProductID.Split(','); string WhereIN = CreateWhereIN(strProductID, "ProductID"); var product = svProduct.SelectData <b2bProduct>("ProductID,ProductName", WhereIN + " AND IsDelete = 0"); ViewBag.ProductID = product; if (svProduct.TotalRow > 0) { ViewBag.Title = "ติดต่อผู้ขายสินค้า " + product.First().ProductName + ", " + ViewBag.CompName + " – B2Bthai.com"; ViewBag.PronameUrl = @Url.ReplaceUrl(product.First().ProductName); } ViewBag.chkProductID = 1; } else { ViewBag.chkProductID = 0; ViewBag.Title = "ติดต่อบริษัท" + ViewBag.CompName + " – B2Bthai.com"; Response.Cookies["MsgContactProID"].Value = null; Response.Cookies["MsgContactProID"].Expires = DateTime.Now.AddHours(1); } #endregion #region Buylead if (!string.IsNullOrEmpty(BuyleadID)) { svBuylead = new BuyleadService(); #region Set Cookie ProductID Response.Cookies["MsgContactBuyID"].Value = BuyleadID; Response.Cookies["MsgContactBuyID"].Expires = DateTime.Now.AddHours(1); #endregion string[] strBuyleadID = BuyleadID.Split(','); string WhereIN = CreateWhereIN(strBuyleadID, "BuyleadID"); var buylead = svBuylead.SelectData <b2bBuylead>("BuyleadID,BuyleadName,BuyleadEmail,BuyleadCompanyName", WhereIN + " AND IsDelete = 0"); ViewBag.BuyleadID = buylead; if (svBuylead.TotalRow > 0) { ViewBag.Title = "ติดต่อผู้ประกาศซื้อสินค้า " + buylead.First().BuyleadName + ", " + buylead.First().BuyleadCompanyName + " – B2Bthai.com"; ViewBag.BuynameUrl = @Url.ReplaceUrl(buylead.First().BuyleadName); } ViewBag.chkBuyleadID = 1; } else { ViewBag.chkBuyleadID = 0; ViewBag.Title = "ติดต่อบริษัท" + ViewBag.CompName + " – B2Bthai.com"; Response.Cookies["MsgContactBuyID"].Value = null; Response.Cookies["MsgContactBuyID"].Expires = DateTime.Now.AddHours(1); } #endregion #region check message type if (type == "SendtoFriend") { ViewBag.chkSendToFriend = 1; ViewBag.Title = "ส่งรายละเอียดให้เพื่อน " + ViewBag.CompName + " – B2Bthai.com"; } else { ViewBag.chkSendToFriend = 0; } #endregion ViewBag.EnumServiceType = svCommon.SelectEnum(CommonService.EnumType.SearchByServiceType); GetStatusUser(); ViewBag.MetaKeyword = ViewBag.Title; ViewBag.MetaDescription = ViewBag.Title; return(View()); }