private List <Product_Common> SearchResult() { List <Product_Common> ProductList = new List <Product_Common>(); foreach (GridViewRow row in gvItems.Rows) { CheckBox ckb = (CheckBox)row.FindControl("chkRow"); if (ckb.Checked) { var sItem = (from p in SearchLiveData where p.ProductSKU == gvItems.DataKeys[row.RowIndex].Values["ProductSKU"].ToString() select p).FirstOrDefault(); Product_Common item = new Product_Common(); item.CreatedDate = DateTime.Now; item.Description = sItem.ProductDescription;//gvLiveProduct.DataKeys[row.RowIndex].Values["ProductDescription"].ToString(); item.ImageUrl = clsImageUrl.GetProductImageURL(sItem.ProductSmallImageURL + ";" + sItem.ProductMediumImageURL + ";" + sItem.ProductLargeImageURL); item.NavigationURL = sItem.ProductURL; item.ProductCategoryName = sItem.CategoryName;// +":" + sItem.CategoryPathAsString; //(string)DataBinder.Eval(row.DataItem, "CategoryName"); item.Availability = sItem.StockAvailability; item.ProductPrice = Convert.ToSingle(sItem.ProductPrice); if (sItem.DiscountedPrice.HasValue) { item.DiscountedPrice = Convert.ToSingle(sItem.DiscountedPrice); } item.Brand = sItem.Brand; if (sItem.Colour != null) { item.Color = sItem.Colour.ToString(); } item.PID = sItem.PID; item.ProductPriceCurrency = sItem.ProductPriceCurrency; //if (sItem.Location != null) item.Location = sItem.CategoryPathAsString.Replace("Root|", "");//.Replace(sItem.CategoryName + "|", "").Replace("||", ""); item.SKUID = sItem.ProductSKU; item.MerchantProductID = sItem.ProductID.ToString(); item.Title = sItem.ProductName; item.Ad_Type = Constants.APITypeURL.ProductFeed; item.MID = clsGetAppIDs.GetMIDByOMGMID(sItem.MID.ToString()); item.Custom1 = sItem.Custom1; item.Custom2 = sItem.Custom2; item.Custom3 = sItem.Custom3; ProductList.Add(item); } } return(ProductList); }
private List <Product_Common> SearchResultBulk() { List <Product_Common> ProductList = new List <Product_Common>(); foreach (clsOMGProductFeed sItem in SearchLiveData) { Product_Common item = new Product_Common(); item.MID = clsGetAppIDs.GetMIDByOMGMID(sItem.MID.ToString()); if (item.MID != 0) { item.CreatedDate = DateTime.Now; item.Description = sItem.ProductDescription; //gvLiveProduct.DataKeys[row.RowIndex].Values["ProductDescription"].ToString(); item.ImageUrl = clsImageUrl.GetProductImageURL(sItem.ProductSmallImageURL + ";" + sItem.ProductMediumImageURL + ";" + sItem.ProductLargeImageURL); item.NavigationURL = sItem.ProductURL; // clsUtility.GetDeeplinkInHTMLString(sItem.ProductURL); item.ProductCategoryName = sItem.CategoryName; // +":" + sItem.CategoryPathAsString; //(string)DataBinder.Eval(row.DataItem, "CategoryName"); item.Availability = sItem.StockAvailability; item.ProductPrice = Convert.ToSingle(sItem.ProductPrice); if (sItem.DiscountedPrice.HasValue) { item.DiscountedPrice = Convert.ToSingle(sItem.DiscountedPrice); } item.Brand = sItem.Brand; if (sItem.Colour != null) { item.Color = sItem.Colour.ToString(); } if (UC_CategoryList.SelectedIndex > 0) { item.CategoryID_N = Convert.ToInt32(UC_CategoryList.SelectedValue.ToString()); } item.PID = sItem.PID; item.ProductPriceCurrency = sItem.ProductPriceCurrency; //if (sItem.Location != null) item.Location = sItem.CategoryPathAsString.Replace("Root|", "").Replace(sItem.CategoryName + "|", "").Replace("||", "");//Location.ToString(); item.SKUID = sItem.ProductSKU; item.MerchantProductID = sItem.ProductID.ToString(); item.Title = sItem.ProductName; item.Ad_Type = Constants.APITypeURL.ProductFeed; item.Custom1 = sItem.Custom1; item.Custom2 = sItem.Custom2; item.Custom3 = sItem.Custom3; ProductList.Add(item); } } return(ProductList); }
void _view_DeleteCommand(object sender, EventArgs e) { try { Product_Common c = new Product_Common(); _model.DBOperation(Constants.Action.Delete, c, _view.Ids); //_view.strMessage = "Successfully Deleted!!!"; _view_RefreshCommand(sender, e); _view.DataBind(); } catch (Exception ex) { // _view.strMessage = ex.Message; } }
public void DBOperation(Constants.Action command, Product_Common item = null, List <long> ids = null) { switch (command) { case Constants.Action.Insert: client.InsertCommonProduct(item); break; case Constants.Action.Delete: client.DeleteCommonProduct(ids); break; default: break; } }
void _view_InsertCommand(object sender, EventArgs e) { try { if (_view.ProductVW != null) { foreach (Product_Common cmn in _view.ProductVW) { _model.DBOperation(Constants.Action.Insert, cmn); } } else { Product_Common c = new Product_Common(); c.Title = _view.Title; if (_view.CategoryID_N > 0) { c.CategoryID_N = _view.CategoryID_N; } c.SerialNo = _view.SerialNo; c.ProductCategoryName = _view.ProductCategoryName; c.NavigationURL = _view.NavigationURL; c.ModifiedDate = DateTime.Now; c.ImageUrl = _view.ImageUrl; c.Description = _view.Description; c.CreatedDate = DateTime.Now; c.Ad_Type = _view.Ad_Type; //c.Ad_For = _view.Ad_For; c.MID = _view.MID; //c.CreatedBy = Membership.GetUser().ProviderUserKey.ToString(); c.Availability = _view.Availability; _model.DBOperation(Constants.Action.Insert, c); } _view.strMessage = "Successfully Inserted!!!"; LoadViewFromModel(); _view.DataBind(); } catch (Exception ex) { _view.strMessage = ex.InnerException.Message; } }
protected void btnAdd_Click(object sender, EventArgs e) { List <Product_Common> ProductList = new List <Product_Common>(); Product_Common prduct = new Product_Common(); prduct.Title = txtTitle.Text; prduct.Description = txtDescription.Text; prduct.NavigationURL = txtNavigateURL.Text; prduct.Availability = "In-stock"; if (!string.IsNullOrEmpty(txtMRP.Text.Trim())) { prduct.ProductPrice = Convert.ToInt32(txtMRP.Text); } if (!string.IsNullOrEmpty(txtDiscountPrice.Text.Trim())) { prduct.DiscountedPrice = Convert.ToInt32(txtDiscountPrice.Text.Trim()); } prduct.Brand = txtBrand.Text.Trim(); prduct.Color = txtColor.Text.Trim(); prduct.Ad_Type = Constants.APITypeURL.FlipKart_DOTD_OffersAPI; //this.Ad_For =Convert.ToInt16(MID); prduct.MID = Convert.ToInt16(uc_MerchantDDlList.SelectedMerchant); prduct.ImageUrl = txtImageURL.Text; //itemNo = itemNo + 1; //this.SerialNo = itemNo; EventHandler Insert = this.InsertCommand; if (Insert != null) { ProductList.Add(prduct); ProductVW = ProductList; Insert(this, e); } }