Exemplo n.º 1
0
        public UsersGroupsRel Get(string name)
        {
            try
            {
                Func <UsersGroupsRel> func = new Func <UsersGroupsRel>(() =>
                {
                    using (var db = new Dashboard1Entities())
                    {
                        return(db.UsersGroupsRel.Where(e => e.stat_void == 0).FirstOrDefault());
                    }
                });

                return(_adapter.Catch <UsersGroupsRel>(func));
            }
            catch (Exception ex)
            {
                throw new Exception($"UsersGroupsRel Get fail:{ex.Message}");
            }
        }
Exemplo n.º 2
0
        public IEnumerable <zp_get_not_exists_group_Result> GetHiddenClass(string empno)
        {
            try
            {
                Func <IEnumerable <zp_get_not_exists_group_Result> > func = new Func <IEnumerable <zp_get_not_exists_group_Result> >(() =>
                {
                    using (var db = new Dashboard1Entities())
                    {
                        return(db.zp_get_not_exists_group(empno).ToList());
                    }
                });

                return(_adapter.Catch <IEnumerable <zp_get_not_exists_group_Result> >(func));
            }
            catch (Exception ex)
            {
                throw new Exception($"ExtentRepository GetHiddenClass fail:{ex.Message}");
            }
        }
Exemplo n.º 3
0
        public Group Get(string name)
        {
            try
            {
                Func <Group> func = new Func <Group>(() =>
                {
                    using (var db = new Dashboard1Entities())
                    {
                        return(db.Group.Where(e => e.stat_void == 0).FirstOrDefault());
                    }
                });

                return(_adapter.Catch <Group>(func));
            }
            catch (Exception ex)
            {
                throw new Exception($"GroupRelRepositry Get fail:{ex.Message}");
            }
        }
Exemplo n.º 4
0
        public IEnumerable <UsersGroupsRel> GetAll()
        {
            try
            {
                Func <IEnumerable <UsersGroupsRel> > func = new Func <IEnumerable <UsersGroupsRel> >(() =>
                {
                    using (var db = new Dashboard1Entities())
                    {
                        return(db.UsersGroupsRel.Where(e =>
                                                       e.stat_void == 0).ToList());
                    }
                });

                return(_adapter.Catch <IEnumerable <UsersGroupsRel> >(func));
            }
            catch (Exception ex)
            {
                throw new Exception($"UsersGroupsRel GetAll fail:{ex.Message}");
            }
        }
Exemplo n.º 5
0
        public Item Get(string name)
        {
            try
            {
                Func <Item> func = new Func <Item>(() =>
                {
                    using (var db = new Dashboard1Entities())
                    {
                        return(db.Item.Where(e => e.item_name == name &&
                                             e.stat_void == 0).FirstOrDefault());
                    }
                });

                return(_adapter.Catch <Item>(func));
            }
            catch (Exception ex)
            {
                throw new Exception($"ItemRepositry Get fail:{ex.Message}");
            }
        }
Exemplo n.º 6
0
        public TabTemplate Get(string name)
        {
            try
            {
                Func <TabTemplate> func = new Func <TabTemplate>(() =>
                {
                    using (var db = new Dashboard1Entities())
                    {
                        return(db.TabTemplate.Where(e => e.tab_name == name &&
                                                    e.stat_void == 0).FirstOrDefault());
                    }
                });

                return(_adapter.Catch <TabTemplate>(func));
            }
            catch (Exception ex)
            {
                throw new Exception($"TabTemplate Get fail:{ex.Message}");
            }
        }
Exemplo n.º 7
0
        public bool Insert(UsersGroupsRel t)
        {
            try
            {
                Func <bool> func = new Func <bool>(() =>
                {
                    using (var db = new Dashboard1Entities())
                    {
                        t.stat_void       = 0;
                        db.Entry(t).State = System.Data.Entity.EntityState.Added;
                        db.SaveChanges();
                        return(true);
                    }
                });

                return(_adapter.Catch <bool>(func));
            }
            catch (Exception ex)
            {
                throw new Exception($"UsersGroupsRel Insert fail:{ex.Message}");
            }
        }
Exemplo n.º 8
0
        public bool Delete(TabTemplate t)
        {
            try
            {
                Func <bool> func = new Func <bool>(() =>
                {
                    using (var db = new Dashboard1Entities())
                    {
                        t.stat_void       = 1;
                        db.Entry(t).State = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();
                        return(true);
                    }
                });

                return(_adapter.Catch <bool>(func));
            }
            catch (Exception ex)
            {
                throw new Exception($"TabTemplate Del fail:{ex.Message}");
            }
        }
Exemplo n.º 9
0
        public bool Insert(Item t)
        {
            try
            {
                Func <bool> func = new Func <bool>(() =>
                {
                    using (var db = new Dashboard1Entities())
                    {
                        t.stat_void       = 0;
                        t.dt_create       = DateTime.Now;
                        db.Entry(t).State = System.Data.Entity.EntityState.Added;
                        db.SaveChanges();
                        return(true);
                    }
                });

                return(_adapter.Catch <bool>(func));
            }
            catch (Exception ex)
            {
                throw new Exception($"ItemRepositry GetAll fail:{ex.Message}");
            }
        }
Exemplo n.º 10
0
        public bool Update(Group t)
        {
            try
            {
                Func <bool> func = new Func <bool>(() =>
                {
                    using (var db = new Dashboard1Entities())
                    {
                        t.stat_void = 0;

                        db.Entry(t).State = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();
                        return(true);
                    }
                });

                return(_adapter.Catch <bool>(func));
            }
            catch (Exception ex)
            {
                throw new Exception($"GroupRepositry Update fail:{ex.Message}");
            }
        }