private void txtStdLight_OnSelected(object sender, EventArgs e)
 {
     try
     {
         if (txtStdLight.IntValue != null)
         {
             sp_MAS302_GetSTDLight_Result data = (txtStdLight.SelectedData as sp_MAS302_GetSTDLight_Result);
             sp_MAS201_GetCustomer_Result cust = vmMas.GetCustomer(this.result.CUSTOMER_ID);
             txtStdValue.NullableIntValue = data.STANDARD;
             txtStdName.Text = data.ALIAS_NAME.GetValueOrDefault(data.NAME);
             if (cust != null)
             {
                 if (cust.IS_LANG_TH == true)
                 {
                     txtStdName.Text = data.ALIAS_NAME.GetValueOrDefault(data.NAME);
                 }
                 else
                 {
                     txtStdName.Text = data.ALIAS_NAME_EN.GetValueOrDefault(data.NAME);
                 }
             }
             CtrlUtil.EnableControls(true, txtStdName);
         }
         else
         {
             txtStdValue.NullableIntValue = null;
             txtStdName.Text = null;
             CtrlUtil.EnableControls(false, txtStdName);
         }
     }
     catch (Exception ex)
     {
         rMessageBox.ShowException(this, ex);
     }
 }
Example #2
0
 private void SaveData()
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         if (ValidateBeforeSave())
         {
             if (rMessageBox.ShowConfirmation(this, MessageCode.CFM0001) == DialogResult.Yes)
             {
                 int ID = vmMas.SaveCustomer(custResult);
                 rMessageBox.ShowInfomation(this, MessageCode.INF0002);
                 this.IsDataChange = true;
                 custResult        = vmMas.GetCustomer(ID);
                 RetriveData();
             }
         }
     }
     catch (Exception ex)
     {
         rMessageBox.ShowException(this, ex);
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Example #3
0
        private void RetriveData()
        {
            try
            {
                if (custResult == null)
                {
                    custResult            = new sp_MAS201_GetCustomer_Result();
                    custResult.IS_LANG_TH = true;
                    custResult.CRT_DATE   = DateTime.Now;
                    this.ToolBarSwitch    = "2122222222";
                }
                else if (custResult.DEL_ID.IsNull())
                {
                    this.ToolBarSwitch = "2122222102";
                }
                else
                {
                    this.ToolBarSwitch = "2022222012";
                }

                CtrlUtil.EnableControls(custResult.DEL_ID.IsNull(), txtNameTh, txtNameEn, txtAddrNo, txtMoo, txtBuildingEn, txtBuildingTh, txtAlleyEn, txtAlleyTh, txtLaneEn, txtLaneTh, txtRoadEn, txtRoadTh, txtSubDictrictEn, txtSubDictrictTh, txtDictrictEn, txtDictrictTh, cboProvince, txtPostCode, txtSeq);

                bs.DataSource = custResult;
            }
            catch (Exception ex)
            {
                rMessageBox.ShowException(this, ex);
            }
        }
Example #4
0
 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.CancelCustomer(custResult, isCancel);
             if (isCancel)
             {
                 rMessageBox.ShowInfomation(this, MessageCode.INF0004);
             }
             else
             {
                 rMessageBox.ShowInfomation(this, MessageCode.INF0005);
             }
             this.IsDataChange = true;
             custResult        = vmMas.GetCustomer(custResult.ID);
             RetriveData();
         }
     }
     catch (Exception ex)
     {
         rMessageBox.ShowException(this, ex);
     }
 }
Example #5
0
        public void InitialScreen(string strSearch)
        {
            try
            {
                gvDetail.SetOISStyle();
                gvDetail.MappingEnum(typeof(eCol));

                custList = vmMas.GetCustomer();

                List <sp_MAS201_GetCustomer_Result> result = new List <sp_MAS201_GetCustomer_Result>();
                result.AddRange(custList);

                gvDetail.DataSource = result;

                txtSearch.Text = strSearch;

                if (id > 0)
                {
                    SelectedData = result.Where(x => x.ID == id).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #6
0
 private void gvDetail_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         SelectedData      = gvDetail.GetDataBound(e.RowIndex) as sp_MAS201_GetCustomer_Result;
         this.DialogResult = DialogResult.OK;
     }
 }
Example #7
0
 public int SaveCustomer(sp_MAS201_GetCustomer_Result data)
 {
     //if (!data.IS_LANG_EN.GetValueOrDefault())
     //{
     //    data.DEFAULT_LANGUAGE = "TH";
     //}
     //else
     //{
     //    data.DEFAULT_LANGUAGE = "EN";
     //}
     return(service.SaveCustomer(data));
 }
Example #8
0
 private void EditData(DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         sp_MAS201_GetCustomer_Result row = gvResult.Rows[e.RowIndex].DataBoundItem as sp_MAS201_GetCustomer_Result;
         using (MAS201_CustomerEntry dlg = new MAS201_CustomerEntry(row))
         {
             if (dlg.ShowDialog(this) == DialogResult.OK)
             {
                 LoadData();
             }
         }
     }
 }
Example #9
0
        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            string txt    = txtSearch.Text.ToUpper();
            var    result = custList.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_MAS201_GetCustomer_Result>(result);

            if (result.Count == 1)
            {
                SelectedData = result[0];
            }
            else
            {
                SelectedData = null;
            }
        }
 private void btnUpdateCustomer_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtCustomer.IntValue > 0)
         {
             sp_MAS201_GetCustomer_Result result = vmMas.GetCustomer(txtCustomer.IntValue.GetValueOrDefault());
             txtCustomerAddr.Text = result.ADDR;
             txtCustomer.Text     = result.NAME;
             txtCustomer.IntValue = result.ID;
         }
     }
     catch (Exception ex)
     {
         rMessageBox.ShowException(this, ex);
     }
 }
Example #11
0
 public void CancelCustomer(sp_MAS201_GetCustomer_Result data, bool ISCANCEL)
 {
     service.CancelCustomer(data, ISCANCEL);
 }
Example #12
0
 public MAS201_CustomerEntry(sp_MAS201_GetCustomer_Result data)
 {
     InitializeComponent();
     custResult = data;
 }