private void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e) //수정 { if (e.RowIndex < 0) { return; } else if (IsLastInsert("수정", e.RowIndex) == false) { return; } SellPriceManageVO ManageVO = new SellPriceManageVO { Sellprice_Code = dgv[10, e.RowIndex].Value.ToInt(), Product_Group_Name = dgv[1, e.RowIndex].Value.ToString(), Product_Name = dgv[2, e.RowIndex].Value.ToString(), Sell_Current_Price_String = dgv[5, e.RowIndex].Value.ToString().Replace(" 원", "").Replace(",", ""), Sell_Previous_Price_String = dgv[6, e.RowIndex].Value.ToString().Replace(" 원", "").Replace(",", ""), Start_Date = Convert.ToDateTime(dgv[7, e.RowIndex].Value), End_Date = Convert.ToDateTime(dgv[8, e.RowIndex].Value), Note = dgv[9, e.RowIndex].Value.ToString(), RankNum = dgv[11, e.RowIndex].Value.ToInt() }; SettingFormOpen(false, ManageVO); }
private void UpsertSettings(int Code) { if (MessageBox.Show($"정말로 {message}하시겠습니까?", "", MessageBoxButtons.YesNo) == DialogResult.No) { return; } SellPriceManageVO vo = new SellPriceManageVO { Sellprice_Code = Code, Product_Group_ID = cboProductGroup.SelectedValue.ToInt(), Product_ID = cboProduct.SelectedValue.ToInt(), Sell_Previous_Price = txtPreviousPrice.Text.Replace(",", "").Replace("-", "").ToInt(), Sell_Current_Price = txtCurrentPrice.Text.Replace(",", "").ToInt(), Start_Date = dtpStartDate.Value }; if (txtNote.TextLength < 1) { vo.Note = ""; } else { vo.Note = txtNote.Text; } if (productService.UpsertSellPrice(vo) == true) { MessageBox.Show($"{message}이 완료되었습니다."); this.DialogResult = DialogResult.Yes; this.Close(); } }
private void SettingFormOpen(bool IsInsert, SellPriceManageVO ManageVO = null) // 등록 / 수정에 따른 폼 open { SellPriceDialogForm frm = new SellPriceDialogForm(IsInsert, ManageVO, dgvList); if (frm.ShowDialog() == DialogResult.Yes) // 정상적으로 실행 후 종료된 경우 { ReviewDGV(); // 데이터 갱신!! } }
public SellPriceDialogForm(bool IsInsert, SellPriceManageVO ManageVO = null, List <SellPriceManageVO> dgvList = null) { InitializeComponent(); this.isInsert = IsInsert; this.dgvList = dgvList; if (!IsInsert) //수정 { this.Text = message = "수정"; this.ManageVO = ManageVO; } else { this.Text = message = "등록"; } }
public bool UpsertSellPrice(SellPriceManageVO vo) { try { using (SqlConnection conn = new SqlConnection(this.ConnectionString)) { conn.Open(); string sql = "SP_SELLPRICE_UPSERT"; using (SqlCommand cmd = new SqlCommand(sql, conn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@sell_price_code", vo.Sellprice_Code); cmd.Parameters.AddWithValue("@product_group_id", vo.Product_Group_ID); cmd.Parameters.AddWithValue("@product_id", vo.Product_ID); cmd.Parameters.AddWithValue("@sell_current_price", vo.Sell_Current_Price); cmd.Parameters.AddWithValue("@sell_previous_price", vo.Sell_Previous_Price); cmd.Parameters.AddWithValue("@sell_start_date", vo.Start_Date); cmd.Parameters.AddWithValue("@note", vo.Note); if (Convert.ToInt32(cmd.ExecuteNonQuery()) > 0) { return(true); } else { return(false); } } } } catch (Exception err) { throw err; } }
public bool UpsertSellPrice(SellPriceManageVO manageVO) { return(dac.UpsertSellPrice(manageVO)); }