protected void grdDescription_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditRow") { ViewState["DescriptionID"] = Convert.ToInt32(e.CommandArgument); int desID = Convert.ToInt32(ViewState["DescriptionID"]); DescriptionBLL objDescriptionBLL = new DescriptionBLL(); DescriptionBO objdesc = new DescriptionBO(); objdesc = objDescriptionBLL.GetAllDescriptionDetailsByID(desID); ddlparam.SelectedValue = Convert.ToString(objdesc.ParameterID); ddloptionAvailable.SelectedValue = Convert.ToString(objdesc.OptionAvailID); txtDescription.Text = objdesc.Description; btnSave.Text = "Update"; btnClear.Text = "Cancel"; ddlparam.Enabled = true; } else if (e.CommandName == "DeleteRow") { string result = ""; ViewState["DescriptionDelID"] = Convert.ToInt32(e.CommandArgument); int desID = Convert.ToInt32(ViewState["DescriptionDelID"]); DescriptionBLL objDescriptionBLL = new DescriptionBLL(); DescriptionBO objdesc = new DescriptionBO(); result = objDescriptionBLL.DeleteDescription(desID); if (string.IsNullOrEmpty(result) || result == "" || result == "null") { result = "Data deleted successfully"; } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + result + "');", true); bindGrid(); } }
protected void IsObsolete_CheckedChanged(Object sender, EventArgs e) { string message = string.Empty; try { CheckBox chk = (CheckBox)sender; GridViewRow gr = (GridViewRow)chk.Parent.Parent; string DescID = ((Literal)gr.FindControl("litSUBCOUNTYID")).Text; DescriptionBLL objDescriptionBLL = new DescriptionBLL(); message = objDescriptionBLL.ObsoleteDescription(Convert.ToInt32(DescID), Convert.ToString(chk.Checked), Convert.ToInt32(Session["USER_ID"])); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; } ClearData(); bindGrid(); if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Obsoleted", "alert('" + message + "');", true); } } catch (Exception ex) { throw ex; } }
private void bindGrid() { DescriptionList objDescriptionList = new DescriptionList(); DescriptionBLL objdescriptionBLL = new DescriptionBLL(); objDescriptionList = objdescriptionBLL.GetAllDescriptionDetails(); grdDescription.DataSource = objDescriptionList; grdDescription.DataBind(); }
private void updateDescription() { DescriptionBLL descriptionBLL = new DescriptionBLL(); DescriptionBO DescriptionBO = new DescriptionBO(); string message = ""; string uID = string.Empty; uID = Session["USER_ID"].ToString(); DescriptionBO.DescriptionID = Convert.ToInt32(ViewState["DescriptionID"]); DescriptionBO.ParameterID = Convert.ToInt32(ddlparam.SelectedItem.Value); DescriptionBO.OptionAvailID = Convert.ToInt32(ddloptionAvailable.SelectedItem.Value); if (txtDescription.Text != "") { DescriptionBO.Description = txtDescription.Text.Trim(); } DescriptionBO.CreatedBy = Convert.ToInt32(uID); try { message = descriptionBLL.UpdateDesription(DescriptionBO); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data Updated successfully"; } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } ClearData(); bindGrid(); btnSave.Text = "Save"; btnClear.Text = "Clear"; } catch (Exception ee) { throw ee; } finally { descriptionBLL = null; } }