Пример #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            using (var page = new GetDataDocumentPage())
            {
                ClearCash();
                page.ShowDialog();

                if (!string.IsNullOrEmpty(UtilityClass.AccCode))
                {
                    dgv.Rows.Add();

                    dgv.Rows[dgv.RowCount - 1].Cells["clnBed"].Value         = UtilityClass.Bed;
                    dgv.Rows[dgv.RowCount - 1].Cells["clnBes"].Value         = UtilityClass.Bes;
                    dgv.Rows[dgv.RowCount - 1].Cells["clnIdCurrency"].Value  = UtilityClass.CurrencyCode;
                    dgv.Rows[dgv.RowCount - 1].Cells["clnCurrency"].Value    = UtilityClass.Currency;
                    dgv.Rows[dgv.RowCount - 1].Cells["clnRate"].Value        = UtilityClass.RatePrice;
                    dgv.Rows[dgv.RowCount - 1].Cells["clnBedTMN"].Value      = UtilityClass.BedTMN;
                    dgv.Rows[dgv.RowCount - 1].Cells["clnBesTMN"].Value      = UtilityClass.BesTMN;
                    dgv.Rows[dgv.RowCount - 1].Cells["clnAccountSide"].Value = UtilityClass.AccName;
                    dgv.Rows[dgv.RowCount - 1].Cells["clnCode"].Value        = UtilityClass.AccCode;
                    ClearCash();
                }

                GetSumRecords();
            }
        }
Пример #2
0
        private void dgv_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.ColumnIndex == 12)
            {
                using (var page = new GetDataDocumentPage())
                {
                    if (dgv.CurrentRow != null)
                    {
                        UtilityClass.AccCode      = dgv.CurrentRow.Cells["clnCode"].Value.ToString();
                        UtilityClass.AccName      = dgv.CurrentRow.Cells["clnAccountSide"].Value.ToString();
                        UtilityClass.Bed          = Convert.ToDecimal(dgv.CurrentRow.Cells["clnBed"].Value.ToString());
                        UtilityClass.Bes          = Convert.ToDecimal(dgv.CurrentRow.Cells["clnBes"].Value.ToString());
                        UtilityClass.CurrencyCode =
                            Convert.ToInt32(dgv.CurrentRow.Cells["clnIdCurrency"].Value.ToString());
                        UtilityClass.RatePrice = Convert.ToDecimal(dgv.CurrentRow.Cells["clnRate"].Value.ToString());
                        UtilityClass.BedTMN    = Convert.ToDecimal(dgv.CurrentRow.Cells["clnBedTMN"].Value.ToString());
                        UtilityClass.BesTMN    = Convert.ToDecimal(dgv.CurrentRow.Cells["clnBesTMN"].Value.ToString());
                    }

                    page.ShowDialog();
                    if (dgv.CurrentRow != null)
                    {
                        dgv.CurrentRow.Cells["clnBed"].Value         = UtilityClass.Bed;
                        dgv.CurrentRow.Cells["clnBes"].Value         = UtilityClass.Bes;
                        dgv.CurrentRow.Cells["clnIdCurrency"].Value  = UtilityClass.CurrencyCode;
                        dgv.CurrentRow.Cells["clnCurrency"].Value    = UtilityClass.Currency;
                        dgv.CurrentRow.Cells["clnRate"].Value        = UtilityClass.RatePrice;
                        dgv.CurrentRow.Cells["clnBedTMN"].Value      = UtilityClass.BedTMN;
                        dgv.CurrentRow.Cells["clnBesTMN"].Value      = UtilityClass.BesTMN;
                        dgv.CurrentRow.Cells["clnAccountSide"].Value = UtilityClass.AccName;
                        dgv.CurrentRow.Cells["clnCode"].Value        = UtilityClass.AccCode;
                    }
                }

                GetSumRecords();
            }

            if (e.ColumnIndex == 13)
            {
                if (dgv.CurrentRow != null)
                {
                    dgv.Rows.Remove(dgv.CurrentRow);
                }
                GetSumRecords();
            }
        }