//추가 처리 필요 private void buttonAddStore_Click(object sender, EventArgs e) { if (MessageBox.Show("등록하시겟습니까?", "등록", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (buttonAddStore.Text == "등록") { buttonEnableToggle(true, buttonForCreateAndUpdateArray); dataGridViewEmployee.DataSource = null; dataGridViewExpense.DataSource = null; readonlyTextBoxAndDatetimePicker(false); clearDatetimePickerAndTextBox(); buttonAddStore.Text = "적용"; return; } if (buttonAddStore.Text == "적용") { string queryReadMaxStcode = sqlQuery.selectAllFrom_Where_Select_MINMAX_From_("st_table", "max", "st_code"); St_table store = crud.Read_MySql(queryReadMaxStcode, new St_table()); 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_addr2 = textBoxAddress2.Text; store.St_info1 = textBoxContractInformation.Text; store.St_info2 = textBoxBasicInformation.Text; store.St_contractdate = dateTimePickerContractDate.Value; store.St_contractdate2 = dateTimePickerContractDate2.Value; store.St_ele_date = dateTimePickerElectricityExpense.Value; store.St_maint_date = dateTimePickerManagementExpense.Value; store.St_sudo_date = dateTimePickerWaterExpense.Value; store.St_date = DateTime.Now; string queryCreate = sqlQuery.InsertInto__Values_(store); int result = crud.Create_MySql(queryCreate, store); if (result > 0) { buttonEnableToggle(false, buttonForCreateAndUpdateArray); MessageBox.Show("성공"); readStoreTablePattern(); buttonAddStore.Text = "등록"; readonlyTextBoxAndDatetimePicker(true); clearDatetimePickerAndTextBox(); return; } MessageBox.Show("실패"); clearDatetimePickerAndTextBox(); } } }
/// <summary> /// <para>기능 : 실적 등록</para> /// <para>진입 : 등록 메시지 박스 Yes클릭</para> /// <para>분기 : 1. buttonCreateResult.Text == "등록"</para> /// <para>로직 : 1. 버튼 텍스트 == 등록</para> /// <para>로직 : ----2. clearSelectedDetail</para> /// <para>로직 : ----3. cellNotResultDisable</para> /// <para>로직 : ----4. 버튼텍스트 "적용" 으로 변경</para> /// <para>로직 : ----return</para> /// <para>로직 : 5. st_emp_result에 등록사항 할당</para> /// <para>로직 : 6. sqlQuery.InsertInto__Values_ 와 Crud.Create를 사용하여 등록</para> /// <para>로직 : 7. 변경사항이 0 초과 일 경우</para> /// <para>로직 : ----8. 성공 메시지</para> /// <para>로직 : ----9. readResultTablePattern </para> /// <para>로직 : ----10. 버튼 텍스드 "등록"으로 변경 </para> /// <para>로직 : ----11. clearSelectedDetail </para> /// <para>로직 : 12. 실패 메시지 </para> /// <para>로직 : 13. clearSelectedDetail </para> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void buttonCreateResult_Click(object sender, EventArgs e) { if (MessageBox.Show("등록하시겟습니까?", "등록", MessageBoxButtons.YesNo) == DialogResult.Yes) { selectedUser_phone_number = null; if (buttonCreateResult.Text == "등록") { //datagrid클리어 및 쓰기가능 clearSelectedDetail(false); //변경할수 없는 항목 처리 cellNotResultDisable(); buttonCreateResult.Text = "적용"; return; } St_emp_result st_emp_result = new St_emp_result { // datagridviewSelectionDateDetail의 각 항목은 makeDetailTable() 참고 //직원코드 필요 임시로 id = st_emp_code st_emp_code = employee.st_emp_code, //매장코드 필요 st_code = employee.st_code, result_date = DateTime.Now, result_open_date = Convert.ToDateTime(dataGridViewSelectionDateDetail[1, 0].Value.ToString()), result_open_m_date = Convert.ToDateTime(dataGridViewSelectionDateDetail[3, 0].Value.ToString()), //정책 없음 result_policy = "", //대리점코드 없음 agent_code = "", result_ph_m = dataGridViewSelectionDateDetail[1, 3].Value.ToString(), result_serial_number = dataGridViewSelectionDateDetail[3, 3].Value.ToString(), //유저코드 필요 임시로 1 현재 유저가 1뿐임 user_code = "1", user_open_number = dataGridViewSelectionDateDetail[7, 3].Value.ToString(), user_agree_type = dataGridViewSelectionDateDetail[9, 3].Value.ToString(), //개통유형 없음 user_open_type = "", user_previous_com = dataGridViewSelectionDateDetail[1, 4].Value.ToString(), user_pur_type = dataGridViewSelectionDateDetail[3, 4].Value.ToString(), release_price = dataGridViewSelectionDateDetail[5, 4].Value.ToString(), subsidy_price = dataGridViewSelectionDateDetail[1, 5].Value.ToString(), installment_price = dataGridViewSelectionDateDetail[3, 5].Value.ToString(), prepayments = dataGridViewSelectionDateDetail[5, 5].Value.ToString(), mnp_commission = dataGridViewSelectionDateDetail[9, 5].Value.ToString(), price_plan = dataGridViewSelectionDateDetail[3, 6].Value.ToString(), net_rebate = dataGridViewSelectionDateDetail[1, 6].Value.ToString(), add_policy = dataGridViewSelectionDateDetail[7, 6].Value.ToString(), sound_policy = dataGridViewSelectionDateDetail[9, 6].Value.ToString(), addition_service = dataGridViewSelectionDateDetail[9, 7].Value.ToString(), insurance_YN = dataGridViewSelectionDateDetail[1, 7].Value.ToString(), late_payment_usim = dataGridViewSelectionDateDetail[3, 7].Value.ToString(), prepayments_usim = dataGridViewSelectionDateDetail[7, 7].Value.ToString(), user_calculate = dataGridViewSelectionDateDetail[5, 7].Value.ToString(), send_price = dataGridViewSelectionDateDetail[1, 8].Value.ToString(), due_date = Convert.ToDateTime(dataGridViewSelectionDateDetail[3, 8].Value.ToString()), cash = dataGridViewSelectionDateDetail[5, 8].Value.ToString(), card = dataGridViewSelectionDateDetail[7, 8].Value.ToString(), agent = dataGridViewSelectionDateDetail[5, 0].Value.ToString(), card_sale_price = dataGridViewSelectionDateDetail[3, 9].Value.ToString(), cash_sale_price = dataGridViewSelectionDateDetail[1, 9].Value.ToString(), etc_offset = dataGridViewSelectionDateDetail[5, 9].Value.ToString(), after_tax_price = dataGridViewSelectionDateDetail[7, 9].Value.ToString(), profit_margin = dataGridViewSelectionDateDetail[9, 9].Value.ToString(), note = dataGridViewSelectionDateDetail[9, 2].Value.ToString() }; string queryCreate = sqlQuery.InsertInto__Values_(st_emp_result); int result = crud.Create_MySql(queryCreate, st_emp_result); if (result > 0) { MessageBox.Show("성공"); textBoxDate.Text = ""; readResultTablePattern(); buttonCreateResult.Text = "등록"; clearSelectedDetail(true); return; } MessageBox.Show("실패"); clearSelectedDetail(false); } }