public void DBOperation(Constants.Action command, Merchant_Deal item = null, List <Int64> Ids = null) { switch (command) { case Constants.Action.Insert: client.InsertDeal(item); break; case Constants.Action.Delete: client.DeleteDeals(Ids); break; default: break; } }
void _view_DeleteCommand(object sender, EventArgs e) { try { Merchant_Deal c = new Merchant_Deal(); _model.DBOperation(Constants.Action.Delete, c, _view.Ids); _view.strMessage = "Successfully Deleted!!!"; LoadViewFromModel(); _view.DataBind(); } catch (Exception ex) { _view.strMessage = ex.Message; } }
protected void btnMerchantNameAdd_Click(object sender, EventArgs e) { EventHandler Insert = this.InsertCommand; if (Insert != null) { List <Merchant_Deal> deals = new List <Merchant_Deal>(); Merchant_Deal deal = new Merchant_Deal(); //deal.Brand = this. //deal.Color = row["Color"].ToString(); //deal.CouponCode = row["CouponCode"].ToString(); //deal.Description = row["ProductDescription"].ToString(); //deal.DiscountedPrice = Convert.ToInt64(row["DiscountedPrice"].ToString()); //deal.ImageUrl = row["ProductURL"].ToString(); //deal.Location = row["Location"].ToString(); //deal.NavigationURL = row["NavigationURL"].ToString(); //deal.ProductCategoryName = row["CategoryName"].ToString(); //deal.ProductPrice = Convert.ToInt64(row["ProductPrice"].ToString()); //deal.ProductPriceCurrency = row["ProductPriceCurrency"].ToString(); //deal.Title = row["ProductName"].ToString(); //deal.Availability = row["Availability"].ToString(); //deal.ProductID = row["ProductID"].ToString(); //deal.ProductSKU = row["ProductSKU"].ToString(); //deal.WasPrice = Convert.ToInt64(row["WasPrice"].ToString()); deal.MID = this.MID; deal.ProductCategoryName = this.ProductCategoryName; deal.Title = this.Title; deal.Description = this.Description; deal.Availability = this.Availability; deal.CouponCode = this.NavigationURL; deal.ImageUrl = this.NavigationURL; deals.Add(deal); Merchant_Deals = deals; //deal.SerialNo = _view.SerialNo; deal.NavigationURL = this.NavigationURL; Insert(this, e); BindItems(); } }
private List <Merchant_Deal> AssingDBDate(DataTable dt) { List <Merchant_Deal> deals = new List <Merchant_Deal>(); foreach (DataRow row in dt.Rows) { Merchant_Deal deal = new Merchant_Deal(); deal.MID = this.MID; if (dt.Columns.Contains("Brand")) { deal.Brand = row["Brand"].ToString(); } if (dt.Columns.Contains("Color")) { deal.Color = row["Color"].ToString(); } if (dt.Columns.Contains("CouponCode")) { deal.CouponCode = row["CouponCode"].ToString(); } if (dt.Columns.Contains("ProductDescription")) { deal.Description = row["ProductDescription"].ToString(); } if (dt.Columns.Contains("DiscountedPrice")) { deal.DiscountedPrice = Convert.ToDouble(row["DiscountedPrice"].ToString()); } if (dt.Columns.Contains("ProductImageLargeURL")) { deal.ImageUrl = row["ProductImageLargeURL"].ToString(); } if (dt.Columns.Contains("ProductImageMediumURL")) { deal.ImageUrl = row["ProductImageMediumURL"].ToString(); } if (dt.Columns.Contains("ProductImageSmallURL")) { deal.ImageUrl = row["ProductImageSmallURL"].ToString(); } if (dt.Columns.Contains("Location")) { deal.Location = row["Location"].ToString(); } if (dt.Columns.Contains("ProductURL")) { deal.NavigationURL = row["ProductURL"].ToString(); } deal.ProductCategoryName = row["CategoryName"].ToString(); if (dt.Columns.Contains("ProductPrice")) { deal.ProductPrice = Convert.ToDouble(row["ProductPrice"].ToString()); } if (dt.Columns.Contains("ProductPriceCurrency")) { deal.ProductPriceCurrency = row["ProductPriceCurrency"].ToString(); } if (dt.Columns.Contains("ProductName")) { deal.Title = row["ProductName"].ToString(); } if (dt.Columns.Contains("Availability")) { deal.Availability = row["Availability"].ToString(); } if (dt.Columns.Contains("ProductID")) { deal.ProductID = row["ProductID"].ToString(); } deal.ProductSKU = row["ProductSKU"].ToString(); if (dt.Columns.Contains("WasPrice")) { deal.WasPrice = Convert.ToDouble(row["WasPrice"].ToString()); } deals.Add(deal); } return(deals); }