private void GiamThoiGian() { string s_ID = this.s_MaBN; if (this.s_MaBN.Length < 2) { s_ID = "0" + this.s_MaBN; } string s_ModeTangGiam = "0"; //Giảm string str = "#TIME," + s_ID + "," + s_ModeTangGiam + "," + i_TGConLai.ToString() + ",*"; if (i_TGConLai > 0) { byte[] data = System.Text.Encoding.UTF8.GetBytes(str); TienIch.ComPort.serialPort_Send(data, 0, data.Length); i_TongTG -= i_TGConLai; if (i_TongTG < 0) { i_TongTG = 0; } DsBanNang ds = new DsBanNang(); ds.UpdateThoiGianSuaChua(this.conn, this.s_MaBN, Convert.ToInt16(i_TongTG)); } }
private void ChinhThoiGian(bool b_Tang) { string s_ID = s_IDBanNang; if (s_IDBanNang.Length < 2) { s_ID = "0" + s_IDBanNang; } int i_TGPhatSinh = Convert.ToInt32(txtThoiGianThayDoi.Text.ToString()); string s_TGPhatSinh = i_TGPhatSinh.ToString(); string s_ModeTangGiam = b_Tang == true ? "1" : "0"; string str = "#TIME," + s_ID + "," + s_ModeTangGiam + "," + s_TGPhatSinh + ",*"; if (i_TGPhatSinh > 0) { byte[] data = System.Text.Encoding.UTF8.GetBytes(str); TienIch.ComPort.serialPort_Send(data, 0, data.Length); if (b_Tang) { i_TongTG += i_TGPhatSinh; } else { i_TongTG -= i_TGPhatSinh; if (i_TongTG < 0) { i_TongTG = 0; } } DsBanNang ds = new DsBanNang(); ds.UpdateThoiGianSuaChua(this.conn, this.s_IDBanNang, Convert.ToInt16(i_TongTG)); } }