Пример #1
0
 public void DeleteBC(DTO_BaoCaoTonKho obj)
 {
     using (CellphoneComponentEntities db = new CellphoneComponentEntities())
     {
         BaoCaoTonKho bc = (from item in db.BaoCaoTonKhoes
                            where item.MaBaoCao == obj.MaBaoCao
                            select item).SingleOrDefault();
         db.BaoCaoTonKhoes.Remove(bc);
         db.SaveChanges();
     }
 }
Пример #2
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Bạn có muốn xóa dòng này?", "Confirmation", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                if (dgvStockReport.SelectedItem != null)
                {
                    DTO_BaoCaoTonKho obj = dgvStockReport.SelectedItem as DTO_BaoCaoTonKho;
                    BUS_BaoCaoTonKho.Instance.Delete(obj);
                    dgvStockReport.ItemsSource = BUS_BaoCaoTonKho.showData();
                }
            }
        }
Пример #3
0
        public void InsertBC(DTO_BaoCaoTonKho obj)
        {
            using (CellphoneComponentEntities db = new CellphoneComponentEntities())
            {
                var result = db.Database
                             .SqlQuery <String>("select MaHangHoa from dbo.HangHoa where TenHangHoa = N'" + obj.TenHangHoa + "'")
                             .FirstOrDefault();
                BaoCaoTonKho bc = new BaoCaoTonKho();
                bc.MaBaoCao       = obj.MaBaoCao;
                bc.MaHangHoa      = result;
                bc.Nam            = obj.Nam;
                bc.Thang          = obj.Thang;
                bc.SoLuongNhap    = obj.SoLuongNhap;
                bc.SoLuongXuat    = obj.SoLuongXuat;
                bc.SoLuongTonDau  = obj.SoLuongTonDau;
                bc.SoLuongTonCuoi = obj.SoLuongTonCuoi;

                db.BaoCaoTonKhoes.Add(bc);
                db.SaveChanges();
            }
        }
Пример #4
0
        public UI_ThemBaoCaoTK(Grid gridReport, DTO_BaoCaoTonKho obj)
        {
            InitializeComponent();
            this.gridReport = gridReport;

            List <int> month = new List <int>();

            for (int i = 1; i <= 12; i++)
            {
                month.Add(i);
            }

            List <int> year = new List <int>()
            {
                2015, 2016, 2017, 2018, 2019, 2020
            };

            cbbReportMonth.ItemsSource = month;
            cbbReportYear.ItemsSource  = year;
            cbbGoodsName.ItemsSource   = BUS_BaoCaoTonKho.showGoods();
            if (obj == null)
            {
                AutoGenerateID();
                isNew = true;
            }
            else
            {
                txtReportID.Text    = obj.MaBaoCao;
                txtLastMount.Text   = obj.SoLuongTonCuoi.ToString();
                cbbGoodsName.Text   = obj.TenHangHoa;
                txtFirstMount.Text  = obj.SoLuongTonDau.ToString();
                txtImportMount.Text = obj.SoLuongNhap.ToString();
                txtExportMount.Text = obj.SoLuongXuat.ToString();
                cbbReportMonth.Text = obj.Thang.ToString();
                cbbReportYear.Text  = obj.Nam.ToString();
                isNew = false;
            }
        }
Пример #5
0
 public void Delete(DTO_BaoCaoTonKho obj)
 {
     BaoCaoTonKho.Instance.DeleteBC(obj);
 }
Пример #6
0
 public void Insert(DTO_BaoCaoTonKho obj)
 {
     BaoCaoTonKho.Instance.InsertBC(obj);
 }