private void SaveData() { try { this.Cursor = Cursors.WaitCursor; if (ValidateBeforeSave()) { if (rMessageBox.ShowConfirmation(this, MessageCode.CFM0001) == DialogResult.Yes) { int ID = vmMas.SaveCustomerProject(custpResult); rMessageBox.ShowInfomation(this, MessageCode.INF0002); this.IsDataChange = true; custpResult = vmMas.GetCustomerProject(ID); RetriveData(); } } } catch (Exception ex) { rMessageBox.ShowException(this, ex); } finally { this.Cursor = Cursors.Default; } }
private void RetriveData() { try { if (custpResult == null) { custpResult = new sp_MAS202_GetCustomerProject_Result(); custpResult.CRT_DATE = DateTime.Now; this.ToolBarSwitch = "2122222222"; } else if (custpResult.DEL_ID.IsNull()) { this.ToolBarSwitch = "2122222102"; } else { this.ToolBarSwitch = "2022222012"; } CtrlUtil.EnableControls(custpResult.DEL_ID.IsNull(), txtCustomer, txtNameTh, txtNameEn, txtAddrNo, txtMoo, txtBuildingEn, txtBuildingTh, txtAlleyEn, txtAlleyTh, txtLaneEn, txtLaneTh, txtRoadEn, txtRoadTh, txtSubDictrictEn, txtSubDictrictTh, txtDictrictEn, txtDictrictTh, cboProvince, txtPostCode, txtSeq); bs.DataSource = custpResult; } catch (Exception ex) { rMessageBox.ShowException(this, ex); } }
private void CancelData(bool isCancel) { try { string msg; if (isCancel) { msg = MessageCode.CFM0003; } else { msg = MessageCode.CFM0004; } if (rMessageBox.ShowConfirmation(this, msg) == DialogResult.Yes) { vmMas.CancelCustomerProject(custpResult, isCancel); if (isCancel) { rMessageBox.ShowInfomation(this, MessageCode.INF0004); } else { rMessageBox.ShowInfomation(this, MessageCode.INF0005); } this.IsDataChange = true; custpResult = vmMas.GetCustomerProject(custpResult.ID); RetriveData(); } } catch (Exception ex) { rMessageBox.ShowException(this, ex); } }
public void InitialScreen(string strSearch) { try { gvDetail.SetOISStyle(); gvDetail.MappingEnum(typeof(eCol)); custPList = vmMas.GetCustomerProject(); List <sp_MAS202_GetCustomerProject_Result> result = new List <sp_MAS202_GetCustomerProject_Result>(); result.AddRange(custPList); gvDetail.DataSource = result; txtSearch.Text = strSearch; if (id > 0) { SelectedData = result.Where(x => x.ID == id).FirstOrDefault(); } } catch (Exception ex) { throw ex; } }
private void gvDetail_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { SelectedData = gvDetail.GetDataBound(e.RowIndex) as sp_MAS202_GetCustomerProject_Result; this.DialogResult = DialogResult.OK; } }
private void EditData(DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { sp_MAS202_GetCustomerProject_Result row = gvResult.Rows[e.RowIndex].DataBoundItem as sp_MAS202_GetCustomerProject_Result; using (MAS202_CustomerProjectEntry dlg = new MAS202_CustomerProjectEntry(row)) { if (dlg.ShowDialog(this) == DialogResult.OK) { LoadData(); } } } }
private void txtSearch_TextChanged(object sender, EventArgs e) { string txt = txtSearch.Text.ToUpper(); var result = custPList.Where(x => x.NAME_TH.Contains(txt) || x.NAME_EN.ToUpper().Contains(txt) || x.ADDR_TH.ToString().Contains(txt) || x.ADDR_EN.ToUpper().ToString().Contains(txt)).ToList(); gvDetail.DataSource = new SortableBindingList <sp_MAS202_GetCustomerProject_Result>(result); if (result.Count == 1) { SelectedData = result[0]; } else { SelectedData = null; } }
private void btnUpdateProject_Click(object sender, EventArgs e) { try { if (txtProject.IntValue > 0) { sp_MAS202_GetCustomerProject_Result result = vmMas.GetCustomerProject(txtProject.IntValue.GetValueOrDefault()); txtProjectAddr.Text = result.ADDR; txtProject.Text = result.NAME; txtProject.IntValue = result.ID; } } catch (Exception ex) { rMessageBox.ShowException(this, ex); } }
public MAS202_CustomerProjectEntry(sp_MAS202_GetCustomerProject_Result data) { InitializeComponent(); custpResult = data; }
public void CancelCustomerProject(sp_MAS202_GetCustomerProject_Result data, bool ISCANCEL) { service.CancelCustomerProject(data, ISCANCEL); }
public int SaveCustomerProject(sp_MAS202_GetCustomerProject_Result data) { return(service.SaveCustomerProject(data)); }