コード例 #1
0
ファイル: PasswordUI.cs プロジェクト: gamdolist/qwine
        /// <summary>
        /// Authenticates the user.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <returns></returns>
        public bool AuthenticateUser(IWin32Window parent)
        {
            DialogResult dlg;
            using (var f = new LogonPresentation())
            {
                dlg = f.ShowDialog(parent);
                f.SetUser(_user.UserId);
            }

            return (dlg.Equals(DialogResult.OK));
        }
コード例 #2
0
ファイル: LoketUI.cs プロジェクト: gamdolist/qwine
        /// <summary>
        /// Handles the Click event of the btnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                var r = new Loket
                            {
                                LoketID = txtID.Text.Trim(),
                                LoketDescription = txtDescription.Text.Trim()
                            };

                // --- Confirm
                if (Confirm("Do you want to save this data?") != DialogResult.Yes) return;

                DialogResult dlg;
                using (var f = new LogonPresentation())
                {
                    dlg = f.ShowDialog(this);
                }

                if (dlg == DialogResult.OK)
                {
                    IDataAccess<Loket> db = new LoketBase();
                    if (db.Update(r) == 1) ResetData();
                }
            }
            catch (ArgumentNullException ex)
            {
                MessageBox.Show(ex.Message, @"Warning!",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, @"Warning!",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
コード例 #3
0
ファイル: CompanyUI.cs プロジェクト: gamdolist/qwine
        /// <summary>
        /// Handles the Click event of the btnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            Company obj;
            try
            {
                obj =
                    new Company
                        {
                            CompanyName = txtCompanyName.Text.Trim(),
                            Address = txtCompanyAddress.Text.Trim(),
                            City = txtCompanyCity.Text.Trim(),
                            Phone = txtCompanyPhone.Text.Trim(),
                            Fax = txtCompanyFax.Text.Trim(),
                            Email = txtCompanyEmail.Text.Trim(),
                            Url = txtCompanyUrl.Text.Trim()
                        };
            }
            catch (ArgumentNullException ex)
            {
                MessageBox.Show(ex.Message,
                                @"Warning!",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }

            if ((Confirm("Are you sure to update your company profile?") == DialogResult.Yes))
            {
                DialogResult dlg;
                using (var f = new LogonPresentation())
                {
                    dlg = f.ShowDialog(this);
                }

                if (dlg == DialogResult.OK)
                {
                    // --- TRUNCATE
                    var companyDao = new CompanyBase();
                    companyDao.Truncate();

                    // --- SAVE
                    if (companyDao.Save(obj) == 1)
                    {
                        Close();
                        Dispose();
                    }
                }
            }
        }
コード例 #4
0
ファイル: KeymapUI.cs プロジェクト: gamdolist/qwine
        /// <summary>
        /// Handles the Click event of the btnDelete control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            // --- If Not EditMode
            if (_saveMode != SaveMode.EditMode) return;

            try
            {
                var r = new Keymap
                            {
                                Keyboard = txtID.Text.Trim(),
                                Action = cboAction.SelectedIndex,
                                LoketID = cboLoket.Text.Trim()
                            };

                IDataAccess<Keymap> db = new KeymapBase();

                if (Confirm("Are you sure to delete this data?") == DialogResult.Yes)
                {
                    DialogResult dlg;
                    using (var f = new LogonPresentation())
                    {
                        dlg = f.ShowDialog(this);
                    }

                    if (dlg == DialogResult.OK)
                    {
                        if ((db.Delete(r) == 1)) ResetData();
                    }
                }
            }
            catch (ArgumentNullException ex)
            {
                MessageBox.Show(ex.Message, @"Warning!",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, @"Warning!",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
コード例 #5
0
ファイル: KeymapUI.cs プロジェクト: gamdolist/qwine
        /// <summary>
        /// Handles the Click event of the btnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                var r = new Keymap
                            {
                                Keyboard = txtID.Text.Trim(),
                                Action = cboAction.SelectedIndex,
                                LoketID = cboLoket.Text.Trim()
                            };

                // --- Confirm
                if (Confirm("Do you want to save this data?") != DialogResult.Yes) return;

                DialogResult dlg;

                using (var f = new LogonPresentation())
                {
                    dlg = f.ShowDialog(this);
                }

                if (dlg == DialogResult.OK)
                {
                    var db = new KeymapBase();

                    if ((_saveMode == SaveMode.AddMode
                             ? db.Save(r) // Save New
                             : db.Update(r)) == 1) // Update
                        ResetData();

                    db.Dispose();

                }
            }
            catch (ArgumentNullException ex)
            {
                MessageBox.Show(ex.Message, @"Warning!",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, @"Warning!",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
コード例 #6
0
ファイル: WorkflowUI.cs プロジェクト: gamdolist/qwine
        /// <summary>
        /// Handles the Click event of the btnDelete control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            // --- If Not EditMode
            if (_saveMode != SaveMode.EditMode) return;

            try
            {
                var r = new Workflow
                            {
                                WorkflowId = txtID.Text.Trim()
                            };

                var db = new WorkflowBase();

                if (Confirm("Are you sure to delete this data?") == DialogResult.Yes)
                {
                    DialogResult dlg;

                    using (var f = new LogonPresentation())
                    {
                        dlg = f.ShowDialog(this);
                    }

                    if (dlg == DialogResult.OK)
                    {
                        if ((db.Delete(r) == 1)) ResetData();
                    }
                }

                db.Dispose();

            }
            catch (ArgumentNullException ex)
            {
                MessageBox.Show(ex.Message, @"Warning!",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, @"Warning!",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
コード例 #7
0
ファイル: MainUI.cs プロジェクト: gamdolist/qwine
        /// <summary>
        /// Authenticates the user.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <returns></returns>
        public bool AuthenticateUser(IWin32Window parent)
        {
            DialogResult dlg;
            using (var f = new LogonPresentation())
            {
                dlg = f.ShowDialog(parent);
                _user = f.User;
            }

            if (dlg == DialogResult.OK)
                lblUser.Text = _user.UserId;

            return (dlg.Equals(DialogResult.OK));
        }