/// <summary> /// To save instructional designer details /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { InstructionalDesignerBAL InstructionalDesignerBAL = new InstructionalDesignerBAL(); int UserID = Convert.ToInt32(ddlInsDesUser.SelectedValue.ToString()); string Status = ddlInsDesStatus.SelectedValue.ToString(); bool IsActive = true; if (Status == "Active") { IsActive = true; } else if (Status == "InActive") { IsActive = false; } if (btnSave.Text == "Save") { try { // 'InsertInstructionalDesigner' is Instructional Designer business Access Layer function called // to insert Instructional Designer details int Result = InstructionalDesignerBAL.InsertInstructionalDesigner(UserID, IsActive, LoginUser, Ret); DtInsDes = IDDetails(); ViewState["DtInsDes"] = DtInsDes; BindInsDes(DtInsDes); MsgInsDes.Msg = "Record added successfully"; MsgInsDes.showmsg(); } catch (Exception ee) { // Duplicate Entry is catched when inserting Instructional Designer if (ee.Message == "Duplicate Entry") { MsgInsDes.Msg = "Duplicate Entry!"; MsgInsDes.showmsg(); ClearInsDes(); } } finally { InstructionalDesignerBAL = null; } } }
/// <summary> /// To filter dataview by selected operator, column and value /// </summary> /// <param name="DvInsDes"></param> /// <param name="Column"></param> /// <param name="Operator"></param> /// <param name="Value"></param> public void FilterDataview(DataView DvInsDes, string Column, string Operator, string Value) { DvInsDes.RowFilter = Column + " " + Operator + "'" + Value + "'"; if (DvInsDes.ToTable().Rows.Count == 0) { MsgInsDes.Msg = "Record(s) not found"; MsgInsDes.showmsg(); ViewState["DtInsDes"] = DvInsDes.ToTable(); BindInsDes(DvInsDes.ToTable()); ddlCol.SelectedIndex = 0; ddlOpe.SelectedIndex = 0; ddlVal.SelectedIndex = 0; } else { ViewState["DtInsDes"] = DvInsDes.ToTable(); BindInsDes(DvInsDes.ToTable()); } }