Esempio n. 1
0
        public virtual void Delete(int id)
        {
            var p = new SqlParameter[]
            {
                new SqlParameter("id", id),
                new SqlParameter("id_name", Table.ToLower().Replace("tb", "") + "_id"),
                new SqlParameter("table", Table)
            };

            HelperDAO.RunProc("spDelete", p);
        }
Esempio n. 2
0
        public virtual List <T> List()
        {
            var p = new SqlParameter[]
            {
                new SqlParameter("table", Table),
                new SqlParameter("order", "1")
            };

            var      table = HelperDAO.RunProcSelect("spList", p);
            List <T> list  = new List <T>();

            foreach (DataRow register in table.Rows)
            {
                list.Add(MountModel(register));
            }

            return(list);
        }
Esempio n. 3
0
        public List <TeamViewModel> ListUserTeams(int users_id)
        {
            List <TeamViewModel> list = new List <TeamViewModel>();

            var parameter = new SqlParameter[]
            {
                new SqlParameter("users_id", users_id)
            };

            DataTable table = HelperDAO.RunProcSelect("spListUserTeams", parameter);

            //return table;
            foreach (DataRow register in table.Rows)
            {
                list.Add(MountModel(register));
            }
            return(list);
        }
Esempio n. 4
0
        public List <UsersViewModel> ListProjectMembers(int project_id)
        {
            List <UsersViewModel> list = new List <UsersViewModel>();

            var parameter = new SqlParameter[]
            {
                new SqlParameter("project_id", project_id)
            };

            DataTable table = HelperDAO.RunProcSelect("spListProjectMembers", parameter);

            //return table;
            foreach (DataRow register in table.Rows)
            {
                list.Add(MountModel(register));
            }
            return(list);
        }
Esempio n. 5
0
        public virtual bool Login(string user, string password)
        {
            var p = new SqlParameter[]
            {
                new SqlParameter("user", "''" + user + "''"),
                new SqlParameter("password", "''" + password + "''")
            };

            var table = HelperDAO.RunProcSelect("spLogin", p);

            if (table.Rows.Count == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Esempio n. 6
0
        public virtual T Query(int id)
        {
            var p = new SqlParameter[]
            {
                new SqlParameter("id", id),
                new SqlParameter("id_name", Table.ToLower().Replace("tb", "") + "_id"),
                new SqlParameter("table", Table)
            };

            var table = HelperDAO.RunProcSelect("spQuery", p);

            if (table.Rows.Count == 0)
            {
                return(null);
            }
            else
            {
                return(MountModel(table.Rows[0]));
            }
        }
Esempio n. 7
0
 public virtual void Update(T model)
 {
     HelperDAO.RunProc("spUpdate_" + Table, UpdateParams(model));
 }
Esempio n. 8
0
 public virtual void Insert(T model)
 {
     HelperDAO.RunProc("spInsert_" + Table, CreateParams(model));
 }