/// <summary> /// To save details to database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string message = ""; LocationClassificationBLL BLLobj = null; try { BLLobj = new LocationClassificationBLL(); LocationClassificationBO BOobj = new LocationClassificationBO(); if (Convert.ToInt32(ViewState["LOCTNCLASFCTNID"]) > 0) { BOobj.LOCTNCLASFCTNID = Convert.ToInt32(ViewState["LOCTNCLASFCTNID"]); BOobj.LOCTNCLASFCTNNAME = txtLocation.Text.Trim(); BOobj.LOCTNCODE = txtcompland.Text.Trim(); BOobj.CREATEDBY = Convert.ToInt32(Session["USER_ID"]); message = BLLobj.UPDATElocation(BOobj); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data Updated Successfully"; } SetUpdateMode(false); } else { BOobj.CREATEDBY = Convert.ToInt32(Session["USER_ID"]); BOobj.LOCTNCLASFCTNNAME = txtLocation.Text.Trim(); BOobj.LOCTNCODE = txtcompland.Text.Trim(); message = BLLobj.INSERTlocation(BOobj); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data Saved Successfully"; } } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } clearfields(); BindGrid(true, true); } catch (Exception ex) { throw ex; } finally { BLLobj = null; } }