Пример #1
0
        private void AddRowDeal(object sender, EventArgs e)
        {
            int i = gridMain.Rows.Count;

            gridMain.Rows.Add();
            gridMain.Rows[i].Visible = false;
            AddRow(i);

            gridMain.Rows[i].Cells[1].Value = dealInterrop.ContrID;
            gridMain.Rows[i].Cells[2].Value = dealInterrop.ContrTIN;
            gridMain.Rows[i].Cells[3].Value = dealInterrop.ContrName;
            gridMain.Rows[i].Cells[4].Value = dealInterrop.DealNumber;
            gridMain.Rows[i].Cells[5].Value = dealInterrop.DealDate;
            gridMain.Rows[i].Cells[6].Value = dealInterrop.DealName;
            gridMain.Rows[i].Cells[7].Value = dealInterrop.DueDate;


            dealInterrop.ButtonOkClicked -= new EventHandler(AddRowDeal);
            dealInterrop.Close();
            gridMain.Rows[i].Visible = true;

            dealInterrop = null;

            //указываем активную ячейку
            gridMain.CurrentCell = gridMain.Rows[gridMain.Rows.Count - 1].Cells[2];
        }
Пример #2
0
 /*работа с интерфейсом*/
 private void btnAdd_Click(object sender, EventArgs e)
 {
     using (dealInterrop = new DealInterrop())
     {
         dealInterrop.ButtonOkClicked += new EventHandler(AddRowDeal);
         dealInterrop.ShowDialog();
     }
 }
Пример #3
0
        private void EditRowDeal(object sender, EventArgs e)
        {
            gridMain.Rows[gridMain.CurrentCell.RowIndex].Cells[1].Value = dealInterrop.ContrID;
            gridMain.Rows[gridMain.CurrentCell.RowIndex].Cells[2].Value = dealInterrop.ContrTIN;
            gridMain.Rows[gridMain.CurrentCell.RowIndex].Cells[3].Value = dealInterrop.ContrName;
            gridMain.Rows[gridMain.CurrentCell.RowIndex].Cells[4].Value = dealInterrop.DealNumber;
            gridMain.Rows[gridMain.CurrentCell.RowIndex].Cells[5].Value = dealInterrop.DealDate;
            gridMain.Rows[gridMain.CurrentCell.RowIndex].Cells[6].Value = dealInterrop.DealName;
            gridMain.Rows[gridMain.CurrentCell.RowIndex].Cells[7].Value = dealInterrop.DueDate;

            //обновление в бд
            UpdateRow();
            dealInterrop.ButtonOkClicked -= new EventHandler(EditRowDeal);
            dealInterrop.Close();
            dealInterrop = null;
        }
Пример #4
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            using (dealInterrop = new DealInterrop())
            {
                dealInterrop.ButtonOkClicked += new EventHandler(EditRowDeal);
                dealInterrop.FormCaption      = "Редактировать";

                dealInterrop.ContrID    = Convert.ToInt32(gridMain.Rows[gridMain.CurrentCell.RowIndex].Cells[1].Value.ToString());
                dealInterrop.ContrTIN   = gridMain.Rows[gridMain.CurrentCell.RowIndex].Cells[2].Value.ToString();
                dealInterrop.ContrName  = gridMain.Rows[gridMain.CurrentCell.RowIndex].Cells[3].Value.ToString();
                dealInterrop.DealNumber = gridMain.Rows[gridMain.CurrentCell.RowIndex].Cells[4].Value.ToString();
                dealInterrop.DealDate   = Convert.ToDateTime(gridMain.Rows[gridMain.CurrentCell.RowIndex].Cells[5].Value.ToString());
                dealInterrop.DealName   = gridMain.Rows[gridMain.CurrentCell.RowIndex].Cells[6].Value.ToString();
                dealInterrop.DueDate    = Convert.ToInt32(gridMain.Rows[gridMain.CurrentCell.RowIndex].Cells[7].Value.ToString());
                dealInterrop.ShowDialog();
            }
        }