private void InitComboBind() { string todayFormat = string.Format("{0:yyyy-MM-dd HH:mm:ss}", today); txtUdate.Text = todayFormat; ResourceService R_service = new ResourceService(); List <MachineVO> m_list = R_service.GetMachineAll(); ComboUtil.ComboBinding(cboM_code, m_list, "m_id", "m_code"); CommonCodeService C_service = new CommonCodeService(); List <CommonVO> c_list = C_service.GetCommonCodeAll(); var shift_code = (from shift in c_list where shift.common_type == "shift_code" select shift).ToList(); ComboUtil.ComboBinding(cboShiftID, shift_code, "common_value", "common_name"); var YN = (from shift in c_list where shift.common_type == "user_flag" select shift).ToList(); ComboUtil.ComboBinding(cboYN, YN, "common_value", "common_name"); }
private void btnSave_Click(object sender, EventArgs e) { try { ResourceService R_Service = new ResourceService(); MachineGradeVO VO = new MachineGradeVO(); try { VO.mgrade_name = txtMgrade_name.Text; VO.mgrade_code = txtMgrade_code.Text; VO.mgrade_yn = cboYN.SelectedValue.ToString(); VO.mgrade_udate = txtMgrade_udate.Text; VO.mgrade_uadmin = txtMgrade_uadmin.Text; VO.mgrade_comment = txtMgrade_comment.Text; if (mode == EditMode.Input) { bool bResult = R_Service.InsertMachineGr(VO); if (bResult) { MessageBox.Show("등록성공"); this.DialogResult = DialogResult.OK; } else if (!bResult) { MessageBox.Show("등록실패"); this.DialogResult = DialogResult.None; return; } } else if (mode == EditMode.Update) { VO.mgrade_id = Convert.ToInt32(lblID.Text); bool bResult = R_Service.UpdateMachineGr(VO); if (bResult) { MessageBox.Show("수정성공"); this.DialogResult = DialogResult.OK; } else if (!bResult) { MessageBox.Show("수정실패"); this.DialogResult = DialogResult.None; return; } } } catch (NullReferenceException err) { MessageBox.Show("입력되지 않은값이 있습니다, 다시 확인해주세요", "입력확인", MessageBoxButtons.OK, MessageBoxIcon.Error); this.DialogResult = DialogResult.None; return; } catch (Exception err) { string str = err.Message; return; } } catch (NullReferenceException err) { MessageBox.Show("입력되지 않은값이 있습니다, 다시 확인해주세요", "입력확인", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); return; } catch (Exception err) { string str = err.Message; } }
private void ComboBoxBinding() { //TODO 메서드 하나로 모듈화 ProductService product_service = new ProductService(); ResourceService resource_service = new ResourceService(); List <FactoryDB_VO> f_list = new List <FactoryDB_VO>(); common_service = new CommonCodeService(); codelist = common_service.GetCommonCodeAll(); List <UserVO> user_list = product_service.GetUserAll(); List <CommonVO> _cboUnit = (from item in codelist where item.common_type == "item_unit" select item).ToList(); ComboUtil.ComboBinding(cboProductUnit, _cboUnit, "common_value", "common_name", "선택"); List <CommonVO> _cboUseFlag = (from item in codelist where item.common_type == "user_flag" select item).ToList(); ComboUtil.ComboBinding(cboIsUsed, _cboUseFlag, "common_value", "common_name", "선택"); List <CommonVO> _commonlist = (from item in codelist where item.common_type == "item_type" select item).ToList(); ComboUtil.ComboBinding(cboProductType, _commonlist, "common_value", "common_name", "선택"); List <CommonVO> _commonmeastype = (from item in codelist where item.common_type == "meastype" select item).ToList(); ComboUtil.ComboBinding(cboMeasType, _commonmeastype, "common_value", "common_name", "선택"); #region 담당자cbo ComboUtil.ComboBinding(cboAdmin, user_list, "user_id", "user_name", "선택"); #endregion #region 입고창고cbo f_list = resource_service.GetFactoryAll(); List <FactoryDB_VO> _cboInSector = (from item in f_list where item.facility_value == "FAC200" || item.facility_value == "FAC400" select item).ToList(); ComboUtil.ComboBinding(cboInSector, _cboInSector, "factory_code", "factory_name", "선택"); #endregion #region 출고창고cbo List <FactoryDB_VO> _cboOutSector = (from item in f_list where item.facility_value == "FAC100" select item).ToList(); ComboUtil.ComboBinding(cboOutSector, _cboOutSector, "factory_code", "factory_name", "선택"); #endregion #region 발주방식cbo _commonlist = (from item in codelist where item.common_type == "order_method" select item).ToList(); ComboUtil.ComboBinding(cboOrderType, _commonlist, "common_value", "common_name", "선택"); #endregion #region 납품업체cbo List <CompanyVO> company_list = new List <CompanyVO>(); OrderService order_service = new OrderService(); company_list = order_service.GetCompanyAll("COOPERATIVE"); ComboUtil.ComboBinding(cboSupplyCompany, company_list, "company_code", "company_name", "선택"); #endregion #region 발주업체cbo company_list = order_service.GetCompanyAll("CUSTOMER"); ComboUtil.ComboBinding(cboDemandCompany, company_list, "company_code", "company_name", "선택"); List <UserVO> user_vo = new List <UserVO>(); #endregion }