protected void BindDropTechnicianAssign() { objRole = objRole.Get_RoleInfo_By_RoleName("technician"); int roleid = Convert.ToInt32(objRole.Roleid); coltechnician = ObjUserLogin.Get_All_By_Role(roleid); }
//public void BindDrpOrg() //{ // BLLCollection<Organization_mst> col = new BLLCollection<Organization_mst>(); // Organization_mst ObjOrganization = new Organization_mst(); // col = ObjOrganization.Get_All(); // DrpOrg.DataTextField = "Orgname"; // DrpOrg.DataValueField = "orgid"; // DrpOrg.DataSource = col; // DrpOrg.DataBind(); //} protected void btnSave_Click(object sender, EventArgs e) { objOrganization = objOrganization.Get_Organization(); int FlagStatus, FlagStatus1; int userid = Convert.ToInt16(Request.QueryString[0]); ObjUserLogin.Userid = userid; ObjUserLogin.Roleid = Convert.ToInt16(dropRole.SelectedValue.ToString()); if (lblAdUser.Text.ToString().Trim() == "Yes") { ObjUserLogin.ADEnable = true; } else { ObjUserLogin.ADEnable = false; } if (DropEnable.SelectedValue == "1") { ObjUserLogin.Enable = true; } else { ObjUserLogin.Enable = false; } ObjUserLogin.Orgid = objOrganization.Orgid; ObjUserLogin.Username = txtUserName.Text.ToString().Trim(); ObjUserLogin.Password = txtPassword.Text.ToString().Trim(); ObjContactInfo.Firstname = txtFname.Text.ToString().Trim(); ObjContactInfo.Lastname = txtLname.Text.ToString().Trim(); ObjContactInfo.Mobile = txtMobile.Text.ToString().Trim(); ObjContactInfo.Landline = txtLandline.Text.ToString().Trim(); ObjContactInfo.Empid = txtEmpId.Text.ToString().Trim(); ObjContactInfo.Siteid = Convert.ToInt16(DrpSite.SelectedValue.ToString()); ObjContactInfo.Deptid = Convert.ToInt16(DrpDepartment.SelectedValue.ToString()); ObjContactInfo.Emailid = txtEmailId.Text.ToString().Trim(); ObjContactInfo.Description = txtDesc.Text.ToString().Trim(); ObjContactInfo.Userid = userid; FlagStatus = ObjUserLogin.Update(); FlagStatus1 = ObjContactInfo.Update(); RoleInfo_mst objR = new RoleInfo_mst(); int roleid = Convert.ToInt16(ViewState["Roleid"].ToString()); objR = objRole.Get_By_id(roleid); if (objR.Roleid != 0) { Roles.RemoveUserFromRole(txtUserName.Text.ToString().Trim(), objR.Rolename); Roles.AddUserToRole(txtUserName.Text.ToString().Trim(), dropRole.SelectedItem.Text.ToString().Trim()); } if (FlagStatus == 1 && FlagStatus1 == 1) { // Redirect to page ViewSite.aspx page after successfully Updation Response.Redirect("~/admin/ViewUser.aspx"); } else { //If Updation is not successfully,Display Error Message //lblErrorMsg.Text = Resources.MessageResource.errOccured.ToString().Trim(); } }
protected void BindDropTechnicianAssign() { objRole = objRole.Get_RoleInfo_By_RoleName("technician"); int roleid = Convert.ToInt32(objRole.Roleid); coltechnician = ObjUserLogin.Get_All_By_Role(roleid); //drpTechnician1.DataTextField = "username"; //drpTechnician1.DataValueField = "userid"; //drpTechnician1.DataSource = coltechnician; //drpTechnician1.DataBind(); //ListItem item = new ListItem(); //item.Text = "---Select Technician---"; //item.Value = "0"; //drpTechnician1.Items.Add(item); //drpTechnician1.SelectedValue = "0"; }
protected void BindDropTechnician() { objRole = objRole.Get_RoleInfo_By_RoleName("technician"); if (objRole.Roleid != 0) { int siteid = 0; int roleid; if (drpSite.SelectedValue != "") { siteid = Convert.ToInt32(drpSite.SelectedValue); } roleid = objRole.Roleid; if (siteid != 0 && roleid != 0) { colUser = objUser.Get_All_By_Role_Site(roleid, siteid); drpTechnician.DataTextField = "username"; drpTechnician.DataValueField = "userid"; drpTechnician.DataSource = colUser; drpTechnician.DataBind(); ListItem item = new ListItem(); item.Text = "All"; item.Value = "0"; drpTechnician.Items.Add(item); //item.Text = "-----------Select-----------"; //item.Value = "0"; //drpTechnician.Items.Add(item); drpTechnician.SelectedValue = "0"; } else { colUser = objUser.Get_All_By_Role_Site(roleid, siteid); drpTechnician.DataTextField = "username"; drpTechnician.DataValueField = "userid"; drpTechnician.DataSource = colUser; drpTechnician.DataBind(); ListItem item = new ListItem(); item.Text = "All"; item.Value = "0"; drpTechnician.Items.Add(item); //item.Text = "-----------Select-----------"; //item.Value = "0"; //drpTechnician.Items.Add(item); drpTechnician.SelectedValue = "0"; } } }
protected void BindDropTechnicianAssign() { objRole = objRole.Get_RoleInfo_By_RoleName("technician"); int roleid = Convert.ToInt16(objRole.Roleid); coltechnician = ObjUserLogin.Get_All_By_Role(roleid); //drpTechnician1.DataTextField = "username"; //drpTechnician1.DataValueField = "userid"; //drpTechnician1.DataSource = coltechnician; //drpTechnician1.DataBind(); //ListItem item = new ListItem(); //item.Text = "---Select Technician---"; //item.Value = "0"; //drpTechnician1.Items.Add(item); //drpTechnician1.SelectedValue = "0"; }
protected void BindDropTechnician() { objRole = objRole.Get_RoleInfo_By_RoleName("technician"); if (objRole.Roleid != 0) { int siteid = 0; int roleid; // drpSite.SelectedIndex = 2; if (drpSite.SelectedValue != "") { siteid = Convert.ToInt16(drpSite.SelectedValue); } roleid = objRole.Roleid; if (siteid != 0 && roleid != 0) { colUser = objUser.Get_All_By_Role_Site(roleid, siteid); drpTechnician.DataTextField = "username"; drpTechnician.DataValueField = "userid"; drpTechnician.DataSource = colUser; drpTechnician.DataBind(); ListItem item = new ListItem(); item.Text = "-------------Select-------------"; item.Value = "0"; drpTechnician.Items.Add(item); drpTechnician.SelectedValue = "0"; } //else //{ // colUser = objUser.Get_All_By_Role_Site(roleid, siteid); // drpTechnician.DataTextField = "username"; // drpTechnician.DataValueField = "userid"; // drpTechnician.DataSource = colUser; // drpTechnician.DataBind(); // ListItem item = new ListItem(); // item.Text = "-------------Select-------------"; // item.Value = "0"; // drpTechnician.Items.Add(item); // drpTechnician.SelectedValue = "0"; //} } }
// Define Function BinddropRole to Bind DropDown Role public void BinddropRole() { // Declare col as Collection of RoleInfo_mst Object to get all records from table BLLCollection<RoleInfo_mst> col = new BLLCollection<RoleInfo_mst>(); // declare object objRole of RoleInfo_mst Class to call function Get_All() to fetch all records from database RoleInfo_mst objRole = new RoleInfo_mst(); // Assign all records to variable col col = objRole.Get_All(); dropRole.DataTextField = "rolename"; dropRole.DataValueField = "roleid"; dropRole.DataSource = col; dropRole.DataBind(); // Declare item as listItem to assign default value to drop down ListItem item = new ListItem(); item.Text = "--------------Select---------------"; item.Value = "0"; dropRole.Items.Add(item); dropRole.SelectedValue = "0"; }
protected void Rolegrdvw_RowUpdating(object sender, GridViewUpdateEventArgs e) { RoleInfo_mst obj = new RoleInfo_mst(); string name, desc, id; int RoleId = 0, rid; name = ((TextBox)Rolegrdvw.Rows[e.RowIndex].Cells[1].Controls[0]).Text; desc = ((TextBox)Rolegrdvw.Rows[e.RowIndex].Cells[2].Controls[0]).Text; id = Convert.ToString(Rolegrdvw.Rows[e.RowIndex].Cells[0].Text); RoleId = Convert.ToInt32(id); rid = obj.Get_Role_By_Roleid(name); RoleObj = RoleObj.Get_By_id(RoleId); if ((rid == 0) && (name != "")) { RoleObj.Roleid = RoleId; RoleObj.Rolename = name; RoleObj.Description = desc; RoleObj.Update(); Rolegrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else if (RoleObj.Rolename == name) { RoleObj.Roleid = RoleId; RoleObj.Rolename = name; RoleObj.Description = desc; RoleObj.Update(); Rolegrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else if (name == "") { lblerrmsg.Text = Resources.MessageResource.errnotempty.ToString(); } else { lblerrmsg.Text = Resources.MessageResource.erralready.ToString(); } }
public void BinddropRole() { // Declare col as Collection of RoleInfo_mst Object to get all records from table BLLCollection <RoleInfo_mst> col = new BLLCollection <RoleInfo_mst>(); // declare object objRole of RoleInfo_mst Class to call function Get_All() to fetch all records from database RoleInfo_mst objRole = new RoleInfo_mst(); // Assign all records to variable col col = objRole.Get_All(); dropRole.DataTextField = "rolename"; dropRole.DataValueField = "roleid"; dropRole.DataSource = col; dropRole.DataBind(); // Declare item as listItem to assign default value to drop down ListItem item = new ListItem(); item.Text = Resources.MessageResource.errSelectRole.ToString(); item.Value = "0"; dropRole.Items.Add(item); dropRole.SelectedValue = "0"; }
protected void BindDropTechnician() { objRole = objRole.Get_RoleInfo_By_RoleName("technician"); if (objRole.Roleid != 0) { int roleid; roleid = objRole.Roleid; if (roleid != 0) { colUser = objUser.Get_All_By_Role(roleid); drpUserList.DataTextField = "username"; drpUserList.DataValueField = "userid"; drpUserList.DataSource = colUser; drpUserList.DataBind(); ListItem item = new ListItem(); item.Text = "-------------Select-------------"; item.Value = "0"; drpUserList.Items.Add(item); drpUserList.SelectedValue = "0"; } } }
protected void BindDropTechnician() { objRole = objRole.Get_RoleInfo_By_RoleName("technician"); if (objRole.Roleid != 0) { int siteid = 0; int roleid; if (drpSite.SelectedValue != "") { siteid = Convert.ToInt32(drpSite.SelectedValue); } roleid = objRole.Roleid; if (siteid != 0 && roleid != 0) { colUser = objUser.Get_All_By_Role_Site(roleid, siteid); //meenakshi for (int i = 0; i < colUser.Count; i++) { for (int j = i; j < colUser.Count; j++) { if (String.Compare(colUser[i].Username, colUser[j].Username) > 0) { UserLogin_mst obj = new UserLogin_mst(); obj = colUser[i]; colUser[i] = colUser[j]; colUser[j] = obj; } } } //end drpTechnician.DataTextField = "username"; drpTechnician.DataValueField = "userid"; drpTechnician.DataSource = colUser; drpTechnician.DataBind(); ListItem item = new ListItem(); item.Text = "All"; item.Value = "0"; drpTechnician.Items.Add(item); //item.Text = "-----------Select-----------"; //item.Value = "0"; //drpTechnician.Items.Add(item); drpTechnician.SelectedValue = "0"; } else { colUser = objUser.Get_All_By_Role_Site(roleid, siteid); //meenakshi for (int i = 0; i < colUser.Count; i++) { for (int j = i; j < colUser.Count; j++) { if (String.Compare(colUser[i].Username, colUser[j].Username) > 0) { UserLogin_mst obj = new UserLogin_mst(); obj = colUser[i]; colUser[i] = colUser[j]; colUser[j] = obj; } } } //end drpTechnician.DataTextField = "username"; drpTechnician.DataValueField = "userid"; drpTechnician.DataSource = colUser; drpTechnician.DataBind(); ListItem item = new ListItem(); item.Text = "All"; item.Value = "0"; drpTechnician.Items.Add(item); //item.Text = "-----------Select-----------"; //item.Value = "0"; //drpTechnician.Items.Add(item); drpTechnician.SelectedValue = "0"; } } }
public object GenerateRoleInfo_mstObject(ref IDataReader returnData) { RoleInfo_mst obj = new RoleInfo_mst(); while (returnData.Read()) { obj.Roleid = (int)returnData["Roleid"]; obj.Rolename = (string)returnData["Rolename"]; obj.Description = (string)returnData["Description"]; } returnData.Close(); returnData.Dispose(); return obj; }
protected void BindDropTechnician() { string vartechnician = Resources.MessageResource.strTechnicianRole.ToString(); objRole = objRole.Get_RoleInfo_By_RoleName(vartechnician); if (objRole.Roleid != 0) { int siteid; int roleid; if (drpSite.SelectedValue != "") { siteid = Convert.ToInt32(drpSite.SelectedValue); roleid = objRole.Roleid; if (siteid != 0 && roleid != 0) { colUser = objUser.Get_All_By_Role_Site(roleid, siteid); drpTechnician.DataTextField = "username"; drpTechnician.DataValueField = "userid"; drpTechnician.DataSource = colUser; drpTechnician.DataBind(); ListItem item = new ListItem(); item.Text = "-------------Select-------------"; item.Value = "0"; drpTechnician.Items.Add(item); drpTechnician.SelectedValue = "0"; } else { colUser = objUser.Get_All_By_Role_Site(roleid, siteid); drpTechnician.DataTextField = "username"; drpTechnician.DataValueField = "userid"; drpTechnician.DataSource = colUser; drpTechnician.DataBind(); ListItem item = new ListItem(); item.Text = "-------------Select-------------"; item.Value = "0"; drpTechnician.Items.Add(item); drpTechnician.SelectedValue = "0"; } } } }
//public void BindDrpOrg() //{ // BLLCollection<Organization_mst> col = new BLLCollection<Organization_mst>(); // Organization_mst ObjOrganization = new Organization_mst(); // col = ObjOrganization.Get_All(); // DrpOrg.DataTextField = "Orgname"; // DrpOrg.DataValueField = "orgid"; // DrpOrg.DataSource = col; // DrpOrg.DataBind(); //} protected void btnSave_Click(object sender, EventArgs e) { objOrganization = objOrganization.Get_Organization(); int FlagStatus, FlagStatus1; int userid = Convert.ToInt16(Request.QueryString[0]); ObjUserLogin.Userid = userid; ObjUserLogin.Roleid = Convert.ToInt16(dropRole.SelectedValue.ToString()); if (lblAdUser.Text.ToString().Trim() == "Yes") { ObjUserLogin.ADEnable=true ; } else { ObjUserLogin.ADEnable = false; } if (DropEnable.SelectedValue == "1") { ObjUserLogin.Enable = true; } else { ObjUserLogin.Enable = false; } ObjUserLogin.Orgid = objOrganization.Orgid ; ObjUserLogin.Username = txtUserName.Text.ToString().Trim(); ObjUserLogin.Password = txtPassword.Text.ToString().Trim(); ObjContactInfo.Firstname = txtFname.Text.ToString().Trim(); ObjContactInfo.Lastname = txtLname.Text.ToString().Trim(); ObjContactInfo.Mobile = txtMobile.Text.ToString().Trim(); ObjContactInfo.Landline = txtLandline.Text.ToString().Trim(); ObjContactInfo.Empid = txtEmpId.Text.ToString().Trim(); ObjContactInfo.Siteid = Convert.ToInt16(DrpSite.SelectedValue.ToString()); ObjContactInfo.Deptid = Convert.ToInt16(DrpDepartment.SelectedValue.ToString()); ObjContactInfo.Emailid = txtEmailId.Text.ToString().Trim(); ObjContactInfo.Description = txtDesc.Text.ToString().Trim(); ObjContactInfo.Userid = userid; FlagStatus = ObjUserLogin.Update(); FlagStatus1 = ObjContactInfo.Update(); RoleInfo_mst objR = new RoleInfo_mst(); int roleid = Convert.ToInt16(ViewState["Roleid"].ToString()); objR = objRole.Get_By_id(roleid); if (objR.Roleid!=0) { Roles.RemoveUserFromRole(txtUserName.Text.ToString().Trim(), objR.Rolename); Roles.AddUserToRole(txtUserName.Text.ToString().Trim(), dropRole.SelectedItem.Text.ToString().Trim()); } if (FlagStatus == 1 && FlagStatus1 == 1) { // Redirect to page ViewSite.aspx page after successfully Updation Response.Redirect("~/admin/ViewUser.aspx"); } else { //If Updation is not successfully,Display Error Message //lblErrorMsg.Text = Resources.MessageResource.errOccured.ToString().Trim(); } }
public int Update_RoleInfo_mst_By_id(RoleInfo_mst objRoleInfo) { return (int)ExecuteNonQuery(Sp_RoleInfo_Update, new object[] { objRoleInfo.Rolename, objRoleInfo.Roleid, objRoleInfo.Description }); }
public int Insert_RoleInfo_mst(RoleInfo_mst objRoleInfo) { return (int)ExecuteNonQuery(Sp_RoleInfo_Insert, new object[] { objRoleInfo.Rolename, objRoleInfo.Roleid, objRoleInfo.Description }); }
protected void Rolegrdvw_RowUpdating(object sender, GridViewUpdateEventArgs e) { RoleInfo_mst obj = new RoleInfo_mst(); string name, desc, id; int RoleId = 0, rid; name = ((TextBox)Rolegrdvw.Rows[e.RowIndex].Cells[1].Controls[0]).Text; desc = ((TextBox)Rolegrdvw.Rows[e.RowIndex].Cells[2].Controls[0]).Text; id = Convert.ToString(Rolegrdvw.Rows[e.RowIndex].Cells[0].Text); RoleId = Convert.ToInt32(id); rid = obj.Get_Role_By_Roleid(name); RoleObj = RoleObj.Get_By_id(RoleId); if ((rid == 0)&&(name !="")) { RoleObj.Roleid = RoleId; RoleObj.Rolename = name; RoleObj.Description = desc; RoleObj.Update(); Rolegrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else if(RoleObj.Rolename==name) { RoleObj.Roleid = RoleId; RoleObj.Rolename = name; RoleObj.Description = desc; RoleObj.Update(); Rolegrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else if(name == "") { lblerrmsg.Text = Resources.MessageResource.errnotempty.ToString(); } else { lblerrmsg.Text = Resources.MessageResource.erralready.ToString(); } }
public CollectionBase GenerateRoleInfo_mstCollection(ref IDataReader returnData) { BLLCollection<RoleInfo_mst> col = new BLLCollection<RoleInfo_mst>(); while (returnData.Read()) { RoleInfo_mst obj = new RoleInfo_mst(); obj.Roleid = (int)returnData["Roleid"]; obj.Rolename = (string)returnData["Rolename"]; obj.Description = (string)returnData["Description"]; col.Add(obj); } returnData.Close(); returnData.Dispose(); return col; }
protected void BindDropTechnician1() { objRole = objRole.Get_RoleInfo_By_RoleName("technician"); if (objRole.Roleid != 0) { int siteid; int roleid; //if (drpSite1.SelectedValue != "") //{ // siteid = Convert.ToInt32(drpSite1.SelectedValue); // roleid = objRole.Roleid; // if (siteid != 0 && roleid != 0) // { // colUser = objUser.Get_All_By_Role_Site(roleid, siteid); // drpTechnician1.DataTextField = "username"; // drpTechnician1.DataValueField = "userid"; // drpTechnician1.DataSource = colUser; // drpTechnician1.DataBind(); // ListItem item = new ListItem(); // item.Text = "-------------Select-------------"; // item.Value = "0"; // drpTechnician1.Items.Add(item); // drpTechnician1.SelectedValue = "0"; // } // else // { // colUser = objUser.Get_All_By_Role_Site(roleid, siteid); // drpTechnician1.DataTextField = "username"; // drpTechnician1.DataValueField = "userid"; // drpTechnician1.DataSource = colUser; // drpTechnician1.DataBind(); // ListItem item = new ListItem(); // item.Text = "-------------Select-------------"; // item.Value = "0"; // drpTechnician1.Items.Add(item); // drpTechnician1.SelectedValue = "0"; // } //} } }