protected void BtnDelete_Click(object sender, EventArgs e) { try { int DeleteId = 0; if (ViewState["EditID"] != null) { DeleteId = Convert.ToInt32(ViewState["EditID"]); } if (DeleteId != 0) { Entity_ItemCategory.SizeId = DeleteId; Entity_ItemCategory.UserId = Convert.ToInt32(Session["UserID"]); Entity_ItemCategory.LoginDate = DateTime.Now; int iDelete = Obj_ItemCategory.DeleteRecord(ref Entity_ItemCategory, out StrError); if (iDelete != 0) { obj_Comman.ShowPopUpMsg("Record Deleted Successfully..!", this.Page); MakeEmptyForm(); } } Entity_ItemCategory = null; Obj_ItemCategory = null; } catch (Exception ex) { throw new Exception(ex.Message); } }
protected void BtnSave_Click(object sender, EventArgs e) { int InsertRow = 0; try { Ds = Obj_ItemCategory.ChkDuplicate(TxtItemCat.Text.Trim(), out StrError); if (Ds.Tables[0].Rows.Count > 0) { obj_Comman.ShowPopUpMsg("Please Enter Another Item Category..", this.Page); TxtItemCat.Focus(); } else { Entity_ItemCategory.SizeName = TxtItemCat.Text.Trim(); Entity_ItemCategory.UserId = Convert.ToInt32(Session["UserId"]); Entity_ItemCategory.LoginDate = DateTime.Now; InsertRow = Obj_ItemCategory.InsertRecord(ref Entity_ItemCategory, out StrError); if (InsertRow != 0) { obj_Comman.ShowPopUpMsg("Record Saved Successfully", this.Page); MakeEmptyForm(); Entity_ItemCategory = null; Obj_ItemCategory = null; } } } catch (Exception ex) { throw new Exception(ex.Message); } }
protected void BtnUpdate_Click(object sender, EventArgs e) { int UpdateRow = 0; try { if (ViewState["EditID"] != null) { Entity_ItemCategory.SizeId = Convert.ToInt32(ViewState["EditID"]); } Entity_ItemCategory.SizeName = TxtItemCat.Text.Trim(); Entity_ItemCategory.UserId = Convert.ToInt32(Session["UserId"]); Entity_ItemCategory.LoginDate = DateTime.Now; UpdateRow = Obj_ItemCategory.UpdateRecord(ref Entity_ItemCategory, out StrError); if (UpdateRow != 0) { obj_Comman.ShowPopUpMsg("Record Updated Successfully", this.Page); MakeEmptyForm(); Entity_ItemCategory = null; Obj_ItemCategory = null; } } catch (Exception ex) { throw new Exception(ex.Message); } }
public int UpdateRecord(ref ItemSizeMaster Entity_Call, out string strError) { int iInsert = 0; strError = string.Empty; try { SqlParameter pAction = new SqlParameter(ItemSizeMaster._Action, SqlDbType.BigInt); SqlParameter pCategoryId = new SqlParameter(ItemSizeMaster._SizeId, SqlDbType.BigInt); SqlParameter pCategoryName = new SqlParameter(ItemSizeMaster._SizeName, SqlDbType.NVarChar); SqlParameter pUpdatedBy = new SqlParameter(ItemSizeMaster._UserId, SqlDbType.BigInt); SqlParameter pUpdatedDate = new SqlParameter(ItemSizeMaster._LoginDate, SqlDbType.DateTime); pAction.Value = 2; pCategoryId.Value = Entity_Call.SizeId; pCategoryName.Value = Entity_Call.SizeName; pUpdatedBy.Value = Entity_Call.UserId; pUpdatedDate.Value = Entity_Call.LoginDate; SqlParameter[] Param = new SqlParameter[] { pAction, pCategoryId, pCategoryName, pUpdatedBy, pUpdatedDate }; Open(CONNECTION_STRING); BeginTransaction(); iInsert = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, ItemSizeMaster.SP_ItemSizeMaster, Param); if (iInsert > 0) { CommitTransaction(); } else { RollBackTransaction(); } } catch (Exception ex) { RollBackTransaction(); strError = ex.Message; } finally { Close(); } return(iInsert); }