Exemplo n.º 1
0
        public bool tinhTongGiaNhap(string matailieu)
        {
            QLTVDataContext qltv       = new QLTVDataContext();
            string          tongiatien = (qltv.QL_ChiTietTaiLieus.Where(a => a.MaTaiLieu == matailieu).Sum(d => d.GiaNhap)).ToString();
            QL_TaiLieu      edit       = qltv.QL_TaiLieus.Where(d => d.MaTaiLieu.Equals(matailieu)).SingleOrDefault();

            edit.TongGiaTien = tongiatien;
            qltv.SubmitChanges();
            return(true);
        }
Exemplo n.º 2
0
        public bool tinhTongSoLuongTL(string matailieu)
        {
            QLTVDataContext qltv        = new QLTVDataContext();
            string          tongsoluong = (qltv.QL_ChiTietTaiLieus.Where(a => a.MaTaiLieu == matailieu).Sum(d => d.SoLuong)).ToString();
            QL_TaiLieu      edit        = qltv.QL_TaiLieus.Where(d => d.MaTaiLieu.Equals(matailieu)).SingleOrDefault();

            edit.TongSoLuong = tongsoluong;
            qltv.SubmitChanges();
            return(true);
        }
Exemplo n.º 3
0
 public bool xoatailieu(string matailieu)
 {
     try
     {
         QLTVDataContext qltv   = new QLTVDataContext();
         QL_TaiLieu      delete = qltv.QL_TaiLieus.Where(p => p.MaTaiLieu.Equals(matailieu)).SingleOrDefault();
         qltv.QL_TaiLieus.DeleteOnSubmit(delete);
         qltv.SubmitChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Exemplo n.º 4
0
        public bool suatailieu(string matailieu, string tentheloai)
        {
            QLTVDataContext qltv = new QLTVDataContext();

            try
            {
                QL_TaiLieu edit = qltv.QL_TaiLieus.Where(p => p.MaTaiLieu.Equals(matailieu)).SingleOrDefault();

                edit.TenTaiLieu = tentheloai;
                qltv.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemplo n.º 5
0
        public bool themtailieu(string matailieu, string tentheloai, string tongsoluong, string nguoinhap, string ngaynhap, string tonggiatien)
        {
            try
            {
                QLTVDataContext qltv   = new QLTVDataContext();
                QL_TaiLieu      insert = new QL_TaiLieu();

                insert.MaTaiLieu   = matailieu;
                insert.TenTaiLieu  = tentheloai;
                insert.TongSoLuong = tongsoluong;
                insert.TongGiaTien = tonggiatien;
                insert.NgayNhap    = DateTime.Parse(ngaynhap);
                insert.NguoiNhap   = nguoinhap;
                insert.TongGiaTien = tonggiatien;
                qltv.QL_TaiLieus.InsertOnSubmit(insert);
                qltv.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }