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);
     }
 }
        private void RetriveData()
        {
            try
            {
                if (stdLightResult == null)
                {
                    stdLightResult          = new sp_MAS302_GetSTDLight_Result();
                    stdLightResult.CRT_DATE = DateTime.Now;
                    this.ToolBarSwitch      = "2122222222";
                }
                else if (stdLightResult.DEL_ID.IsNull())
                {
                    this.ToolBarSwitch = "2122222102";
                }
                else
                {
                    this.ToolBarSwitch = "2022222012";
                }

                CtrlUtil.EnableControls(stdLightResult.DEL_ID.IsNull(), txtName, txtTypeName, txtBuildingName, txtAliasName, txtAliasNameEn, txtStandard, txtSeq);

                bs.DataSource = stdLightResult;
            }
            catch (Exception ex)
            {
                rMessageBox.ShowException(this, ex);
            }
        }
Example #3
0
        public void InitialScreen(string strSearch)
        {
            try
            {
                gvDetail.SetOISStyle();
                gvDetail.MappingEnum(typeof(eCol));

                gvDetail.SetColumnNumeric((int)eCol.STANDARD);

                stdList = vmMas.GetSTDLight(new MAS302_STDLight_Criteria());

                SortableBindingList <sp_MAS302_GetSTDLight_Result> result = new SortableBindingList <sp_MAS302_GetSTDLight_Result>();
                result.AddRange(stdList);

                gvDetail.DataSource = result;

                txtSearch.Text = strSearch;

                if (id > 0)
                {
                    SelectedData = result.Where(x => x.ID == id).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw 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.CancelSTDLight(stdLightResult, isCancel);
             if (isCancel)
             {
                 rMessageBox.ShowInfomation(this, MessageCode.INF0004);
             }
             else
             {
                 rMessageBox.ShowInfomation(this, MessageCode.INF0005);
             }
             this.IsDataChange = true;
             stdLightResult    = vmMas.GetSTDLight(stdLightResult.ID);
             RetriveData();
         }
     }
     catch (Exception ex)
     {
         rMessageBox.ShowException(this, ex);
     }
 }
 private void SaveData()
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         if (ValidateBeforeSave())
         {
             if (rMessageBox.ShowConfirmation(this, MessageCode.CFM0001) == DialogResult.Yes)
             {
                 int ID = vmMas.SaveSTDLight(stdLightResult);
                 rMessageBox.ShowInfomation(this, MessageCode.INF0002);
                 this.IsDataChange = true;
                 stdLightResult    = vmMas.GetSTDLight(ID);
                 RetriveData();
             }
         }
     }
     catch (Exception ex)
     {
         rMessageBox.ShowException(this, ex);
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
 private void EditData(DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         sp_MAS302_GetSTDLight_Result row = gvResult.Rows[e.RowIndex].DataBoundItem as sp_MAS302_GetSTDLight_Result;
         using (MAS302_StandardLightIntensityEntry dlg = new MAS302_StandardLightIntensityEntry(row))
         {
             if (dlg.ShowDialog(this) == DialogResult.OK)
             {
                 LoadData();
             }
         }
     }
 }
Example #7
0
 private void gvDetail_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex >= 0)
         {
             SelectedData      = gvDetail.GetDataBound(e.RowIndex) as sp_MAS302_GetSTDLight_Result;
             this.DialogResult = DialogResult.OK;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #8
0
        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            string txt    = txtSearch.Text.ToUpper();
            var    result = stdList.Where(x => x.ALIAS_NAME.GetValueOrDefault().ToUpper().Contains(txt) || x.NAME.GetValueOrDefault().ToUpper().Contains(txt) || x.TYPE_NAME.GetValueOrDefault().ToUpper().Contains(txt) || x.BUILDING_NAME.GetValueOrDefault().ToUpper().Contains(txt) || x.STANDARD.ToString().Contains(txt)).ToList();

            gvDetail.DataSource = new SortableBindingList <sp_MAS302_GetSTDLight_Result>(result);

            if (result.Count == 1)
            {
                SelectedData = result[0];
            }
            else
            {
                SelectedData = null;
            }
        }
Example #9
0
 public void CancelSTDLight(sp_MAS302_GetSTDLight_Result data, bool IS_CANCEL)
 {
     service.CancelSTDLight(data, IS_CANCEL);
 }
Example #10
0
 public int SaveSTDLight(sp_MAS302_GetSTDLight_Result data)
 {
     return(service.SaveSTDLight(data));
 }
 public MAS302_StandardLightIntensityEntry(sp_MAS302_GetSTDLight_Result data)
 {
     InitializeComponent();
     stdLightResult = data;
 }