Пример #1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     var obj = new USER();
     obj.USER_NAME = popTxtUsername.Text;
     obj.PASSWORD = popTxtPassword.Text;
     obj.EMPLOYEE_ID = Convert.ToInt32(dllEmp.SelectedValue);
     obj.ROLE_ID = Convert.ToInt32(dllRole.SelectedValue);
     var cmd = new UserService(obj);
     if (flag.Text.Equals("Add"))
     {
         obj.Action = ActionEnum.Create;
         obj.CREATE_DATE = DateTime.Now;
         obj.CREATE_EMPLOYEE_ID = 0;
         obj.UPDATE_DATE = DateTime.Now;
         obj.UPDATE_EMPLOYEE_ID = 0;
         obj.SYE_DEL = true;
         cmd.Add();
     }
     else
     {
         obj.Action = ActionEnum.Update;
         obj.USER_ID = Convert.ToInt32(ViewState["userId"].ToString());
         obj.UPDATE_DATE = DateTime.Now;
         obj.UPDATE_EMPLOYEE_ID = 0;
         obj.SYE_DEL = true;
         cmd.Edit();
     }
     ViewState["userId"] = null;
     Response.Redirect("SearchUser.aspx");
 }
Пример #2
0
 protected void btnSingon_Click(object sender, EventArgs e)
 {
     var cmd = new UserService();
     USER tmpUser = cmd.SelectInclude(txtUsername.Text, txtPassword.Text);
     if (tmpUser != null)
     {
         var cmdRole = new RoleService();
         tmpUser.ROLE = cmdRole.SelectIncludeEmployee(tmpUser.ROLE.ROLE_ID);
         Session["user"] = tmpUser;
         Response.Redirect("../Page/MainAdmin.aspx");
     }
     else
     {
         this.alert.Visible = true;
     }
 }
Пример #3
0
        private void InitialDataPopup()
        {
            dllEmp.Items.Clear();
            dllRole.Items.Clear();
            var emp = new EmployeeService();
            foreach (var item in emp.GetALL())
            {
                dllEmp.Items.Add(new ListItem(item.EMPLOYEE_NAME + " " + item.EMPLOYEE_SURNAME, item.EMPLOYEE_ID.ToString()));
            }

            var role = new RoleService();
            foreach (var item in role.GetALL())
            {
                dllRole.Items.Add(new ListItem(item.ROLE_NAME, item.ROLE_ID.ToString()));
            }

            if (ViewState["userId"] != null)
            {
                var cmd = new UserService();
                _item = cmd.Select(Convert.ToInt32(ViewState["userId"].ToString()));
                if (_item != null)
                {
                    popTxtUsername.Text = _item.USER_NAME;
                    popTxtPassword.TextMode = TextBoxMode.SingleLine;
                    popTxtPassword.Text = "*************";
                    popTxtPassword.Enabled = false;
                    dllEmp.SelectedValue = _item.EMPLOYEE_ID.ToString();
                    dllRole.SelectedValue = _item.ROLE_ID.ToString();
                    flag.Text = "Edit";
                }
            }
            else
            {
                popTxtPassword.TextMode = TextBoxMode.Password;
                popTxtPassword.Enabled = true;
            }
        }
Пример #4
0
 private void InitialData()
 {
     var cmd = new UserService();
     DataSouce = cmd.GetALLInclude();
     gridUsername.DataSource = DataSouce;
     gridUsername.DataBind();
 }