public int UpdatetDatHang(int mode, VDatHang_DTO dh, DataTable ChiTiet) { String store = "SPoV_UpdateDatHang"; CreateCommand_StoreName(store); cm.Parameters.Add("@Flag", SqlDbType.Int).Direction = ParameterDirection.Output; cm.Parameters.Add("@MaHoaDon", SqlDbType.Int); cm.Parameters.Add("@MaNCC", SqlDbType.Int); cm.Parameters.Add("@MaNH", SqlDbType.NChar); cm.Parameters.Add("@TongTien", SqlDbType.Float); cm.Parameters.Add("@ThoiGianDat", SqlDbType.DateTime); cm.Parameters.Add("@ThoiGianGiao", SqlDbType.DateTime); cm.Parameters.Add("@TinhTrang", SqlDbType.NVarChar); cm.Parameters.Add("@ChiTiet", SqlDbType.Structured); cm.Parameters["@MaHoaDon"].Value = dh.MaHoaDon; cm.Parameters["@MaNCC"].Value = dh.MaNCC; cm.Parameters["@MaNH"].Value = dh.MaNH; cm.Parameters["@TongTien"].Value = dh.TongTien; cm.Parameters["@ThoiGianDat"].Value = dh.ThoiGianDat; cm.Parameters["@ThoiGianGiao"].Value = dh.ThoiGianGiao; cm.Parameters["@TinhTrang"].Value = dh.TinhTrang; cm.Parameters["@ChiTiet"].Value = ChiTiet; ExecuteInsertUpdateDelete(); return (int)cm.Parameters["@Flag"].Value; }
public frmDatHang() { InitializeComponent(); busNhaCungCap = new VNhaCungCap_BUS(); busNguyenLieu = new VNguyenLieu_BUS(); ttdh = new VDatHang_DTO(); dtNguyenLieu_Source = new DataTable(); dtChiTietDatHang_Source = new DataTable(); dtChiTietDatHang_Source.Columns.Add("STT", System.Type.GetType("System.Int16")); dtChiTietDatHang_Source.Columns.Add("MaHoaDon", System.Type.GetType("System.Int16")); dtChiTietDatHang_Source.Columns.Add("MaNL", System.Type.GetType("System.Int16")); dtChiTietDatHang_Source.Columns.Add("SoLuong", System.Type.GetType("System.Int16")); dtChiTietDatHang_Source.Columns.Add("ThanhTien", System.Type.GetType("System.Double")); dtChiTietDatHang_Source.Columns.Add("TenNL", System.Type.GetType("System.String")); dtChiTietDatHang_Source.Columns.Add("DonVi", System.Type.GetType("System.String")); dtChiTietDatHang = new DataTable(); dtChiTietDatHang.Columns.Add("MaHoaDon", System.Type.GetType("System.Int16")); dtChiTietDatHang.Columns.Add("MaNL", System.Type.GetType("System.Int32")); dtChiTietDatHang.Columns.Add("SoLuong", System.Type.GetType("System.Int16")); dtChiTietDatHang.Columns.Add("ThanhTien", System.Type.GetType("System.Double")); gridDSDatHang.DataSource = dtChiTietDatHang; txtTongTien.Text = "0"; dateThoiGianGiao.DateTime = DateTime.Now; }
private List<VDatHang_DTO> ConvertToList(DataTable dt) { List<VDatHang_DTO> ls = new List<VDatHang_DTO>(); foreach (DataRow row in dt.Rows) { VDatHang_DTO ttdh = new VDatHang_DTO(); ttdh.MaHoaDon = (int)row.ItemArray[0]; ttdh.MaNCC = (int)row.ItemArray[1]; ttdh.MaNH = row.ItemArray[2].ToString(); ttdh.TongTien = (double)row.ItemArray[3]; try { ttdh.ThoiGianDat = DateTime.Parse(row.ItemArray[4].ToString()); } catch (Exception) { ttdh.ThoiGianDat = new DateTime(); } try { ttdh.ThoiGianGiao = DateTime.Parse(row.ItemArray[5].ToString()); } catch (Exception) { ttdh.ThoiGianGiao = new DateTime(); } ttdh.TinhTrang = row.ItemArray[6].ToString(); ttdh.TenNCC = row.ItemArray[7].ToString(); ls.Add(ttdh); } return ls; }
public int UpdateDatHang(int mode, VDatHang_DTO dh, DataTable chitiet) { return daoDatHang.UpdatetDatHang(mode, dh, chitiet); }
public int InsertDatHang(int mode, VDatHang_DTO dh, DataTable chitiet) { return daoDatHang.InsertDatHang(mode, dh, chitiet); }