示例#1
0
        public static bool Delete(BanHangChiTiet data)
        {
            try
            {
                if (data != null)
                {
                    BanHangChiTiet objDb = GetById(data.Id);

                    if (objDb != null)
                    {
                        dbContext.BanHangChiTiets.DeleteOnSubmit(objDb);

                        return true;
                    }
                }
            }
            catch
            {

            }

            CreateSQlConnection();

            return false;
        }
示例#2
0
		private void detach_BanHangChiTiets(BanHangChiTiet entity)
		{
			this.SendPropertyChanging();
			entity.BanHang = null;
		}
示例#3
0
		private void attach_BanHangChiTiets(BanHangChiTiet entity)
		{
			this.SendPropertyChanging();
			entity.BanHang = this;
		}
示例#4
0
 partial void DeleteBanHangChiTiet(BanHangChiTiet instance);
示例#5
0
 partial void UpdateBanHangChiTiet(BanHangChiTiet instance);
示例#6
0
 partial void InsertBanHangChiTiet(BanHangChiTiet instance);
示例#7
0
 public static bool Update(BanHangChiTiet data)
 {
     return BanHangChiTietDao.Update(data);
 }
示例#8
0
 public static bool Insert(BanHangChiTiet data)
 {
     return BanHangChiTietDao.Insert(data);
 }
示例#9
0
 public static bool Delete(BanHangChiTiet data)
 {
     return BanHangChiTietDao.Delete(data);
 }
示例#10
0
        private bool InsertDataBanHangChiTiet(DTO.BanHang dataBanHang)
        {
            for (int i = 0; i < dgvThongTin.Rows.Count - 1; i++)
            //foreach (DataGridViewRow row in dgvThongTin.Rows)
            {
                DTO.BanHangChiTiet data = new DTO.BanHangChiTiet();
                data.IdBanHang = dataBanHang.Id;
                data.IdSanPham = ConvertUtil.ConvertToInt(dgvThongTin[colIdSanPham.Name, i].Value);
                data.TonDau = ConvertUtil.ConvertToInt(dgvThongTin[colTonDau.Name, i].Value);
                data.ThuHoiNgayTruoc = ConvertUtil.ConvertToInt(dgvThongTin[colThuHoiNgayTruoc.Name, i].Value);
                data.Nhan = ConvertUtil.ConvertToInt(dgvThongTin[colNhan.Name, i].Value);
                data.Ban = ConvertUtil.ConvertToInt(dgvThongTin[colBan.Name, i].Value);
                data.TonCuoi = ConvertUtil.ConvertToInt(dgvThongTin[colTonCuoi.Name, i].Value);
                data.Gia = ConvertUtil.ConvertToInt(dgvThongTin[colGia.Name, i].Value.ToString().Replace(Constant.SYMBOL_LINK_MONEY, string.Empty));
                data.ThanhTien = ConvertUtil.ConvertToInt(dgvThongTin[colThanhTien.Name, i].Value.ToString().Replace(Constant.SYMBOL_LINK_MONEY, string.Empty));
                data.ThuHoi = ConvertUtil.ConvertToInt(dgvThongTin[colThuHoi.Name, i].Value);
                data.DiemMoi = ConvertUtil.ConvertToInt(dgvThongTin[colDiemMoi.Name, i].Value);
                data.LuotBan = ConvertUtil.ConvertToInt(dgvThongTin[colLuotBan.Name, i].Value);

                if (!BanHangChiTietBus.Insert(data))
                {
                    return false;
                }
                else
                {
                    dgvThongTin[colId.Name, i].Value = data.Id;
                }
            }

            return true;
        }
示例#11
0
        private bool UpdateDataBanHangChiTiet(DTO.BanHang dataBanHang)
        {
            foreach (DataGridViewRow row in dgvThongTin.Rows)
            {
                if (!string.IsNullOrEmpty(row.Cells[colId.Name].Value.ToString()))
                {
                    DTO.BanHangChiTiet data = BanHangChiTietBus.GetById(ConvertUtil.ConvertToInt(row.Cells[colId.Name].Value));
                    data.Ban = ConvertUtil.ConvertToInt(row.Cells[colBan.Name].Value);
                    data.ThuHoi = ConvertUtil.ConvertToInt(row.Cells[colThuHoi.Name].Value);
                    data.ThanhTien = ConvertUtil.ConvertToInt(row.Cells[colThanhTien.Name].Value.ToString().Replace(Constant.SYMBOL_LINK_MONEY, string.Empty));

                    if (!BanHangChiTietBus.Update(data))
                    {
                        return false;
                    }
                }
                else
                {
                    DTO.BanHangChiTiet data = new DTO.BanHangChiTiet();

                    data.IdBanHang = dataBanHang.Id;
                    data.IdSanPham = ConvertUtil.ConvertToInt(row.Cells[colIdSanPham.Name].Value);
                    data.Gia = ConvertUtil.ConvertToInt(row.Cells[colGia.Name].Value.ToString().Replace(Constant.SYMBOL_LINK_MONEY, string.Empty));
                    data.Ban = ConvertUtil.ConvertToInt(row.Cells[colBan.Name].Value);
                    data.ThuHoi = ConvertUtil.ConvertToInt(row.Cells[colThuHoi.Name].Value);
                    data.ThanhTien = ConvertUtil.ConvertToInt(row.Cells[colThanhTien.Name].Value.ToString().Replace(Constant.SYMBOL_LINK_MONEY, string.Empty));

                    if (!BanHangChiTietBus.Insert(data))
                    {
                        return false;
                    }
                }
            }

            return true;
        }
示例#12
0
        public static bool Update(BanHangChiTiet data)
        {
            try
            {
                if (data != null)
                {
                    dbContext.SubmitChanges();
                    return true;
                }

                return false;
            }
            catch
            {
                return false;
            }
        }
示例#13
0
        public static bool Insert(BanHangChiTiet data)
        {
            try
            {
                dbContext.BanHangChiTiets.InsertOnSubmit(data);
                dbContext.SubmitChanges();

                return true;
            }
            catch
            {
                return false;
            }
        }