private void btnDongY_Click(object sender, EventArgs e) { string s_ComPort = txtCongCOM.Text.Trim(); string s_TenCTY = txtTenCTY.Text; string s_CauChao = txtCauChao.Text; int i_ThoiGian = Convert.ToInt32(txtThoiGianTBTX.Text); TienIch.tshethong ts = new TienIch.tshethong(); ts.Update(conn, s_ComPort, s_TenCTY, s_CauChao, i_ThoiGian); this.Close(); }
private void frmThongSo_Load(object sender, EventArgs e) { btnDongY.LinkClicked += btnDongY_LinkClicked; if (conn != null && conn.State == ConnectionState.Open) { TienIch.tshethong ts = new TienIch.tshethong(); DataTable dt = ts.LoadAll(conn); if (dt != null && dt.Rows.Count > 0) { DataRow r = dt.Rows[0]; txtCongCOM.Text = r["congcom"].ToString(); txtTenCTY.Text = r["tencty"].ToString(); txtCauChao.Text = r["thongbaomacdinh"].ToString(); } } var ports = SerialPort.GetPortNames(); string[] biensoxeSource = ports.ToArray(); if (biensoxeSource != null && biensoxeSource.Length > 0) { AutoCompleteStringCollection collection = new AutoCompleteStringCollection(); collection.AddRange(biensoxeSource); txtCongCOM.MaskBox.AutoCompleteCustomSource = collection; txtCongCOM.MaskBox.AutoCompleteSource = AutoCompleteSource.CustomSource; txtCongCOM.MaskBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend; } if (txtTenCTY.Text == "") { txtTenCTY.Text = "Công ty Cổ phần Công nghệ Tiện ích Thông minh"; } if (txtCauChao.Text == "") { txtCauChao.Text = "Kính chào quý khách"; } }