Exemplo n.º 1
0
 public RPT_Menu GetData(int id)
 {
     using (ReportEntities db = new ReportEntities())
     {
         return(db.RPT_Menu.FirstOrDefault(p => p.ID == id));
     }
 }
Exemplo n.º 2
0
 public int Create(RPT_User data)
 {
     using (ReportEntities db = new ReportEntities())
     {
         db.RPT_User.Add(data);
         return(db.SaveChanges());
     }
 }
Exemplo n.º 3
0
 public RPT_User GetUser(string userAccount)
 {
     using (ReportEntities db = new ReportEntities())
     {
         var item = db.RPT_User.FirstOrDefault(p => p.UserAccount == userAccount);
         return(item);
     }
 }
Exemplo n.º 4
0
 public RPT_User GetData(int id)
 {
     using (ReportEntities db = new ReportEntities())
     {
         var item = db.RPT_User.FirstOrDefault(p => p.ID == id);
         return(item);
     }
 }
Exemplo n.º 5
0
 public IEnumerable <RPT_User> GetList(string txtSearch = "")
 {
     using (ReportEntities db = new ReportEntities())
     {
         var item = db.RPT_User.Where(p => txtSearch == "" || p.UserAccount.Contains(txtSearch) || p.UserName.Contains(txtSearch)).ToList();
         return(item);
     }
 }
Exemplo n.º 6
0
 public IEnumerable <RPT_Menu> GetList()
 {
     using (ReportEntities db = new ReportEntities())
     {
         var data = db.RPT_Menu.ToList();
         return(data);
     }
 }
Exemplo n.º 7
0
 public IEnumerable <RPT_User> GetList(string txtSearch, int PageNumber, int PageSize, out int total)
 {
     using (ReportEntities db = new ReportEntities())
     {
         var item = db.RPT_User.Where(p => txtSearch == "" || p.UserAccount.Contains(txtSearch) || p.UserName.Contains(txtSearch));
         total = item.Count();
         var data = item.OrderBy(p => p.UserAccount).Skip((PageNumber - 1) * PageSize).Take(PageSize);
         return(data.ToList());
     }
 }
Exemplo n.º 8
0
        public IEnumerable <RPT_Company> GetList(string txtSearch, int pageNumber, int pageSize, out int total)
        {
            using (ReportEntities db = new ReportEntities())
            {
                var data = db.RPT_Company.Where(p => txtSearch == "" || p.CompanyCode.Contains(txtSearch) || p.CompanyName.Contains(txtSearch) || p.CompanyAddress.Contains(txtSearch));
                total = data.Count();
                data  = data.OrderBy(p => p.ID).Skip((pageNumber - 1) * pageSize).Take(pageSize);

                return(data.ToList());
            }
        }
Exemplo n.º 9
0
 public int Delete(int id)
 {
     using (ReportEntities db = new ReportEntities())
     {
         var item = db.RPT_User.FirstOrDefault(p => p.ID == id);
         if (item != null)
         {
             db.RPT_User.Remove(item);
         }
         return(db.SaveChanges());
     }
 }
Exemplo n.º 10
0
 public int Delete(int id)
 {
     using (ReportEntities db = new ReportEntities())
     {
         var exsit = db.RPT_Menu.FirstOrDefault(p => p.ID == id);
         if (exsit != null)
         {
             db.RPT_Menu.Remove(exsit);
         }
         return(db.SaveChanges());
     }
 }
Exemplo n.º 11
0
 public int Update(RPT_Menu data)
 {
     using (ReportEntities db = new ReportEntities())
     {
         var exsit = db.RPT_Menu.FirstOrDefault(p => p.MenuID == data.MenuID);
         if (exsit != null)
         {
             int id = exsit.ID;
             exsit.CopyFrom(data);
             exsit.ID = id;
         }
         return(db.SaveChanges());
     }
 }
Exemplo n.º 12
0
        public int Update(RPT_User data)
        {
            using (ReportEntities db = new ReportEntities())
            {
                var item = db.RPT_User.FirstOrDefault(p => p.UserAccount == data.UserAccount);
                //item.UserName = data.UserName;
                //return db.SaveChanges();

                if (item != null)
                {
                    item.UserName = data.UserName;
                    item.IsActive = data.IsActive;
                    item.Password = data.Password;
                }

                return(db.SaveChanges());
            }
        }