Esempio n. 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            if (txtPassword.Text != "")
            {
                User validUser = _db.ValidateUser(txtLogin.Text, txtPassword.Text);
                if (validUser != null)
                {
                    //frmSearch _frmSearch = new frmSearch();
                    //_frmSearch.SearchType = 2;
                    //_frmSearch.UserId = validUser.id;
                    //Properties.Settings.Default.UserId = validUser.id;
                    //_frmSearch.ShowDialog();
                    int UserSelecteddatabaseId = 1;

                    Properties.Settings.Default.UserId = validUser.id;

                    frmCustomerService _frmCustomerService = new frmCustomerService();
                    _frmCustomerService.isAdmin    = (bool)validUser.isAdmin;
                    _frmCustomerService.DatabaseId = UserSelecteddatabaseId;
                    _frmCustomerService.ShowDialog();
                    Cursor.Current = Cursors.Default;
                    Properties.Settings.Default.UserName = validUser.FullName.Trim();
                    this.Close();
                }
                else
                {
                    MessageBox.Show(this, "Invalid Login", "Sorry the login information was incorrect, Please try again.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Esempio n. 2
0
        private void dgview_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewTextBoxColumn &&
                e.RowIndex >= 0)
            {
                var id = Convert.ToInt64(senderGrid.Rows[e.RowIndex].Cells[0].Value);
                if (id > 0)
                {
                    var frm = new frmCustomerService();
                    frm.Mode = Models.EntryMode.Edit;
                    frm.CustomerServiceId = id;
                    frm.ShowDialog();
                    onSearchClick();
                }
            }
        }