예제 #1
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            if (dataGridVendors.CurrentRow == null)
            {
                return;
            }

            VendorAdd frmVendorModify = new VendorAdd();

            frmVendorModify.Text         = btnModify.Text;
            frmVendorModify.btnSave.Text = "수 정";
            //frmVendorModify.txtBoxName.Enabled = false;
            frmVendorModify.ckBoxIsUse.Enabled = true;

            int curRow = dataGridVendors.CurrentRow.Index;

            frmVendorModify.ckBoxIsUse.Checked      = (Convert.ToBoolean(dataGridVendors[1, curRow].Value)) ? true : false;
            frmVendorModify.textBox_vendorCode.Text = dataGridVendors["코드", curRow].Value.ToString();
            frmVendorModify.txtBoxName.Text         = dataGridVendors["업체명", curRow].Value.ToString();
            frmVendorModify.txtBoxAddr1.Text        = dataGridVendors["본사 주소", curRow].Value.ToString();
            frmVendorModify.txtBoxAddr2.Text        = dataGridVendors["공장 주소", curRow].Value.ToString();
            frmVendorModify.txtBoxAddr3.Text        = dataGridVendors["지사/사무소 주소", curRow].Value.ToString();
            //frmVendorModify.cbBoxCategory.SelectedIndex = Convert.ToInt16(dataGridVendors[2, curRow].Value);
            frmVendorModify.txtBoxHomepage.Text         = dataGridVendors["홈페이지", curRow].Value.ToString();
            frmVendorModify.txtBoxTel.Text              = dataGridVendors["연락처", curRow].Value.ToString();
            frmVendorModify.cbBoxPayment.SelectedIndex  = Convert.ToInt16(dataGridVendors[3, curRow].Value);
            frmVendorModify.cbBoxDelivery.SelectedIndex = Convert.ToInt16(dataGridVendors[4, curRow].Value);
            frmVendorModify.txtBoxComment.Text          = dataGridVendors["비고", curRow].Value.ToString();

            if (frmVendorModify.ShowDialog() == DialogResult.OK)
            {
                ((MainForm)MdiParent).dbCtrl.SendQuery("UPDATE [Vendors] SET " +
                                                       "[VendorModifyDate] = GETDATE() " +
                                                       ",[VendorCode] = '" + frmVendorModify.textBox_vendorCode.Text + "'" +
                                                       ",[VendorName] = '" + frmVendorModify.txtBoxName.Text + "'" +
                                                       ",[VendorAddr1] = '" + frmVendorModify.txtBoxAddr1.Text + "'" +
                                                       ",[VendorAddr2] = '" + frmVendorModify.txtBoxAddr2.Text + "'" +
                                                       ",[VendorAddr3] = '" + frmVendorModify.txtBoxAddr2.Text + "'" +
                                                       ",[VendorCategory] = " + frmVendorModify.cbBoxCategory.SelectedIndex +
                                                       ",[VendorHomepage] = '" + frmVendorModify.txtBoxHomepage.Text + "'" +
                                                       ",[VendorTel] = '" + frmVendorModify.txtBoxTel.Text + "'" +
                                                       ",[VendorPaymentTerms] = " + frmVendorModify.cbBoxPayment.SelectedIndex +
                                                       ",[VendorDeliveryCondition] = " + frmVendorModify.cbBoxDelivery.SelectedIndex +
                                                       ",[VendorComment] = '" + frmVendorModify.txtBoxComment.Text + "'" +
                                                       ",[VendorIsUse] = " + ((frmVendorModify.ckBoxIsUse.Checked) ? 1 : 0).ToString() + " " +
                                                       "WHERE [VendorID] = " + dataGridVendors[0, curRow].Value.ToString());

                LoadVendorTable();
            }
        }
예제 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            VendorAdd frmVendorAdd = new VendorAdd();

            frmVendorAdd.Text               = btnAdd.Text;
            frmVendorAdd.btnSave.Text       = "저 장";
            frmVendorAdd.txtBoxName.Enabled = true;
            frmVendorAdd.ckBoxIsUse.Enabled = false;

            frmVendorAdd.cbBoxCategory.SelectedIndex = 0;
            frmVendorAdd.cbBoxPayment.SelectedIndex  = 0;
            frmVendorAdd.cbBoxDelivery.SelectedIndex = 0;

            if (frmVendorAdd.ShowDialog() == DialogResult.OK)
            {
                ((MainForm)MdiParent).dbCtrl.SendQuery("INSERT INTO [Vendors] (" +
                                                       "[VendorCode] " +
                                                       ",[VendorName] " +
                                                       ",[VendorAddr1] " +
                                                       ",[VendorAddr2] " +
                                                       ",[VendorAddr3] " +
                                                       ",[VendorCategory] " +
                                                       ",[VendorHomepage] " +
                                                       ",[VendorTel] " +
                                                       ",[VendorPaymentTerms] " +
                                                       ",[VendorDeliveryCondition] " +
                                                       ",[VendorComment]) VALUES ( " +
                                                       "'" + frmVendorAdd.textBox_vendorCode.Text + "'," +
                                                       "'" + frmVendorAdd.txtBoxName.Text + "'," +
                                                       "'" + frmVendorAdd.txtBoxAddr1.Text + "'," +
                                                       "'" + frmVendorAdd.txtBoxAddr2.Text + "'," +
                                                       "'" + frmVendorAdd.txtBoxAddr3.Text + "'," +
                                                       frmVendorAdd.cbBoxCategory.SelectedIndex + "," +
                                                       "'" + frmVendorAdd.txtBoxHomepage.Text + "'," +
                                                       "'" + frmVendorAdd.txtBoxTel.Text + "'," +
                                                       frmVendorAdd.cbBoxPayment.SelectedIndex + "," +
                                                       frmVendorAdd.cbBoxDelivery.SelectedIndex + "," +
                                                       "'" + frmVendorAdd.txtBoxComment.Text + "'" +
                                                       " )");

                LoadVendorTable();
            }
        }