Example #1
0
        private void btnAccept_Click(object sender, EventArgs e)
        {
            int user_id = Properties.Settings.Default.user_id;

            user = db.users.Where(a => a.id == user_id).FirstOrDefault();
            if (user.type == "user")
            {
                if (dgvMovements.Rows.Count > 0)
                {
                    int id = 0;
                    if (dgvMvtHeader.CurrentRow.Cells[0].Value != null)
                    {
                        id = Convert.ToInt32(dgvMvtHeader.CurrentRow.Cells[0].Value.ToString());
                        movement_header.approved     = 1;
                        movement_header.userApproved = user.id;
                        db.SubmitChanges();
                        MessageBox.Show("تم قبول الطلب بنجاح");
                        btnAccept.Enabled = false;
                    }
                }
            }
            else
            {
                MessageBox.Show("عفوا ! لا يمتلك هذا المستخدم صلاحية قبول الطلبات");
            }
        }
Example #2
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            string userName = txtUser.Text;
            string pass     = txtpass.Text;

            if (userName == "" || pass == "")
            {
                MessageBox.Show("لم يتم إدخال اسم المستخدم او كلمة المرور");
            }
            user = new DAL.user();
            int exest = db.users.Where(i => i.user_name == userName).Where(s => s.pass == pass).Count();

            if (exest > 0)
            {
                //MessageBox.Show("تم تسجيل الدخول");
                user = db.users.Where(i => i.user_name == userName).Where(s => s.pass == pass).FirstOrDefault();
                Properties.Settings.Default.user_id = user.id;
                Properties.Settings.Default.Save();
                this.Hide();
                new Home_form().Show();
            }
            else
            {
                MessageBox.Show("خطاء في اسم المستخدم أو كلمة المرور");
            }
        }
 private void validateUser(string username, string password)
 {
     DAL.user leUser = new DAL.user();
     leUser.firstname = "Guest";
     foreach (DAL.user user in MainWindow.userVM.Users)
     {
         if (user.username.Trim() == username && user.password.Trim() == password)
         {
             leUser = user;
             break;
         }
     }
     if (leUser.firstname != "Guest")
     {
         MainWindow.CurrentUser     = leUser;
         invalidTryLabel.Visibility = Visibility.Hidden;
         showSuccess();
         win.ChangeUser();
         usernameTextBox.Clear();
         passwordBox.Clear();
         win.MainButton_Click(win.mainButton, null);
     }
     else
     {
         invalidTryLabel.Visibility = Visibility.Visible;
     }
 }
Example #4
0
        private void Home_form_Load(object sender, EventArgs e)
        {
            int user_id = Properties.Settings.Default.user_id;

            user = db.users.Where(a => a.id == user_id).FirstOrDefault();
            if (user.type == "user")
            {
                إدارةالأصنافToolStripMenuItem.Enabled = false;
                إدارةالمخازنToolStripMenuItem.Enabled = false;
                واردToolStripMenuItem.Enabled         = false;
                المستخدمونToolStripMenuItem.Enabled   = false;
                التقاريرToolStripMenuItem.Enabled     = false;
                المخازنToolStripMenuItem.Enabled      = false;
            }
            if (user.type == "admin")
            {
                المستخدمونToolStripMenuItem.Enabled = false;
                واردToolStripMenuItem.Enabled       = true;
                المخازنToolStripMenuItem.Enabled    = true;
            }
            if (user.type == "superAdmin")
            {
                واردToolStripMenuItem.Enabled    = true;
                المخازنToolStripMenuItem.Enabled = true;
            }
            if (user.type == "supervisor")
            {
            }
        }
Example #5
0
        private void dgvUsers_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int id = 0;

            if (dgvUsers.CurrentRow.Cells[0].Value != null)
            {
                id   = Convert.ToInt32(dgvUsers.CurrentRow.Cells[0].Value.ToString());
                user = db.users.Where(s => s.id == id).FirstOrDefault();
                btnDelete.Enabled = true;
                GetData();
            }
        }
Example #6
0
 public static usersDTO ToDtousers(DAL.user t)
 {
     return(new usersDTO()
     {
         userId = t.userId,
         firstName = t.firstName,
         lastName = t.lastName,
         nameLogin = t.nameLogin,
         password = t.password,
         mail = t.mail,
         phone = t.phone
     });
 }
Example #7
0
        private DataTable FilterFactorByCityCountry(DataTable sor, string City, string Country)
        {
            //filter by city and country
            DataTable dtUser = new DAL.user().Select_All(new Common.userDatum());
            DataTable res    = new DataTable();

            foreach (DataColumn dc in sor.Columns)
            {
                res.Columns.Add(dc.ColumnName, dc.DataType);
            }



            foreach (DataRow dr in sor.Rows)
            {
                if (City == "" && Country == "")
                {
                    res.Rows.Add(dr.ItemArray);
                    continue;
                }

                //check city
                if (City != "")
                {
                    foreach (DataRow dru in dtUser.Rows)
                    {
                        if (dr["id_user"].ToString() == dru["id"].ToString() && dru["city"].ToString() == City)
                        {
                            res.Rows.Add(dr.ItemArray);
                        }
                    }
                }
                //check country
                if (Country != "")
                {
                    foreach (DataRow dru in dtUser.Rows)
                    {
                        if (dr["id_user"].ToString() == dru["id"].ToString() && dru["country"].ToString() == Country)
                        {
                            res.Rows.Add(dr.ItemArray);
                        }
                    }
                }
            }

            return(res);
        }
Example #8
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int id = 0;

            if (dgvUsers.CurrentRow.Cells[0].Value != null)
            {
                id   = Convert.ToInt32(dgvUsers.CurrentRow.Cells[0].Value.ToString());
                user = db.users.Where(s => s.id == id).FirstOrDefault();
                DialogResult dialog = MessageBox.Show("هل تريد بالفعل حذف هذا المستخدم", "تحذير", MessageBoxButtons.YesNo);
                if (dialog == DialogResult.Yes)
                {
                    db.users.DeleteOnSubmit(user);
                    db.SubmitChanges();
                    db = new DAL.dbDataContext();
                    dgvUsers.DataSource                 = db.users;
                    dgvUsers.Columns["id"].Visible      = false;
                    dgvUsers.Columns["name"].HeaderText = "الاسم";
                    New();
                    btnDelete.Enabled = false;
                }
            }
        }
Example #9
0
 void New()
 {
     user = new DAL.user();
     GetData();
 }
Example #10
0
 public SqlDataReader checkById(Model.user aa)
 {
     DAL.user ds = new DAL.user();
     return(ds.checkById(aa));
 }
Example #11
0
 public SqlDataReader checkPwd(Model.user aa)
 {
     DAL.user dals = new DAL.user();
     return(dals.checkPwd(aa));
 }
Example #12
0
 public int loginLastTime(Model.user aa)
 {
     DAL.user dalu = new DAL.user();
     return(dalu.loginLastTime(aa));
 }
Example #13
0
 public SqlDataReader drp(Model.user aa)
 {
     DAL.user dals = new DAL.user();
     return(dals.drpw(aa));
 }
Example #14
0
 public SqlDataReader lo(Model.user aa)
 {
     DAL.user da = new DAL.user();
     return(da.lo(aa));
 }
Example #15
0
 ///////////////////////
 public static DTO.User Convert(DAL.user dal)
 {
     return(_mapper.Map <DTO.User>(dal));
 }
Example #16
0
 public SqlDataReader drti(Model.user aa)
 {
     DAL.user ds = new DAL.user();
     return(ds.drti(aa));
 }
Example #17
0
 public SqlDataReader pp(Model.user aa)
 {
     DAL.user dal = new DAL.user();
     return(dal.dd(aa));
 }
Example #18
0
 public DataSet  checkEmail(Model.user aa)
 {
     DAL.user daluss = new DAL.user();
     return(daluss.checkEmail(aa));
 }
Example #19
0
 public int insert(Model.user aa)
 {
     DAL.user dalu = new DAL.user();
     return(dalu.insert(aa));
 }
Example #20
0
 public int update(Model.user aa)
 {
     DAL.user dalu = new DAL.user();
     return(dalu.update(aa));
 }
Example #21
0
 public SqlDataReader findByMail(Model.user aa)
 {
     DAL.user da = new DAL.user();
     return(da.findByMail(aa));
 }
Example #22
0
 public SqlDataReader drs(Model.user aa)
 {
     DAL.user dsd = new DAL.user();
     return(dsd.drs(aa));
 }
Example #23
0
 public SqlDataReader  login(Model.user aa)
 {
     DAL.user dalus = new DAL.user();
     return(dalus.userLogin(aa));
 }
Example #24
0
 public int upus(Model.user aa)
 {
     DAL.user ds = new DAL.user();
     return(ds.upUser(aa));
 }
Example #25
0
 public int upPwd(Model.user aa)
 {
     DAL.user dalll = new DAL.user();
     return(dalll.upPwd(aa));
 }
Example #26
0
 public user()
 {
     dal = new DAL.user("fg_");
 }
Example #27
0
 public DataSet  pan(Model.user aa)
 {
     DAL.user daluss = new DAL.user();
     return(daluss.pan(aa));
 }