protected void btnuserok_Click(object sender, EventArgs e) { try { Fpuser.SaveChanges(); for (int r = 0; r < Fpuser.Sheets[0].Rows.Count; r++) { int isval = Convert.ToInt32(Fpuser.Sheets[0].Cells[r, 3].Value); if (isval == 1) { string strquery = "select User_id,Full_Name from UserMaster where User_id='" + Fpuser.Sheets[0].Cells[r, 1].Text.ToString() + "'"; DataSet ds = d2.select_method_wo_parameter(strquery, "Text"); if (ds.Tables[0].Rows.Count > 0) { string uname = ds.Tables[0].Rows[0]["user_id"].ToString(); string funame = ds.Tables[0].Rows[0]["full_name"].ToString(); txtusername.Text = uname; } Puser.Visible = false; } } } catch (Exception ex) { lblperrmsg.Visible = true; lblperrmsg.Text = ex.ToString(); } }
protected void btnuserok_Click(object sender, EventArgs e) { try { lblstaffcodehide.Text = ""; Fpuser.SaveChanges(); chkgroup.Checked = false; txtgroup.Text = "---Select---"; for (int g = 0; g < chklsgroup.Items.Count; g++) { chklsgroup.Items[g].Selected = false; } for (int r = 0; r < Fpuser.Sheets[0].Rows.Count; r++) { int isval = Convert.ToInt32(Fpuser.Sheets[0].Cells[r, 3].Value); if (isval == 1) { string strquery = "select User_id,Full_Name,Description,group_code,SingleUser,is_staff,staff_code,college_code,phone_no,fin_user,otpconfirm,counter_no,counter_name from UserMaster where User_id='" + Fpuser.Sheets[0].Cells[r, 1].Text.ToString() + "'"; DataSet ds = d2.select_method_wo_parameter(strquery, "Text"); if (ds.Tables[0].Rows.Count > 0) { string uname = ds.Tables[0].Rows[0]["user_id"].ToString(); string funame = ds.Tables[0].Rows[0]["full_name"].ToString(); string descript = ds.Tables[0].Rows[0]["Description"].ToString(); string groupode = ds.Tables[0].Rows[0]["group_code"].ToString(); string singuser = ds.Tables[0].Rows[0]["SingleUser"].ToString(); string staffuser = ds.Tables[0].Rows[0]["is_staff"].ToString(); string staffcode = ds.Tables[0].Rows[0]["staff_code"].ToString(); string collode = ds.Tables[0].Rows[0]["college_code"].ToString(); string phno = ds.Tables[0].Rows[0]["phone_no"].ToString(); string finuser = ds.Tables[0].Rows[0]["fin_user"].ToString(); string countno = ds.Tables[0].Rows[0]["counter_no"].ToString(); string countname = ds.Tables[0].Rows[0]["counter_name"].ToString(); string otpuser = ds.Tables[0].Rows[0]["otpconfirm"].ToString(); txtusername.Text = uname; txtfullname.Text = funame; txtdescription.Text = descript; txtphone.Text = phno; txtcounter.Text = countno; txtcouname.Text = countname; txtstaffname.Visible = false; lblstaffname.Visible = false; chkstaff.Checked = false; txtstaffname.Text = ""; if (staffuser.Trim() == "1" || staffuser.Trim().ToLower() == "true") { chkstaff.Checked = true; txtstaffname.Visible = true; lblstaffname.Visible = true; lblstaffcodehide.Text = staffcode; string staffname = d2.GetFunction("Select staff_name from staffmaster where staff_code='" + staffcode + "'"); txtstaffname.Text = staffname; } chkfin.Checked = false; if (finuser.Trim() == "1" || finuser.Trim().ToLower() == "true") { chkfin.Checked = true; } ChkOtpConfirm.Checked = false;//abarna if (otpuser.Trim() == "1" || otpuser.Trim().ToLower() == "true") { ChkOtpConfirm.Checked = true; } chkgroupuser.Checked = false; if (singuser.Trim() == "0" || singuser.Trim().ToLower() == "false") { chkgroupuser.Checked = true; int commcount = 0; Hashtable hatgroup = new Hashtable(); string[] spg = groupode.Split(';'); for (int gc = 0; gc <= spg.GetUpperBound(0); gc++) { if (!hatgroup.Contains(spg[gc].ToString())) { hatgroup.Add(spg[gc].ToString(), spg[gc].ToString()); } } for (int g = 0; g < chklsgroup.Items.Count; g++) { string gcod = chklsgroup.Items[g].Value.ToString(); if (hatgroup.Contains(gcod)) { chklsgroup.Items[g].Selected = true; commcount = commcount + 1; } else { chklsgroup.Items[g].Selected = false; } } if (commcount > 0) { txtgroup.Text = "Group (" + commcount.ToString() + ")"; if (chklsgroup.Items.Count == commcount) { chkgroup.Checked = true; } } } Puser.Visible = false; } } } } catch (Exception ex) { lblperrmsg.Visible = true; lblperrmsg.Text = ex.ToString(); } }