protected void btnAdd_Click(object sender, EventArgs e)
    {
        List <t_LanguageTranslate> list = languageBL.FindAll(x => x.Language == language && x.Noted.Contains("/Supervisor/Device/All.aspx")).ToList();
        var empty_seri_meter            = list.Where(x => x.ControlId.Contains("empty_seri_meter")).FirstOrDefault();
        var meter_update_confirm        = list.Where(x => x.ControlId.Contains("meter_update_confirm")).FirstOrDefault();

        ntf.VisibleOnPageLoad = true;
        if (string.IsNullOrEmpty(cboSerials.Text))
        {
            ntf.Text = empty_seri_meter.Contents;
            cboSerials.Focus();
            return;
        }
        var meter   = GetControlValues();
        var dbMeter = _meterBL.GetMeter(cboSerials.Text);

        if (dbMeter == null)
        {
            _meterBL.InsertMeter(meter);
            SerialDataSource.DataBind();
            cboSerials.DataBind();
            ntf.Text = "Meter added";
        }
        else
        {
            _meterBL.UpdateMeter(meter, dbMeter);
            //ntf.Text = "Đã cập nhật dữ liệu đồng hồ.";
            ntf.Text = meter_update_confirm.Contents;
        }
    }
Esempio n. 2
0
 // Start is called before the first frame update
 void Start()
 {
     //Sets up both the fake data source and the real data from the ardiuno
     fakeSource       = new FakeDataSource("CLT Composite Beams Board1 2by10 Panel 1.ASC", 200);
     serialDataSource = new SerialDataSource("Com3", new string[] {
         "DASYLab - V 11.00.00",
         "Worksheet name: 6by10beamlayout",
         "Recording date: 7 / 1 / 2016,  4:52:39 PM",
         "Block length: 2",
         "Delta: 1.0 sec.",
         "Number of channels: 3",
         "Date;Measurement time[hh:mm:ss];voltage [V];voltage2 [V]; volage3 [V];"
     });
     MainCollection = new Parser(serialDataSource);
     MainCollection.start();
 }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        List <t_LanguageTranslate> list = languageBL.FindAll(x => x.Language == language && x.Noted.Contains("/Supervisor/Device/All.aspx")).ToList();
        var empty_seri_transmitter      = list.Where(x => x.ControlId.Contains("empty_seri_transmitter")).FirstOrDefault();
        var transmitter_update_confirm  = list.Where(x => x.ControlId.Contains("transmitter_update_confirm")).FirstOrDefault();


        ntf.VisibleOnPageLoad = true;
        if (string.IsNullOrEmpty(cboSerials.Text))
        {
            ntf.Text = empty_seri_transmitter.Contents;
            cboSerials.Focus();
            return;
        }
        var transmitter   = GetControlValues();
        var dbTransmitter = _transmitterBL.GetTransmitter(cboSerials.Text);

        if (dbTransmitter == null)
        {
            try
            {
                _transmitterBL.InsertTransmitter(transmitter);
                ntf.Text = "Đã thêm mới bộ hiển thị.";
                SerialDataSource.DataBind();
                cboSerials.DataBind();
            }
            catch (Exception ex)
            {
                ntf.Text = "Lỗi: " + ex.Message;
                //throw;
            }
        }
        else
        {
            try
            {
                _transmitterBL.UpdateTransmitter(transmitter, dbTransmitter);
                //ntf.Text = "Đã cập nhật bộ hiển thị.";
                ntf.Text = transmitter_update_confirm.Contents;
            }
            catch (Exception ex)
            {
                ntf.Text = "Lỗi: " + ex.Message;
                //throw;
            }
        }
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        List <t_LanguageTranslate> list = languageBL.FindAll(x => x.Language == language && x.Noted.Contains("/Supervisor/Device/All.aspx")).ToList();
        var empty_seri_meter            = list.Where(x => x.ControlId.Contains("empty_seri_meter")).FirstOrDefault();
        var meter_delete_confirm        = list.Where(x => x.ControlId.Contains("meter_delete_confirm")).FirstOrDefault();


        ntf.VisibleOnPageLoad = true;
        if (string.IsNullOrEmpty(cboSerials.Text))
        {
            ntf.Text = empty_seri_meter.Contents;
            cboSerials.Focus();
            return;
        }
        var meter = _meterBL.GetMeter(cboSerials.Text);

        if (meter != null)
        {
            try
            {
                _meterBL.DeleteMeter(meter);
                SetControlDefault();
                SerialDataSource.DataBind();
                cboSerials.DataBind();
                //ntf.Text = "Đã xóa đồng hồ.";
                ntf.Text = meter_delete_confirm.Contents;
            }
            catch (Exception ex)
            {
                ntf.Text = "Lỗi: " + ex.Message;
                //throw;
            }
        }
        else
        {
            ntf.Text = "Không tồn tại số seri đồng hồ đã nhập.";
        }
    }