protected void Page_Load(object sender, EventArgs e)
    {
        Employee emp = Employee.LoginUser();

        //if (emp.RoleID != 1 && emp.RoleID != 2)
        //{
        //    Response.Redirect("~/" + ConfigurationManager.AppSettings["NoPermissions"]);
        //}
        if (!Page.IsPostBack)
        {
            BusinessLogic     bl             = new BusinessLogic();
            List <Department> departmentList = bl.GetDepartmentData();
            DepatmentDropDownList.AppendDataBoundItems = true;
            DepatmentDropDownList.DataSource           = departmentList;
            DepatmentDropDownList.DataTextField        = "DepartmentName";
            DepatmentDropDownList.DataValueField       = "DepartmentID";
            DepatmentDropDownList.DataBind();

            List <Role> roleList = bl.GetRoleData();
            RoleDropDownList.AppendDataBoundItems = true;
            RoleDropDownList.DataSource           = roleList;
            RoleDropDownList.DataTextField        = "RoleName";
            RoleDropDownList.DataValueField       = "RoleID";
            RoleDropDownList.DataBind();
        }
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HtmlForm mainform = this.Form;

        if (mainform != null)
        {
            mainform.DefaultButton = SavePermissionsButton.UniqueID;
        }
        if (!IsPostBack)
        {
            RoleDropDownList.DataBind();
        }
    }
Beispiel #3
0
 protected void InitializeControls()
 {
     try
     {
         RoleDropDownList.DataSource = theUsersAndRolesBLL.GetAllRolesAndNone();
         RoleDropDownList.DataBind();
         BindData();
     }
     catch (Exception exc)
     {
         log.Error("InitializeControls Error. Function InitializeControls from AssignRoles page", exc);
         SystemMessages.DisplaySystemMessage(Resources.SecurityData.MessageErrorGetRoles);
     }
 }
 public void DropDownBinding()
 {
     using (SqlConnection connection = new SqlConnection(con))
     {
         SqlCommand cmd = new SqlCommand("DisplayRole", connection);
         cmd.CommandType = CommandType.StoredProcedure;
         connection.Open();
         RoleDropDownList.DataSource     = cmd.ExecuteReader();
         RoleDropDownList.DataTextField  = "RName";
         RoleDropDownList.DataValueField = "RId";
         RoleDropDownList.DataBind();
         ListItem list = new ListItem("--select--", "");
         RoleDropDownList.Items.Insert(0, list);
     }
 }
Beispiel #5
0
 protected void DeleteRolImageButton_Click(object sender, EventArgs e)
 {
     try
     {
         log.Debug("Deleting a Role");
         string rol = RoleDropDownList.Text;
         Roles.DeleteRole(rol);
         RoleDropDownList.DataSource = theUsersAndRolesBLL.GetAllRolesAndNone();
         RoleDropDownList.DataBind();
         SystemMessages.DisplaySystemMessage(string.Format(Resources.SecurityData.MessageDeletedRole, rol));
     }
     catch (Exception exc)
     {
         log.Error("Cannot delete the Role : " + RoleDropDownList.Text + " because users exist in it. Function DeleteRolImageButton_Click from AssignRoles page", exc);
         SystemMessages.DisplaySystemMessage(string.Format(Resources.SecurityData.MessageErrorDeletedRole, RoleDropDownList.Text));
     }
 }
 protected void CancelButton_Click(object sender, EventArgs e)
 {
     FirstNameTextBox.Text     = " ";
     LastNameTextBox.Text      = " ";
     AddressTextBox.Text       = " ";
     ContactNumberTextBox.Text = " ";
     EmailTextBox.Text         = " ";
     MaleRadioButton.Checked   = false;
     FemaleRadioButton.Checked = false;
     OtherRadioButton.Checked  = false;
     // PasswordTextBox.Text = " ";
     //ConformPasswordTextBox.Text = " ";
     DateOfBirthTextBox.Text   = " ";
     DateOfJoiningTextBox.Text = " ";
     IdProofDropDwomList.ClearSelection();
     IdProofNumberTextBox.Text = " ";
     RoleDropDownList.ClearSelection();
 }
Beispiel #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Util.Validations.RegisterZipScriptBlock(Page.ClientScript, this.GetType(),
                                                CountryDropDownList.ClientID);

        if (!Page.IsPostBack)
        {
            // Get the common web service instance.

            ServiceAccess serviceLoader = ServiceAccess.GetInstance();
            CommonService.CommonService commonService = serviceLoader.GetCommon();

            // Get the list of contries and populate.
            IList <CommonService.CountryInfo> countries = commonService.GetCountries();

            CountryDropDownList.DataSource     = countries;
            CountryDropDownList.DataValueField = "CountryId";
            CountryDropDownList.DataTextField  = "Name";
            CountryDropDownList.DataBind();

            CountryDropDownList.Items.FindByText("United States").Selected = true;
            CountryDropDownList_SelectedIndexChanged(CountryDropDownList, new EventArgs());

            RoleDropDownList.Items.Add(new ListItem(RegistrationService.UserRole.Agent.ToString(), Convert.ToInt32(RegistrationService.UserRole.Agent).ToString()));
            RoleDropDownList.Items.Add(new ListItem(RegistrationService.UserRole.Printer.ToString(), Convert.ToInt32(RegistrationService.UserRole.Printer).ToString()));
            RoleDropDownList.Items.Add(new ListItem(RegistrationService.UserRole.CSR.ToString(), Convert.ToInt32(RegistrationService.UserRole.CSR).ToString()));
            RoleDropDownList.Items.Add(new ListItem(RegistrationService.UserRole.Admin.ToString(), Convert.ToInt32(RegistrationService.UserRole.Admin).ToString()));
            RoleDropDownList.DataBind();

            if (Request.QueryString["UserId"] != "")
            {
                InitializeValuesFromSession();
            }
            else
            {
                Response.Redirect("SearchUsers.aspx");
            }
        }
    }