/// <summary> /// To save content lead details /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { ContentLeadBAL ContentLeadBAL = new ContentLeadBAL(); int UserID = Convert.ToInt32(ddlConLeadUser.SelectedValue.ToString()); string Status = ddlConLeadStatus.SelectedValue.ToString(); bool IsActive = true; if (Status == "Active") { IsActive = true; } else if (Status == "InActive") { IsActive = false; } if (btnSave.Text == "Save") { try { // 'InsertContentLead' is Content lead business Access Layer function called // to insert Content lead details int Result = ContentLeadBAL.InsertContentLead(UserID, IsActive, LoginUser, Ret); DtConLead = ConLeadDetails(); ViewState["DtConLead"] = DtConLead; BindConLead(DtConLead); MsgConLead.Msg = "Record added successfully"; MsgConLead.showmsg(); } catch (Exception ee) { // Duplicate Entry is catched when inserting Content Developer if (ee.Message == "Duplicate Entry") { MsgConLead.Msg = "Duplicate Entry!"; MsgConLead.showmsg(); ClearConLead(); } } finally { // Object is closed after use ContentLeadBAL = null; } } }
/// <summary> /// To filter details in grid on different conditions selected by user /// </summary> /// <param name="DvConDev"></param> /// <param name="Column"></param> /// <param name="Operator"></param> /// <param name="Value"></param> public void filterDataview(DataView DvConDev, string Column, string Operator, string Value) { DvConDev.RowFilter = Column + " " + Operator + "'" + Value + "'"; if (DvConDev.ToTable().Rows.Count == 0) { MsgConLead.Msg = "Record(s) not found"; MsgConLead.showmsg(); ViewState["DtConLead"] = DvConDev.ToTable(); BindConLead(DvConDev.ToTable()); ddlCol.SelectedIndex = 0; ddlOpe.SelectedIndex = 0; ddlVal.SelectedIndex = 0; } else { ViewState["DtConLead"] = DvConDev.ToTable(); BindConLead(DvConDev.ToTable()); } }