/// <summary> /// 작성자: 최현호 / 작성일: 210212 /// </summary> /// <param name="vo"></param> /// <returns></returns> public bool Insert(MatPriceVO vo) { try { string sql = @"EXEC InsertOrUpdate @product_name, @company_name, @price_present, @price_sdate, @price_edate, @price_yn, @price_comment"; using (SqlCommand cmd = new SqlCommand(sql, conn)) { cmd.Parameters.AddWithValue("@product_name", vo.product_name); cmd.Parameters.AddWithValue("@company_name", vo.company_name); cmd.Parameters.AddWithValue("@price_present", vo.price_present); cmd.Parameters.AddWithValue("@price_sdate", vo.price_sdate); cmd.Parameters.AddWithValue("@price_edate", vo.price_edate); cmd.Parameters.AddWithValue("@price_yn", vo.price_yn); cmd.Parameters.AddWithValue("@price_comment", vo.price_comment); int iRowAffect = cmd.ExecuteNonQuery(); conn.Close(); return(iRowAffect > 0); } } catch (Exception) { throw; } }
private void btnEdit_Click(object sender, EventArgs e) { SalesPriceService Sservice; MatPriceService Mservice; if (label1.Text == "영업단가관리 등록") { if (cbProductName.SelectedIndex != 0 || cbCompanyName.SelectedIndex != 0 || cbYN.SelectedIndex != 0 || txtPricePresent.Text != null) { SalesPriceVO vo = new SalesPriceVO { product_name = cbProductName.Text, company_name = cbCompanyName.Text, price_sdate = dtpStart.Value.ToString(), price_edate = dtpEnd.Value.ToString(), price_yn = cbYN.Text, price_present = int.Parse(txtPricePresent.Text), price_comment = txtComment.Text }; Sservice = new SalesPriceService(); bool result = Sservice.Insert(vo); if (result) { MessageBox.Show(Properties.Resources.msgOK); cboBinding(); ClearTB(); } else { MessageBox.Show(Properties.Resources.msgError); } } } else if (label1.Text == "영업단가관리 수정") { try { SalesPriceVO vo = new SalesPriceVO { price_id = int.Parse(label1.Tag.ToString()), product_name = cbProductName.Text, company_name = cbCompanyName.Text, price_present = int.Parse(txtPricePresent.Text), price_sdate = Convert.ToDateTime(dtpStart.Value).ToString(), price_edate = Convert.ToDateTime(dtpEnd.Value).ToString(), price_yn = cbYN.Text, price_comment = txtComment.Text }; Sservice = new SalesPriceService(); bool result = Sservice.Update(vo); if (result) { MessageBox.Show(Properties.Resources.msgOK); cboBinding(); ClearTB(); } else { MessageBox.Show(Properties.Resources.msgError); } } catch (Exception err) { MessageBox.Show(err.Message); } } else if (label1.Text == "자재단가관리 등록") { if (cbProductName.SelectedIndex != 0 || cbCompanyName.SelectedIndex != 0 || cbYN.SelectedIndex != 0 || txtPricePresent.Text != null) { MatPriceVO vo = new MatPriceVO() { product_name = cbProductName.Text, company_name = cbCompanyName.Text, price_sdate = dtpStart.Value.ToString(), price_edate = dtpEnd.Value.ToString(), price_yn = cbYN.Text, price_present = int.Parse(txtPricePresent.Text), price_comment = txtComment.Text }; Mservice = new MatPriceService(); bool result = Mservice.Insert(vo); if (result) { MessageBox.Show(Properties.Resources.msgOK); cboBinding(); ClearTB(); } else { MessageBox.Show(Properties.Resources.msgError); } } } else if (label1.Text == "자재단가관리 수정") { try { MatPriceVO vo = new MatPriceVO { price_id = int.Parse(label1.Tag.ToString()), product_name = cbProductName.Text, company_name = cbCompanyName.Text, price_present = int.Parse(txtPricePresent.Text), price_sdate = Convert.ToDateTime(dtpStart.Value).ToString(), price_edate = Convert.ToDateTime(dtpEnd.Value).ToString(), price_yn = cbYN.Text, price_comment = txtComment.Text }; Mservice = new MatPriceService(); bool result = Mservice.Update(vo); if (result) { MessageBox.Show(Properties.Resources.msgOK); cboBinding(); ClearTB(); } else { MessageBox.Show(Properties.Resources.msgError); } } catch (Exception err) { MessageBox.Show(err.Message); } } }
public bool Update(MatPriceVO vo) { MatPriceDAC dac = new MatPriceDAC(); return(dac.Update(vo)); }
public bool Insert(MatPriceVO vo) { MatPriceDAC dac = new MatPriceDAC(); return(dac.Insert(vo)); }