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("عفوا ! لا يمتلك هذا المستخدم صلاحية قبول الطلبات"); } }
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; } }
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") { } }
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(); } }
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 }); }
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); }
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; } } }
void New() { user = new DAL.user(); GetData(); }
public SqlDataReader checkById(Model.user aa) { DAL.user ds = new DAL.user(); return(ds.checkById(aa)); }
public SqlDataReader checkPwd(Model.user aa) { DAL.user dals = new DAL.user(); return(dals.checkPwd(aa)); }
public int loginLastTime(Model.user aa) { DAL.user dalu = new DAL.user(); return(dalu.loginLastTime(aa)); }
public SqlDataReader drp(Model.user aa) { DAL.user dals = new DAL.user(); return(dals.drpw(aa)); }
public SqlDataReader lo(Model.user aa) { DAL.user da = new DAL.user(); return(da.lo(aa)); }
/////////////////////// public static DTO.User Convert(DAL.user dal) { return(_mapper.Map <DTO.User>(dal)); }
public SqlDataReader drti(Model.user aa) { DAL.user ds = new DAL.user(); return(ds.drti(aa)); }
public SqlDataReader pp(Model.user aa) { DAL.user dal = new DAL.user(); return(dal.dd(aa)); }
public DataSet checkEmail(Model.user aa) { DAL.user daluss = new DAL.user(); return(daluss.checkEmail(aa)); }
public int insert(Model.user aa) { DAL.user dalu = new DAL.user(); return(dalu.insert(aa)); }
public int update(Model.user aa) { DAL.user dalu = new DAL.user(); return(dalu.update(aa)); }
public SqlDataReader findByMail(Model.user aa) { DAL.user da = new DAL.user(); return(da.findByMail(aa)); }
public SqlDataReader drs(Model.user aa) { DAL.user dsd = new DAL.user(); return(dsd.drs(aa)); }
public SqlDataReader login(Model.user aa) { DAL.user dalus = new DAL.user(); return(dalus.userLogin(aa)); }
public int upus(Model.user aa) { DAL.user ds = new DAL.user(); return(ds.upUser(aa)); }
public int upPwd(Model.user aa) { DAL.user dalll = new DAL.user(); return(dalll.upPwd(aa)); }
public user() { dal = new DAL.user("fg_"); }
public DataSet pan(Model.user aa) { DAL.user daluss = new DAL.user(); return(daluss.pan(aa)); }