Example #1
0
        private void dgvExpenses_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvExpenses.SelectedRows != null && dgvExpenses.SelectedRows.Count == 1)
            {
                clsExpenses exp = new clsExpenses();
                exp.Expense_id  = Convert.ToInt32(dgvExpenses.SelectedRows[0].Cells[0].Value);
                exp.UserId      = m_user.UserId;
                exp.UserName    = m_user.UserName;
                exp.Amount      = Convert.ToDouble(dgvExpenses.SelectedRows[0].Cells[3].Value);
                exp.Description = dgvExpenses.SelectedRows[0].Cells[2].Value.ToString();
                exp.Timestamp   = Convert.ToDateTime(dgvExpenses.SelectedRows[0].Cells[1].Value.ToString());


                frmInput InputExpense = new frmInput();
                InputExpense.Title         = "Expense Description";
                InputExpense.Caption       = "Description";
                InputExpense.IsNumericOnly = false;
                InputExpense.Value         = exp.Description;
                if (InputExpense.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (InputExpense.Value != "")
                    {
                        exp.Description = InputExpense.Value;

                        InputExpense.Title         = "Expense Amount";
                        InputExpense.Caption       = "Amount";
                        InputExpense.IsNumericOnly = true;
                        InputExpense.Value         = exp.Amount.ToString();
                        if (InputExpense.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            if (InputExpense.Value != "")
                            {
                                exp.Amount = Convert.ToDouble(InputExpense.Value);
                                exp.Save();
                                btnSearch.PerformClick();
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        private void btnAddExpenses_Click(object sender, EventArgs e)
        {
            if (clsUtil.GetApproval(m_user, UserAccess.Cashier))
            {
                clsExpenses exp = new clsExpenses();
                exp.UserId      = m_user.UserId;
                exp.UserName    = m_user.UserName;
                exp.Amount      = 0;
                exp.Description = "";
                exp.Timestamp   = DateTime.Now;


                frmInput InputExpense = new frmInput();
                InputExpense.Title         = "Expense Description";
                InputExpense.Caption       = "Description";
                InputExpense.IsNumericOnly = false;
                InputExpense.Value         = "";
                if (InputExpense.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (InputExpense.Value != "")
                    {
                        exp.Description = InputExpense.Value;

                        InputExpense.Title         = "Expense Amount";
                        InputExpense.Caption       = "Amount";
                        InputExpense.IsNumericOnly = true;
                        InputExpense.Value         = "0";
                        if (InputExpense.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            if (InputExpense.Value != "")
                            {
                                exp.Amount = Convert.ToDouble(InputExpense.Value);
                                exp.Save();
                            }
                        }
                    }
                }
            }
        }