Exemplo n.º 1
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;
     }
 }
Exemplo n.º 2
0
        private void InitialDataPopup()
        {
            if (ViewState["RoleId"] != null)
            {
                var cmd = new RoleService();
                _item = cmd.Select(Convert.ToInt32(ViewState["RoleId"].ToString()));
                if (_item != null)
                {
                    popTxtRoleCode.Text = _item.ROLE_CODE;
                    popTxtRoleName.Text = _item.ROLE_NAME;
                    flag.Text = "Edit";
                }

                var cmdFunc = new RoleFunctionService();
                DataSouceRoleFunction = cmdFunc.GetALLIncludeFunction(_item.ROLE_ID);
            }
            else
            {
                DataSouceRoleFunction = new List<ROLE_FUNCTION>();
            }
            DataSouceRoleFunction.AddRange(DataSouceNewRoleFunction);

            gridFunction.DataSource = DataSouceRoleFunction;
            gridFunction.DataBind();
        }
Exemplo n.º 3
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     var obj = new ROLE();
     obj.ROLE_CODE = popTxtRoleCode.Text;
     obj.ROLE_NAME = popTxtRoleName.Text;
     var cmd = new RoleService(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.ROLE_ID = Convert.ToInt32(ViewState["RoleId"].ToString());
         obj.UPDATE_DATE = DateTime.Now;
         obj.UPDATE_EMPLOYEE_ID = 0;
         obj.SYE_DEL = true;
         cmd.Edit();
     }
     if (DataSouceNewRoleFunction.Count > 0)
     {
         foreach (ROLE_FUNCTION item in DataSouceNewRoleFunction)
         {
             item.ROLE_ID = obj.ROLE_ID;
         }
         var cmdRoleFunction = new RoleFunctionService(DataSouceNewRoleFunction);
         cmdRoleFunction.AddList();
     }
     ViewState["RoleId"] = null;
     Response.Redirect("SearchRole.aspx");
 }
Exemplo n.º 4
0
 private void InitialData()
 {
     var cmd = new RoleService();
     DataSouce = cmd.GetALL();
     gridRole.DataSource = DataSouce;
     gridRole.DataBind();
     DataSouceNewRoleFunction = new List<ROLE_FUNCTION>();
 }
Exemplo n.º 5
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;
            }
        }