public static BillTemp getChitiettemp(string mahd) { string MaKH = ""; string IDSanPham = ""; string TenSP = ""; MySqlConnection con = new MySqlConnection(DBconfigs.ConnectionString); con.Open(); string query = $"Select * From `chitiethd` where MAHD ='{mahd}'"; MySqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = query; MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { MaKH = reader.GetString(1); IDSanPham = reader.GetString(2); TenSP = reader.GetString(3); } BillTemp temp = new BillTemp(MaKH, IDSanPham, TenSP); return(temp); }
public UpdateBills(string mahd, string tenkhach, string ngaymua, string tongtien, string tinhtrang) { InitializeComponent(); MaHD = mahd; BillTemp temp = Controller.getChitiettemp(mahd); ID_Khach = temp._makh; ID_SanPham = temp._idsanpham; tbtenkh.Text = tenkhach; tbtengame.Text = temp._tengame; tbgia.Text = tongtien.Remove(tongtien.IndexOf('$')); DateTime dt = DateTime.ParseExact(ngaymua, "dd/MM/yyyy", null); tbngay.Text = dt.Day.ToString(); tbthang.Text = dt.Month.ToString(); tbnam.Text = dt.Year.ToString(); dsAll = Controller.getKhach2(); dsGame = Controller.getGames(); if (tinhtrang == "3") { tbtenkh.Enabled = false; tbtengame.Enabled = false; tbgia.Enabled = false; tbngay.Enabled = false; tbthang.Enabled = false; tbnam.Enabled = false; btnLogin.Enabled = false; noFocusButton1.Enabled = false; } }