internal int InsertStyle(LC_Brand _lcBrand) { try { _Context.LC_Brand.AddObject(_lcBrand); _Context.SaveChanges(); return(1); } catch (Exception ex) { throw ex; } }
internal int UpdateStyle(LC_Brand _lcBrand) { try { LC_Brand _brand = _Context.LC_Brand.FirstOrDefault(x => x.BrandId == _lcBrand.BrandId); _brand.BrandName = _lcBrand.BrandName; _brand.EditDate = DateTime.Now; _brand.EditUser = _lcBrand.EditUser; _Context.SaveChanges(); return(1); } catch (Exception ex) { throw ex; } }
protected void imgButtonEidt_Click(object sender, ImageClickEventArgs e) { try { ImageButton imgbtn = (ImageButton)sender; GridViewRow row = (GridViewRow)imgbtn.NamingContainer; Label lblBrandId = (Label)grdBrand.Rows[row.RowIndex].FindControl("lblBrandId"); int BeandId = Convert.ToInt16(lblBrandId.Text); LC_Brand _brandS = _brandbLL.GetBrandLById(BeandId); if (_brandS != null) { hidBrandId.Value = _brandS.BrandId.ToString(); txtBrandName.Text = _brandS.BrandName; } btnSave.Text = "Update"; } catch (Exception ex) { throw ex; } }
protected void btnSave_Click(object sender, EventArgs e) { try { LC_Brand _lcBrand = new LC_Brand(); _lcBrand.BrandName = txtBrandName.Text; _lcBrand.CreateDate = DateTime.Now; _lcBrand.CreateUser = (((SessionUser)Session["SessionUser"]).UserId); _lcBrand.OCode = Convert.ToString(((SessionUser)Session["SessionUser"]).OCode); if (btnSave.Text != "Update") { int result = _brandbLL.InsertStyle(_lcBrand); if (result == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Saved Successfully')", true); } } else { _lcBrand.EditDate = DateTime.Now; _lcBrand.EditUser = (((SessionUser)Session["SessionUser"]).UserId);; _lcBrand.BrandId = Convert.ToInt16(hidBrandId.Value); int result = _brandbLL.UpdateStyle(_lcBrand); if (result == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true); } } GetBrandList(); ClearAllController(); } catch (Exception ex) { throw ex; } }
internal int UpdateStyle(LC_Brand _lcBrand) { return(_branddaL.UpdateStyle(_lcBrand)); }
internal int InsertStyle(LC_Brand _lcBrand) { return(_branddaL.InsertStyle(_lcBrand)); }