Пример #1
0
        private void dgvItems_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvItems.DataSource != null && dgvItems.RowCount > 0)
            {
                int    rowIndex       = dgvItems.CurrentCell.RowIndex;
                String depreciationId = dgvItems.Rows[rowIndex].Cells[1].Value.ToString();
                String dateProcured   = dgvItems.Rows[rowIndex].Cells[6].Value.ToString();
                String cost           = dgvItems.Rows[rowIndex].Cells[9].Value.ToString();


                if (depreciationId != "")
                {
                    frmDepreciation depreciation = new frmDepreciation();
                    depreciation.isLoad         = true;
                    depreciation.Cost           = double.Parse(cost);
                    depreciation.DateProcured   = dateProcured;
                    depreciation.depreciationId = depreciationId;
                    depreciation.ShowDialog();
                }
                else
                {
                    MessageBox.Show(null, "No depreciation assigned to this item.", "Depreciation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Пример #2
0
        private void btnDepreciation_Click(object sender, EventArgs e)
        {
            txtCost.Text = Format.formatToPeso(cost);

            if (txtCost.Text == "0.00" || txtCost.Text == '\u20B1' + "0.00")
            {
                MessageBox.Show(null, "Enter the cost of the item first.", "Depreciation item", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtCost.Focus();
                txtCost.Select();
            }
            else
            {
                frmDepreciation depreciation = new frmDepreciation();
                depreciation.DateProcured = dtpProcured.Value.ToString("MM/dd/yyyy");
                depreciation.Cost         = Format.formatToDecimal(txtCost.Text);
                depreciation.editItem     = this;
                if (depreciationId == "")
                {
                    depreciation.isAdd = true;
                }
                else
                {
                    depreciation.isEdit         = true;
                    depreciation.depreciationId = depreciationId;
                    depreciation.isLoad         = true;
                }
                depreciation.ShowDialog();
            }
        }