protected void GridView_Category_RowUpdating(object sender, GridViewUpdateEventArgs e) { JRA_Lib JRALib_Data = new JRA_Lib(); try { GridViewRow row = (GridViewRow)GridView_Category.Rows[e.RowIndex]; int ID = UDFLib.ConvertToInteger(GridView_Category.DataKeys[e.RowIndex].Values[0].ToString()); GridView_Category.EditIndex = -1; JRALib_Data.UserID = Convert.ToInt32(Session["USERID"]); JRALib_Data.Work_Categ_ID = Convert.ToInt32(ID); JRALib_Data.Work_Categ_Parent_ID = Convert.ToInt32(((HiddenField)row.FindControl("hdnParent_Work_Categ_ID")).Value); JRALib_Data.Work_Category_Name = (((TextBox)row.FindControl("txtCategory_Name")).Text.Trim()); JRALib_Data.Work_Categ_Value = (((TextBox)row.FindControl("txtWork_Categ_Value")).Text.Trim()); JRALib_Data.DB_Mode = "U"; int result = BLL_JRA_Work_Category.JRA_INS_WorkCategory(JRALib_Data); Search_WorkCategory(); Load_CategoryList(null, 0); } catch { } }
protected void GridView_Category_RowDeleting(object sender, GridViewDeleteEventArgs e) { JRA_Lib JRALib_Data = new JRA_Lib(); int ID = UDFLib.ConvertToInteger(GridView_Category.DataKeys[e.RowIndex].Value.ToString()); JRALib_Data.Work_Categ_ID = ID; JRALib_Data.UserID = Convert.ToInt32(Session["USERID"]); JRALib_Data.DB_Mode = "D"; int result = BLL_JRA_Work_Category.JRA_INS_WorkCategory(JRALib_Data); //GroupGridviewHeader(); Search_WorkCategory(); Load_CategoryList(null, 0); }
private void SaveWorkCategory(string DB_Mode) { JRA_Lib JRALib_Data = new JRA_Lib(); JRALib_Data.UserID = Convert.ToInt32(Session["USERID"]); JRALib_Data.Work_Categ_ID = Convert.ToInt32(0); JRALib_Data.Work_Categ_Parent_ID = Convert.ToInt32(ddlParentCat.SelectedValue); JRALib_Data.Work_Categ_Value = txtCatVal.Text.Trim(); JRALib_Data.Work_Category_Name = txtCatName.Text.Trim(); JRALib_Data.DB_Mode = DB_Mode; int result = BLL_JRA_Work_Category.JRA_INS_WorkCategory(JRALib_Data); if (result == 999)//CHECK FOR DUPLICATE WORK CATEGORY NAME { string js = ""; js = "alert('Work Category Name already exists.');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", js, true); } }