protected void lnkBtnAdd_Click(object sender, EventArgs e) { try { DataSet ds = new DataSet(); string connection = string.Empty; string userid = string.Empty; if (Request.Cookies["Company"] != null) { connection = Request.Cookies["Company"].Value; } txtUser.Enabled = true; txtUser.Text = ""; chkAccLocked.Checked = false; chkboxdatelock.Checked = false; txtEmail.Text = ""; BusinessLogic objBus = new BusinessLogic(); string Types = string.Empty; ds = objBus.GetMasterRolesWithArea(System.Configuration.ConfigurationManager.ConnectionStrings[connection].ConnectionString, Types); Session["Show"] = "Add New"; GrdViewItem.DataSource = ds; GrdViewItem.DataBind(); ModalPopupGet.Show(); } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void GrdViewCust_SelectedIndexChanged(object sender, EventArgs e) { try { string strPaymode = string.Empty; string username = string.Empty; GridViewRow row = GrdViewCust.SelectedRow; string connection = Request.Cookies["Company"].Value; BusinessLogic bl = new BusinessLogic(); username = Convert.ToString(GrdViewCust.SelectedDataKey.Value); Session["Show"] = "Edit"; DataSet ds = bl.GetUserOptionsForId(username, connection, ""); DataSet dsd = bl.GetUserInfo(username, connection); if (dsd != null) { if (dsd.Tables[0].Rows.Count == 1) { txtUser.Text = dsd.Tables[0].Rows[0]["username"].ToString(); txtUser.Enabled = false; txtEmail.Text = dsd.Tables[0].Rows[0]["email"].ToString(); chkAccLocked.Checked = bool.Parse(dsd.Tables[0].Rows[0]["Locked"].ToString()); chkboxdatelock.Checked = bool.Parse(dsd.Tables[0].Rows[0]["DateLock"].ToString()); } } //DataSet dsd; //DataTable dt; //DataRow drNew; //DataColumn dc; //dsd = new DataSet(); //dt = new DataTable(); //dc = new DataColumn("UserName"); //dt.Columns.Add(dc); //dc = new DataColumn("Role"); //dt.Columns.Add(dc); //dc = new DataColumn("RoleDesc"); //dt.Columns.Add(dc); //dc = new DataColumn("Section"); //dt.Columns.Add(dc); //dc = new DataColumn("Area"); //dt.Columns.Add(dc); //dc = new DataColumn("Add"); //dt.Columns.Add(dc); //dc = new DataColumn("Edit"); //dt.Columns.Add(dc); //dc = new DataColumn("Delete"); //dt.Columns.Add(dc); //dc = new DataColumn("View"); //dt.Columns.Add(dc); //dsd.Tables.Add(dt); //bool Add = false; //bool Edit = false; //bool Delete = false; //bool Views = false; //foreach (DataRow dr in ds.Tables[0].Rows) //{ // drNew = dt.NewRow(); // drNew["Role"] = dr["Role"].ToString(); // drNew["RoleDesc"] = dr["RoleDesc"].ToString(); // drNew["Section"] = dr["Section"].ToString(); // drNew["Area"] = dr["Area"].ToString(); // if (Convert.ToBoolean(dr["Add"]) == true) // { // CheckBox txt = (CheckBox)GrdViewItem.FindControl("chkboxAdd"); // if (txt.Checked) // { // Add = txt.Checked; // } // else // { // Add = false; // } // } // else // { // Add = false; // } // drNew["Edit"] = Edit; // drNew["Delete"] = Delete; // drNew["View"] = Views; // dsd.Tables[0].Rows.Add(drNew); //} GrdViewItem.DataSource = ds; GrdViewItem.DataBind(); ModalPopupGet.Show(); } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }