public object[] queryDataMstBusiness(MST_BUSINESS param) { log.Info("Start log INFO... queryDataMstBusiness"); MsgForm msgError = new MsgForm(); MST_BUSINESS form = new MST_BUSINESS(); try { using (var db = new PaknampoScaleDBEntities()) { form = (from row in db.MST_BUSINESS where row.BUSINESS_ID == param.BUSINESS_ID select row).FirstOrDefault(); db.Dispose(); msgError.statusFlag = MsgForm.STATUS_SUCCESS; } } catch (Exception ex) { log.Error(ex.ToString(), ex); msgError.statusFlag = MsgForm.STATUS_ERROR; msgError.messageDescription = ex.ToString(); } finally { log.Info("End log INFO... queryDataMstBusiness"); } return(new object[] { msgError, form }); }
public void queryDataMstBusiness() { MST008Controller mst008Ctrl = new MST008Controller(); formMstBusiness.BUSINESS_ID = 1; try { object[] result = mst008Ctrl.queryDataMstBusiness(formMstBusiness); MsgForm msgForm = (MsgForm)result[0]; MST_BUSINESS data = (MST_BUSINESS)result[1]; if (msgForm.statusFlag.Equals(1)) { if (Util.isNotEmpty(data)) { formMstBusiness = data; lblBusiness.Text = data.BUSINESS_NAME; } } else { MessageBox.Show("Error : " + msgForm.messageDescription); } } catch (Exception ex) { log.Error(ex.ToString(), ex); MessageBox.Show("Error : " + ex.ToString()); } }
public object[] updateDataMstBusiness(MST_BUSINESS param) { log.Info("Start log INFO... updateDataMstBusiness"); MsgForm msgError = new MsgForm(); MST_BUSINESS form = new MST_BUSINESS(); try { using (var db = new PaknampoScaleDBEntities()) { form = (from row in db.MST_BUSINESS where row.BUSINESS_ID == param.BUSINESS_ID select row).FirstOrDefault(); if (Util.isNotEmpty(form)) { form.BUSINESS_NAME = param.BUSINESS_NAME; form.BUSINESS_ADDRESS = param.BUSINESS_ADDRESS; form.BUSINESS_DISTRICT = param.BUSINESS_DISTRICT; form.BUSINESS_AMPHURE = param.BUSINESS_AMPHURE; form.BUSINESS_PROVINCE = param.BUSINESS_PROVINCE; form.BUSINESS_POSTCODE = param.BUSINESS_POSTCODE; form.BUSINESS_TEL_NO = param.BUSINESS_TEL_NO; form.BUSINESS_FAX = param.BUSINESS_FAX; log.Info("Update Data form MST_BUSINESS WHERE " + form.BUSINESS_ID + " BUSINESS_NAME : " + form.BUSINESS_NAME + " BUSINESS_ADDRESS : " + form.BUSINESS_ADDRESS + " BUSINESS_DISTRICT : " + form.BUSINESS_DISTRICT + " BUSINESS_AMPHURE : " + form.BUSINESS_AMPHURE + " BUSINESS_PROVINCE : " + form.BUSINESS_PROVINCE + " BUSINESS_POSTCODE : " + form.BUSINESS_POSTCODE + " BUSINESS_TEL_NO : " + form.BUSINESS_TEL_NO + " BUSINESS_FAX : " + form.BUSINESS_FAX ); } db.SaveChanges(); msgError.statusFlag = MsgForm.STATUS_SUCCESS; } } catch (Exception ex) { log.Error(ex.ToString(), ex); msgError.statusFlag = MsgForm.STATUS_ERROR; msgError.messageDescription = ex.ToString(); } finally { log.Info("End log INFO... updateDataMstBusiness"); } return(new object[] { msgError }); }
public void queryDataMstBusiness() { MST008Controller mst008Ctrl = new MST008Controller(); formMstBusiness.BUSINESS_ID = 1; try { object[] result = mst008Ctrl.queryDataMstBusiness(formMstBusiness); MsgForm msgForm = (MsgForm)result[0]; MST_BUSINESS data = (MST_BUSINESS)result[1]; if (msgForm.statusFlag.Equals(1)) { if (Util.isNotEmpty(data)) { formMstBusiness = data; txtBusinessName.Text = data.BUSINESS_NAME; txtBusinessAddress.Text = data.BUSINESS_ADDRESS; txtPostcode.Text = data.BUSINESS_POSTCODE; txtBusinessTelNo.Text = data.BUSINESS_TEL_NO; txtFax.Text = data.BUSINESS_FAX; formMstBusiness.BUSINESS_PROVINCE = data.BUSINESS_PROVINCE; formMstBusiness.BUSINESS_AMPHURE = data.BUSINESS_AMPHURE; formMstBusiness.BUSINESS_DISTRICT = data.BUSINESS_DISTRICT; queryComboMstAmphures(); queryComboMstDistricts(); cboDistricts.SelectedValue = data.BUSINESS_DISTRICT; cboAmphure.SelectedValue = data.BUSINESS_AMPHURE; cboProvince.SelectedValue = data.BUSINESS_PROVINCE; } } else { MessageBox.Show("Error : " + msgForm.messageDescription); } } catch (Exception ex) { log.Error(ex.ToString(), ex); MessageBox.Show("Error : " + ex.ToString()); } }
public void updateDataMstBusiness() { MST008Controller mst008Ctrl = new MST008Controller(); MST_BUSINESS form = new MST_BUSINESS(); try { form.BUSINESS_ID = formMstBusiness.BUSINESS_ID; form.BUSINESS_NAME = txtBusinessName.Text; form.BUSINESS_ADDRESS = txtBusinessAddress.Text; form.BUSINESS_DISTRICT = Int32.Parse(cboDistricts.SelectedValue.ToString()); form.BUSINESS_AMPHURE = Int32.Parse(cboAmphure.SelectedValue.ToString()); form.BUSINESS_PROVINCE = Int32.Parse(cboProvince.SelectedValue.ToString()); form.BUSINESS_POSTCODE = txtPostcode.Text; form.BUSINESS_TEL_NO = txtBusinessTelNo.Text; form.BUSINESS_FAX = txtFax.Text; if (Util.isEmpty(form)) { return; } object[] result = mst008Ctrl.updateDataMstBusiness(form); MsgForm msgForm = (MsgForm)result[0]; if (msgForm.statusFlag.Equals(1)) { MessageBox.Show(CommonUtil.SAVE_DATA_SUCCESS); } else { MessageBox.Show("Error : " + msgForm.messageDescription); } } catch (Exception ex) { log.Error(ex.ToString(), ex); MessageBox.Show("Error : " + ex.ToString()); } }