Example #1
0
        protected void btnKaydet_Click(object sender, EventArgs e)
        {
            bllAuthentication userAuthentication = new bllAuthentication();
            List <UserTable>  userList           = userAuthentication.GetAllUsers();

            UserTable usr = new UserTable()
            {
                DepartmentId = int.Parse(ddlstDep.SelectedValue),
                Name         = txtName.Text,
                Surname      = txtSurname.Text,
                Username     = txtUsername.Text,
                Password     = txtPass.Text,
                Email        = txtEmail.Text,
                PhoneNumber  = txtPhoneNum.Text,
                Comment      = txtComment.Text,
                RoleID       = int.Parse(ddlstRole.SelectedValue)
            };

            if (!userAuthentication.UNameContains(usr))
            {
                bool flag = userAuthentication.Insert(usr);
                if (flag)
                {
                    Response.Redirect("users.aspx");
                }
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"Bu kullanıcı adı kullanımda.Lütfen tekrar deneyiniz\");", true);
                txtUsername.Text = "";
            }
        }
Example #2
0
        private void fillGrid()
        {
            List <UserTable> userList = new bllAuthentication().GetAllUsers();

            lstUsers.DataSource = userList;
            lstUsers.DataBind();
        }
Example #3
0
        protected void LoginButton_Click(object sender, EventArgs e)
        {
            bllAuthentication auth = new bllAuthentication();
            UserTable         user = auth.Authenticate(txtUserName.Value, txtPassword.Value);

            if (user != null)
            {
                Session.Add("User", user);
                Response.Redirect("~/index.aspx");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"Kullanıcı Adı veya şifre yanlış.Tekrar deneyiniz\");", true);
            }
        }
Example #4
0
        protected void btnFilter_Click(object sender, EventArgs e)
        {
            List <UserTable> lst = new bllAuthentication().GetAllUsers();

            lst = lst.Where(x => ((txtUserName == null && txtUserName.Text == "") || (x.Username.IndexOf(txtUserName.Text, 0, StringComparison.CurrentCultureIgnoreCase) > -1)) &&
                            ((txtName == null && txtName.Text == "") || (x.Name.IndexOf(txtName.Text, 0, StringComparison.CurrentCultureIgnoreCase) > -1)) &&
                            ((txtSurname == null && txtSurname.Text == "") || (x.Surname.IndexOf(txtSurname.Text, 0, StringComparison.CurrentCultureIgnoreCase) > -1)) &&
                            ((txtDepartment == null && txtDepartment.Text == "") || (x.Department.IndexOf(txtDepartment.Text, 0, StringComparison.CurrentCultureIgnoreCase) > -1)) &&
                            ((txtEmail == null && txtEmail.Text == "") || (x.Email.IndexOf(txtEmail.Text, 0, StringComparison.CurrentCultureIgnoreCase) > -1)) &&
                            ((txtPhoneNum == null && txtPhoneNum.Text == "") || (x.PhoneNumber.IndexOf(txtPhoneNum.Text, 0, StringComparison.CurrentCultureIgnoreCase) > -1)) &&
                            ((txtComment == null && txtComment.Text == "") || (x.Comment.IndexOf(txtComment.Text, 0, StringComparison.CurrentCultureIgnoreCase) > -1))
                            ).ToList();
            lstUsersView.DataSource = lst;
            lstUsersView.DataBind();
        }