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); }
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); }
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); }
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); }
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); } }
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])); } }
public virtual void Update(T model) { HelperDAO.RunProc("spUpdate_" + Table, UpdateParams(model)); }
public virtual void Insert(T model) { HelperDAO.RunProc("spInsert_" + Table, CreateParams(model)); }