Пример #1
0
        public void Xoanguyenlieu(string manl)
        {
            KhoNguyenLieu kho = qlcf.KhoNguyenLieus.Where(t => t.MaNguyenLieu == manl).FirstOrDefault();

            qlcf.KhoNguyenLieus.DeleteOnSubmit(kho);
            qlcf.SubmitChanges();
        }
Пример #2
0
        public bool kiemtrakhoachinh(string manl)
        {
            KhoNguyenLieu kho = qlcf.KhoNguyenLieus.Where(t => t.MaNguyenLieu == manl).FirstOrDefault();

            if (kho == null)
            {
                return(true);
            }
            return(false);
        }
Пример #3
0
        public void CapNhatnguyenlieu(string manl, string ten, string soluong, string dongia, string dvt, DateTime ngaynhap)
        {
            KhoNguyenLieu kho = qlcf.KhoNguyenLieus.Where(t => t.MaNguyenLieu == manl).FirstOrDefault();

            kho.TenNguyenLieu = ten;
            kho.SoLuong       = int.Parse(soluong);
            kho.DVT           = dvt;
            kho.DonGia        = Convert.ToDecimal(dongia);
            kho.NgayNhap      = ngaynhap;
            qlcf.SubmitChanges();
        }
Пример #4
0
        public void Themnguyenlieu(string manl, string ten, string soluong, string dongia, string dvt, DateTime ngaynhap)
        {
            KhoNguyenLieu kho = new KhoNguyenLieu();

            kho.MaNguyenLieu  = manl;
            kho.TenNguyenLieu = ten;
            kho.SoLuong       = int.Parse(soluong);
            kho.DVT           = dvt;

            kho.DonGia   = Convert.ToDecimal(dongia);
            kho.NgayNhap = ngaynhap;

            qlcf.KhoNguyenLieus.InsertOnSubmit(kho);
            qlcf.SubmitChanges();
        }
Пример #5
0
        public void CapNhatLaiKho(int maban)
        {
            //lay ma mon theo maban
            var mmon = (from m in qlThucDon.Menus join n in qlThucDon.NhomNguyenLieus on m.MaMon equals n.MaMon
                        join ds in qlThucDon.DanhSachMonGois on m.MaMon equals ds.MaMon
                        where ds.MaBan == maban
                        select n.MaMon).FirstOrDefault();



            var nguyenlieus = (from k in qlThucDon.KhoNguyenLieus
                               join n1 in qlThucDon.NhomNguyenLieus
                               on k.MaNguyenLieu equals n1.MaNguyenLieu
                               where n1.MaMon == mmon
                               select k.MaNguyenLieu).ToList();

            string nl = nguyenlieus.ToString();

            for (int i = 0; i < nguyenlieus.Count; i++)
            {
                var kho = (from k in qlThucDon.KhoNguyenLieus where k.MaNguyenLieu == nguyenlieus[i] select k).ToList();
                foreach (KhoNguyenLieu k in kho)
                {
                    KhoNguyenLieu hihi = qlThucDon.KhoNguyenLieus.Where(t => t.MaNguyenLieu == k.MaNguyenLieu).FirstOrDefault();
                    if (hihi != null)
                    {
                        hihi.SoLuong = hihi.SoLuong - laySoLuongGiamTru(maban);
                    }
                }
            }


            //KhoNguyenLieu hihi = qlThucDon.KhoNguyenLieus.Where(t => t.MaNguyenLieu == khi.MaNguyenLieu).FirstOrDefault();
            //if(hihi!= null)
            //{
            //    hihi.SoLuong = hihi.SoLuong - laySoLuongGiamTru(maban);
            //}
            qlThucDon.SubmitChanges();
        }