コード例 #1
0
        private void toolStripButtonBuy_Click(object sender, EventArgs e)
        {
            string ConnectionString = @"Data Source=" + sPath + ";New=False;Version=3";
            var    form             = new FormTablePartOperation();

            form.IdRequest = Convert.ToInt32(toolStripComboBoxRequest.ComboBox.SelectedValue);
            form.NameBuy   = toolStripTextBoxName.Text;
            string selectDate = "select RequestDate from request where idRequest = '" +
                                Convert.ToInt32(toolStripComboBoxRequest.ComboBox.SelectedValue) + "'";
            DateTime reqDate = Convert.ToDateTime(selectValue(ConnectionString, selectDate));

            if (dateTimePicker1.Value < reqDate)
            {
                MessageBox.Show("Дата операции должна быть меньше даты заявки - " + reqDate);
                return;
            }
            form.Date        = dateTimePicker1.Value;
            form.FormClosed += new FormClosedEventHandler(formTPOclosed);
            form.Show();
        }
コード例 #2
0
        private void toolStripButtonOpen_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 1)
            {
                string ConnectionString = @"Data Source=" + sPath +
                                          ";New=False;Version=3";
                var    form          = new FormTablePartOperation();
                int    CurrentRow    = Convert.ToInt32(dataGridView1.SelectedCells[0].Value);
                string selectCommand = "Select IdRequest From JournalOfOperations Where IdJournalOfOperations = '" + CurrentRow + "'";
                try
                {
                    form.IdRequest = Convert.ToInt32(selectValue(ConnectionString, selectCommand));
                }
                catch (Exception) { }

                form.IdJO        = CurrentRow;
                form.NameBuy     = toolStripTextBoxName.Text;
                form.Date        = dateTimePicker1.Value;
                form.FormClosed += new FormClosedEventHandler(formTPOclosed);
                form.Show();
            }
        }