private void RetriveData()
        {
            try
            {
                if (InstrumentResult == null)
                {
                    InstrumentResult          = new sp_MAS303_GetInstrument_Result();
                    InstrumentResult.CRT_DATE = DateTime.Now;
                    this.ToolBarSwitch        = "2122222222";
                }
                else if (InstrumentResult.DEL_ID.IsNull())
                {
                    this.ToolBarSwitch = "2122222102";
                }
                else
                {
                    this.ToolBarSwitch = "2022222012";
                }

                CtrlUtil.EnableControls(InstrumentResult.DEL_ID.IsNull(), txtName, txtModel, txtSerialNo, txtSeq);

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

                insList = vmMas.GetInstrument();

                SortableBindingList <sp_MAS303_GetInstrument_Result> result = new SortableBindingList <sp_MAS303_GetInstrument_Result>();
                result.AddRange(insList);

                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.CancelInstrument(InstrumentResult, isCancel);
             if (isCancel)
             {
                 rMessageBox.ShowInfomation(this, MessageCode.INF0004);
             }
             else
             {
                 rMessageBox.ShowInfomation(this, MessageCode.INF0005);
             }
             this.IsDataChange = true;
             InstrumentResult  = vmMas.GetInstrument(InstrumentResult.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.SaveInstrument(InstrumentResult);
                 rMessageBox.ShowInfomation(this, MessageCode.INF0002);
                 this.IsDataChange = true;
                 InstrumentResult  = vmMas.GetInstrument(ID);
                 RetriveData();
             }
         }
     }
     catch (Exception ex)
     {
         rMessageBox.ShowException(this, ex);
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Exemple #5
0
 private void gvDetail_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         SelectedData      = gvDetail.GetDataBound(e.RowIndex) as sp_MAS303_GetInstrument_Result;
         this.DialogResult = DialogResult.OK;
     }
 }
Exemple #6
0
 private void EditData(DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         sp_MAS303_GetInstrument_Result row = gvResult.Rows[e.RowIndex].DataBoundItem as sp_MAS303_GetInstrument_Result;
         using (MAS303_InstrumentEntry dlg = new MAS303_InstrumentEntry(row))
         {
             if (dlg.ShowDialog(this) == DialogResult.OK)
             {
                 LoadData();
             }
         }
     }
 }
Exemple #7
0
        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            string txt    = txtSearch.Text.ToUpper();
            var    result = insList.Where(x => x.FULLNAME.ToUpper().Contains(txt)).ToList();

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

            if (result.Count == 1)
            {
                SelectedData = result[0];
            }
            else
            {
                SelectedData = null;
            }
        }
Exemple #8
0
 public void CancelInstrument(sp_MAS303_GetInstrument_Result data, bool ISCANCEL)
 {
     service.CancelInstrument(data, ISCANCEL);
 }
Exemple #9
0
 public int SaveInstrument(sp_MAS303_GetInstrument_Result data)
 {
     return(service.SaveInstrument(data));
 }
 public MAS303_InstrumentEntry(sp_MAS303_GetInstrument_Result data)
 {
     InitializeComponent();
     InstrumentResult = data;
 }