Example #1
0
        //추가 처리 필요
        private void buttonAddStore_Click(object sender, EventArgs e)
        {
            string queryReadMaxStcode = sqlQuery.selectAllFrom_Where_Select__From_("store", "max", "st_code");
            Store  store = crud.Read_MS(queryReadMaxStcode, new Store());

            store.St_code                     = (Convert.ToInt32(store.St_code) + 1).ToString();
            store.St_name                     = textBoxStroeName.Text;
            store.St_manager                  = textBoxAdminName.Text;
            store.St_zip                      = textBoxAddressZip.Text;
            store.St_addr1                    = textBoxAddress.Text;
            store.St_info_contract            = textBoxContractInformation.Text;
            store.St_info_basic               = textBoxBasicInformation.Text;
            store.St_contract_date            = dateTimePickerContractDate.Value;
            store.St_contract_date2           = dateTimePickerContractDate2.Value;
            store.St_electricity_expense_date = dateTimePickerElectricityExpense.Value;
            store.St_management_expense_date  = dateTimePickerElectricityExpense.Value;
            store.St_water_expense_date       = dateTimePickerElectricityExpense.Value;
            store.St_date                     = DateTime.Now;
            string queryCreate = sqlQuery.InsertInto__Values_(store);
            int    result      = crud.Create_MS(queryCreate, store);

            if (result > 0)
            {
                MessageBox.Show("성공");
                string  queryReadStore = sqlQuery.select_From_("store", new string[] { "st_name", "st_manager" });
                DataSet dataSetStore   = crud.ReadToGrid_MS(queryReadStore);
                setDataGridView(dataSetStore, dataGridViewStore);

                return;
            }
            MessageBox.Show("실패");
        }