private void InitControl() { OrderService order_service = new OrderService(); #region 업체cbo List <CompanyVO> company_list = order_service.GetCompanyAll("CUSTOMER"); ComboUtil.ComboBinding(cboCompany, company_list, "company_id", "company_name", "전체"); #endregion price_service = new PriceService(); pricelist = price_service.GetPriceInfo("COOPERATIVE"); dgvMUPM.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dgvMUPM.Columns.Add("Number", "No."); dgvMUPM.Columns[0].Width = 53; dgvMUPM.Columns[0].Visible = false; #region DGV바인딩 GridViewUtil.AddNewColumnToDataGridView(dgvMUPM, "업체", "company_code", true, 170, DataGridViewContentAlignment.MiddleLeft); GridViewUtil.AddNewColumnToDataGridView(dgvMUPM, "업체명", "company_name", true, 200, DataGridViewContentAlignment.MiddleLeft); GridViewUtil.AddNewColumnToDataGridView(dgvMUPM, "품목", "product_codename", true, 180, DataGridViewContentAlignment.MiddleLeft); GridViewUtil.AddNewColumnToDataGridView(dgvMUPM, "품명", "product_name", true, 240, DataGridViewContentAlignment.MiddleLeft); GridViewUtil.AddNewColumnToDataGridView(dgvMUPM, "단위", "product_unit", true, 100, DataGridViewContentAlignment.MiddleCenter); GridViewUtil.AddNewColumnToDataGridView(dgvMUPM, "현재단가", "price_present", true, 150, DataGridViewContentAlignment.MiddleRight, true); GridViewUtil.AddNewColumnToDataGridView(dgvMUPM, "이전단가", "price_past", true, 150, DataGridViewContentAlignment.MiddleRight, true); GridViewUtil.AddNewColumnToDataGridView(dgvMUPM, "시작일", "price_sdate", true, 150, DataGridViewContentAlignment.MiddleCenter); GridViewUtil.AddNewColumnToDataGridView(dgvMUPM, "종료일", "price_edate", true, 150, DataGridViewContentAlignment.MiddleCenter); GridViewUtil.AddNewColumnToDataGridView(dgvMUPM, "비고", "price_comment", true, 170, DataGridViewContentAlignment.MiddleLeft); GridViewUtil.AddNewColumnToDataGridView(dgvMUPM, "사용유무", "price_yn", true, 100, DataGridViewContentAlignment.MiddleCenter); #endregion GridViewUtil.SetDataGridView(dgvMUPM); dgvMUPM.AutoGenerateColumns = false; dgvMUPM.DataSource = pricelist; }
private void button1_Click(object sender, EventArgs e) { PriceInfoVO vo = new PriceInfoVO(); foreach (DataGridViewRow row in this.dgvMUPM.SelectedRows) { vo = row.DataBoundItem as PriceInfoVO; } MUPMPop frm = new MUPMPop(MUPMPop.EditMode.Update, null, vo); if (frm.ShowDialog() == DialogResult.OK) { price_service = new PriceService(); List <PriceInfoVO> newPricelist = price_service.GetPriceInfo("COOPERATIVE"); //등록후 다시 조회 dgvMUPM.DataSource = newPricelist; dgvMUPM.ClearSelection(); SetBottomStatusLabel("자재단가 수정이 완료되었습니다."); } }
private void btnAdd_Click(object sender, EventArgs e) { List <PriceInfoVO> list = new List <PriceInfoVO>(); foreach (DataGridViewRow row in this.dgvMUPM.Rows) { PriceInfoVO vo = new PriceInfoVO(); vo = row.DataBoundItem as PriceInfoVO; list.Add(vo); } MUPMPop frm = new MUPMPop(MUPMPop.EditMode.Insert, list); if (frm.ShowDialog() == DialogResult.OK) { price_service = new PriceService(); List <PriceInfoVO> new_priceinfo_list = price_service.GetPriceInfo("COOPERATIVE"); //등록후 다시 조회 dgvMUPM.DataSource = new_priceinfo_list; SetBottomStatusLabel("신규 자재단가가 등록되었습니다."); } }
private void btnSave_Click(object sender, EventArgs e) { if (edit == EditMode.Insert) { if (MessageBox.Show("등록하시겠습니까?", "신규등록", MessageBoxButtons.YesNo) == DialogResult.Yes) { price_service = new PriceService(); PriceInfoVO vo = new PriceInfoVO(); vo.product_id = Convert.ToInt32(cboProduct.SelectedValue); vo.company_id = Convert.ToInt32(cboCompany.SelectedValue); vo.price_present = Convert.ToDecimal(txtCurrentPrice.Text); vo.price_past = Convert.ToDecimal(txtBeforePrice.Text); vo.price_sdate = dtpStartDate.Value.ToString("yyyy-MM-dd"); vo.price_edate = txtEndDate.Text; vo.price_udate = txtModifyDate.Text; //vo.price_uadmin = txtModifier.Text; vo.price_yn = cboIsUsed.SelectedValue.ToString(); vo.price_comment = txtNote.Text; try { bool bResult = price_service.AddPriceInfo(vo); if (bResult) { if (MessageBox.Show("등록되었습니다.", "등록완료", MessageBoxButtons.OK) == DialogResult.OK) { this.Close(); } } } catch (Exception err) { LoggingUtility.GetLoggingUtility(err.Message, Level.Error); if (MessageBox.Show("등록에 실패하였습니다.", "등록 실패", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK) { return; } } } } else if (edit == EditMode.Update) { if (MessageBox.Show("수정하시겠습니까?", "자재 단가 수정", MessageBoxButtons.YesNo) == DialogResult.Yes) { price_service = new PriceService(); PriceInfoVO vo = new PriceInfoVO(); vo.price_id = this.vo.price_id; vo.product_id = Convert.ToInt32(cboProduct.SelectedValue); vo.company_id = Convert.ToInt32(cboCompany.SelectedValue); vo.price_present = Convert.ToDecimal(txtCurrentPrice.Text); vo.price_past = Convert.ToDecimal(txtBeforePrice.Text); vo.price_sdate = dtpStartDate.Value.ToString("yyyy-MM-dd"); vo.price_edate = txtEndDate.Text; vo.price_udate = txtModifyDate.Text; // vo.price_uadmin = txtModifier.Text; vo.price_yn = cboIsUsed.SelectedValue.ToString(); vo.price_comment = txtNote.Text; try { bool bResult = price_service.UpdatePriceInfo(vo); if (bResult) { if (MessageBox.Show("수정되었습니다.", "수정완료", MessageBoxButtons.OK) == DialogResult.OK) { this.Close(); } } } catch (Exception err) { LoggingUtility.GetLoggingUtility(err.Message, Level.Error); if (MessageBox.Show("수정에 실패하였습니다.", "수정 실패", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK) { return; } } } } }