private void btnAdd_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(tbxName.Text)) { this.DialogResult = System.Windows.Forms.DialogResult.OK; DataSetTposTableAdapters.userTableAdapter daUser = new DataSetTposTableAdapters.userTableAdapter(); if (isAdd) { DataSetTpos.userRow uRowN = DBclass.DS.user.NewuserRow(); uRowN.username = tbxName.Text; uRowN.password = CalculateMD5Hash(CalculateMD5Hash(tbxPass.Text)); uRowN.role = cbxRole.SelectedItem.ToString(); DBclass.DS.user.AdduserRow(uRowN); daUser.Update(uRowN); daUser.Fill(DBclass.DS.user); } else { uRow.username = tbxName.Text; uRow.role = cbxRole.SelectedItem.ToString(); daUser.Update(uRow); } } }
public DateSelectForm(bool isTwoParam, bool isuser) { InitializeComponent(); isUser = isuser; if (!isTwoParam) { isTwoParams = isTwoParam; dpEndDate.Visible = false; label2.Visible = false; if (isUser) { lblKassir.Visible = true; cbxCashier.Visible = true; DataSetTposTableAdapters.userTableAdapter uda = new DataSetTposTableAdapters.userTableAdapter(); uda.Fill(DBclass.DS.user); cbxCashier.DataSource = DBclass.DS.user; cbxCashier.DisplayMember = "username"; cbxCashier.ValueMember = "IDUser"; cbxCashier.SelectedValue = (int)DBclass.DS.user.Rows[0]["IDUser"]; } } }