コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var role = (string)Session["role"];

            if (Session["username"] == null || role != "Admin")
            {
//                Session["username"]= null;
//                Session["role"]= null;
                Response.Redirect("Login.aspx");
            }

            if (!IsPostBack)
            {
                var sections = _sectionManager.GetAllSections();
                departmentDropDownBox.DataSource = sections;
                departmentDropDownBox.DataBind();
                departmentDropDownBox.DataValueField = "Id";
                departmentDropDownBox.DataTextField  = "SectionName";
                //var username = Session["username"] as string;
                //ICollection<Employee> emp = _employeeUserManager.GetEmployeeByUserName(username);
                //employeeDropDownBox.DataSource = emp;
                //employeeDropDownBox.DataBind();
                //employeeDropDownBox.DataTextField = "Email";
                //employeeDropDownBox.DataValueField = "Id";
                dateTextBox.Text   = DateTime.Today.ToString("dd/MM/yyyy");
                inTimeTextBox.Text = string.Format("{0:HH:mm:ss tt}", DateTime.Now);
            }
        }
コード例 #2
0
 public StudentUserControl()
 {
     InitializeComponent();
     try
     {
         departmentComboBox.DataSource = _departmentManager.GetAllDepartments();
         sectionComboBox.DataSource    = _sectionManager.GetAllSections();
         showDataGridView.DataSource   = _studentManager.GetAllStudents();
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var role = (string)Session["role"];

            if (Session["username"] == null || role != "Admin")
            {
                Response.Redirect("Login.aspx");
            }

            if (!IsPostBack)
            {
                ListItem listItem = new ListItem("---------Select One---------", "-1");
                sectionDropdownList.DataSource = _sectionManager.GetAllSections();
                sectionDropdownList.DataBind();
                employeeIdDropdownList.Items.Insert(0, listItem);
                sectionDropdownList.Items.Insert(0, listItem);
                salaryCalculator.CssClass = "hide";
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var role = (string)Session["role"];

            if (Session["username"] == null || role != "Admin")
            {
                Response.Redirect("Login.aspx");
            }

            if (string.IsNullOrEmpty(Request.QueryString["Id"]))
            {
                Response.Redirect("EmployeeEntry.aspx?Id=" + 0);
            }

            if (!IsPostBack)
            {
                ListItem listItem = new ListItem("---------Select One---------", "-1");
                roleDropDownBox.DataSource = _roleManager.GetAllRoles().ToList();
                roleDropDownBox.DataBind();

                sectionDropDownBox.DataSource = _sectionManager.GetAllSections();
                sectionDropDownBox.DataBind();

                designationDropDownBox.DataSource = _designationManager.GetAllDesignations();
                designationDropDownBox.DataBind();

                branchDropDownBox.DataSource = _branchManager.GetAllBranch();
                branchDropDownBox.DataBind();

                roleDropDownBox.Items.Insert(0, listItem);
                sectionDropDownBox.Items.Insert(0, listItem);
                designationDropDownBox.Items.Insert(0, listItem);
                branchDropDownBox.Items.Insert(0, listItem);

                int id = int.Parse(Request.QueryString["Id"].ToString());
                if (id > 0)
                {
                    passwordTextBox.Visible        = false;
                    confirmPasswordTextBox.Visible = false;
                    emailTextBox.Visible           = false;
                    passwordLabel.Visible          = false;
                    confirmPasswordLabel.Visible   = false;
                    emailLabel.Visible             = false;


                    Employee employee = _employeeUserManager.GetEmployeeById(id);
                    employeeIdHiddenField.Value = employee.Id.ToString();
                    fullNameTextBox.Text        = employee.FullName;
                    firstNameTextBox.Text       = employee.FirstName;
                    lastNameTextBox.Text        = employee.LastName;
                    roleDropDownBox.DataSource  = _roleManager.GetAllRoles().ToList();
                    roleDropDownBox.DataBind();
                    roleDropDownBox.Items.FindByValue(employee.RoleId.ToString()).Selected = true;
                    mobileTextBox.Text = employee.MobileNo;
                    sectionDropDownBox.Items.FindByValue(employee.SectionId.ToString()).Selected         = true;
                    designationDropDownBox.Items.FindByValue(employee.DesignationId.ToString()).Selected = true;
                    salaryTextBox.Text = employee.BasicSalary.ToString();
                    if (employee.Gander == "Male")
                    {
                        maleRadioButton.Checked = true;
                    }
                    else
                    {
                        femaleRadioButton.Checked = true;
                    }
                    dateOfBirthTextBox.Text = employee.DateOfBirth.ToString();
                    joinDateTextBox.Text    = employee.JoinDate.ToString();
                    branchDropDownBox.Items.FindByValue(employee.BranchId.ToString()).Selected = true;
                    addressTextBox.Text = employee.Address;
                }
            }
        }