public void addDataRow(DienThoai s) { DTDT.Rows.Add(new object[] { s.MaDT, s.TenDT, s.MaHang, s.NSX, s.Gia }); }
public DienThoai GetDienThoai(DataRow i) { DienThoai s = new DienThoai(); s.MaDT = Convert.ToInt32(i["MaDT"]); s.TenDT = i["TenDT"].ToString(); s.MaHang = Convert.ToInt32(i["MaHang"]); s.Gia = Convert.ToDouble(i["Gia"].ToString()); s.NSX = Convert.ToDateTime(i["NSX"].ToString()); return(s); }
public void editDataRow(DienThoai s) { foreach (DataRow i in DTDT.Rows) { if ((Convert.ToInt32(i["MaDT"])) == s.MaDT) { i["TenDT"] = s.TenDT; i["NSX"] = s.NSX; i["MaHang"] = s.MaHang; i["Gia"] = s.Gia; } } }
public void setGui() { DateTime date = new DateTime(2000, 1, 1); if (CSDL_OOP.Instance.getDienThoai_ByMaDT(MaDT) != null) { DienThoai s = CSDL_OOP.Instance.getDienThoai_ByMaDT(MaDT); textBoxMaDT.Text = s.MaDT.ToString(); textBoxGia.Text = s.Gia.ToString(); textBoxTenDT.Text = s.TenDT; comboBoxHangDT.Text = CSDL_OOP.Instance.getHangDT_ByMa(s.MaHang).TenHang; } }
public DienThoai getDienThoai_ByMaDT(int MaDT) { DienThoai s = new DienThoai(); foreach (DienThoai i in GetAllDienThoai()) { if (i.MaDT == MaDT) { s = i; } } return(s); }
private DienThoai getData_ByGui() { DienThoai s = new DienThoai(); s.MaDT = Convert.ToInt32(textBoxMaDT.Text); s.TenDT = textBoxTenDT.Text; DateTime si = dateTimePickerNSX.Value; s.NSX = si.Date; s.MaHang = ((CBBItem)comboBoxHangDT.SelectedItem).Value; s.Gia = Convert.ToDouble(textBoxGia.Text); return(s); }
public void sorted(DienThoai[] list, sort cmp) { for (int i = 0; i < list.Length - 1; i++) { for (int j = i + 1; j < list.Length; j++) { if (cmp(list[i], list[j])) { DienThoai t = list[i]; list[i] = list[j]; list[j] = t; } } } }
public void ExecuteData(DienThoai i) { bool check = false; foreach (DienThoai r in GetAllDienThoai()) { if (i.MaDT == r.MaDT) { check = true; } } if (check == true) { CSDL.Instance.editDataRow(i); } else { CSDL.Instance.addDataRow(i); } }