public virtual IList <DanhMucItemData> GetDanhMucItemPaging(System.String whereCondition, System.Int32 pageSize, System.Int32 currentPage, System.String sortByColumns)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);

            dao.SetCommandText(SP_DANHMUCITEM_SELECT_PAGING, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[] {
                dao.CreateParameter("@WhereCondition", whereCondition),
                dao.CreateParameter("@PageSize", pageSize),
                dao.CreateParameter("@CurrentPage", currentPage),
                dao.CreateParameter("@SortByColumns", sortByColumns)
            });

            DataTable table = dao.ExecuteQuery();

            if (table != null && table.Rows.Count > 0)
            {
                IList <DanhMucItemData> list = new List <DanhMucItemData>(table.Rows.Count);
                foreach (DataRow row in table.Rows)
                {
                    list.Add(Convert(row));
                }

                return(list);
            }
            return(new List <DanhMucItemData>());
        }
 public virtual System.Int32 Add(DanhMucData obj)
 {
     JDataAccess dao = new JDataAccess(ConnectionString);
     dao.SetCommandText(SP_DANHMUC_INSERT, CommandType.StoredProcedure);
     dao.SetParameters(new IDataParameter[]{
         dao.CreateParameter("@MaLoaiDanhMuc", obj.MaLoaiDanhMuc),
         dao.CreateParameter("@TenLoaiDanhMuc", obj.TenLoaiDanhMuc),
         dao.CreateParameter("@ThuTu", obj.ThuTu),
         dao.CreateParameter("@System", obj.System)
     });
     return dao.SubmitChange();
 }
        public virtual System.Int32 Change(DanhMucData obj)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);

            dao.SetCommandText(SP_DANHMUC_UPDATE, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[] {
                dao.CreateParameter("@MaLoaiDanhMuc", obj.MaLoaiDanhMuc),
                dao.CreateParameter("@TenLoaiDanhMuc", obj.TenLoaiDanhMuc),
                dao.CreateParameter("@ThuTu", obj.ThuTu),
                dao.CreateParameter("@System", obj.System)
            });
            return(dao.SubmitChange());
        }
        public virtual System.Int32 Add(SysGroupData obj)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);
            dao.SetCommandText(SP_SYSGROUP_INSERT, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[]{
                dao.CreateParameter("@ID", obj.ID),
                dao.CreateParameter("@ID_Creator", obj.ID_Creator),
                dao.CreateParameter("@Name", obj.Name),
                dao.CreateParameter("@Description", obj.Description),
                dao.CreateParameter("@Active", obj.Active)

            });
            return dao.SubmitChange();
        }
        public virtual System.Int32 Change(SysGroupData obj)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);

            dao.SetCommandText(SP_SYSGROUP_UPDATE, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[] {
                dao.CreateParameter("@ID", obj.ID),
                dao.CreateParameter("@ID_Creator", obj.ID_Creator),
                dao.CreateParameter("@Name", obj.Name),
                dao.CreateParameter("@Description", obj.Description),
                dao.CreateParameter("@Active", obj.Active)
            });
            return(dao.SubmitChange());
        }
        public virtual DanhMucItemData GetDanhMucItemByID(System.Int32 ID, System.String MaLoaiDanhMuc)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);

            dao.SetCommandText(SP_DANHMUCITEM_SELECT_BY_ID, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[] {
                dao.CreateParameter("@ID", ID),
                dao.CreateParameter("@MaLoaiDanhMuc", MaLoaiDanhMuc)
            });

            DataTable table = dao.ExecuteQuery();

            if (table != null && table.Rows.Count > 0)
            {
                return(Convert(table.Rows[0]));
            }

            return(default(DanhMucItemData));
        }
        public virtual IList <DanhMucItemData> GetDanhMucItems(System.Int32 size, System.String whereCondition)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);

            dao.SetCommandText(SP_DANHMUCITEM_SELECT_TOP_DYNAMIC, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[] {
                dao.CreateParameter("@Size", size),
                dao.CreateParameter("@WhereCondition", whereCondition)
            });

            DataTable table = dao.ExecuteQuery();

            if (table != null && table.Rows.Count > 0)
            {
                IList <DanhMucItemData> list = new List <DanhMucItemData>(table.Rows.Count);
                foreach (DataRow row in table.Rows)
                {
                    list.Add(Convert(row));
                }

                return(list);
            }
            return(new List <DanhMucItemData>());
        }
        public virtual System.Int32 GetDanhMucItemCount(System.String whereCondition)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);

            dao.SetCommandText(SP_DANHMUCITEM_SELECT_COUNT, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[] {
                dao.CreateParameter("@WhereCondition", whereCondition)
            });

            DataTable table = dao.ExecuteQuery();

            if (table != null && table.Rows.Count > 0)
            {
                return(System.Int32.Parse(table.Rows[0][0].ToString()));
            }
            return(0);
        }
        public virtual SysGroupData GetSysGroupByID(System.Int32 ID)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);

            dao.SetCommandText(SP_SYSGROUP_SELECT_BY_ID, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[] {
                dao.CreateParameter("@ID", ID)
            });

            DataTable table = dao.ExecuteQuery();

            if (table != null && table.Rows.Count > 0)
            {
                return(Convert(table.Rows[0]));
            }

            return(default(SysGroupData));
        }
        public virtual IList <SysGroupData> GetSysGroups(System.String whereCondition)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);

            dao.SetCommandText(SP_SYSGROUP_SELECT_DYNAMIC, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[] {
                dao.CreateParameter("@WhereCondition", whereCondition)
            });

            DataTable table = dao.ExecuteQuery();

            if (table != null && table.Rows.Count > 0)
            {
                IList <SysGroupData> list = new List <SysGroupData>(table.Rows.Count);
                foreach (DataRow row in table.Rows)
                {
                    list.Add(Convert(row));
                }

                return(list);
            }
            return(new List <SysGroupData>());
        }
        public virtual System.Int32 GetSysGroupCount(System.String whereCondition)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);
            dao.SetCommandText(SP_SYSGROUP_SELECT_COUNT, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[]{
                dao.CreateParameter("@WhereCondition", whereCondition)
            });

            DataTable table = dao.ExecuteQuery();
            if (table != null && table.Rows.Count > 0)
            {
                return System.Int32.Parse(table.Rows[0][0].ToString());
            }
            return 0;
        }
        public virtual System.Int32 Add(DanhMucItemData obj)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);

            dao.SetCommandText(SP_DANHMUCITEM_INSERT, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[] {
                dao.CreateParameter("@ID", obj.ID),
                dao.CreateParameter("@MaLoaiDanhMuc", obj.MaLoaiDanhMuc),
                dao.CreateParameter("@MaDanhMuc", obj.MaDanhMuc),
                dao.CreateParameter("@TenDanhMuc", obj.TenDanhMuc),
                dao.CreateParameter("@MoTa", obj.MoTa),
                dao.CreateParameter("@ThuTu", obj.ThuTu),
                dao.CreateParameter("@IntVal1", obj.IntVal1),
                dao.CreateParameter("@IntVal2", obj.IntVal2),
                dao.CreateParameter("@IntVal3", obj.IntVal3),
                dao.CreateParameter("@DecVal1", obj.DecVal1),
                dao.CreateParameter("@DecVal2", obj.DecVal2),
                dao.CreateParameter("@DecVal3", obj.DecVal3),
                dao.CreateParameter("@StrVal1", obj.StrVal1),
                dao.CreateParameter("@StrVal2", obj.StrVal2),
                dao.CreateParameter("@StrVal3", obj.StrVal3),
                dao.CreateParameter("@Active", obj.Active)
            });
            return(dao.SubmitChange());
        }
        public virtual System.Int32 Add(SysAccountData obj)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);

            dao.SetCommandText(SP_SYSACCOUNT_INSERT, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[] {
                dao.CreateParameter("@ID", obj.ID),
                dao.CreateParameter("@Username", obj.Username),
                dao.CreateParameter("@Password", obj.Password),
                dao.CreateParameter("@RealName", obj.RealName),
                dao.CreateParameter("@Email", obj.Email),
                dao.CreateParameter("@ID_DonVis", obj.ID_DonVis),
                dao.CreateParameter("@LastAccess", obj.LastAccess),
                dao.CreateParameter("@Active", obj.Active),
                dao.CreateParameter("@AccountType", obj.AccountType),
                dao.CreateParameter("@Creator_ID", obj.Creator_ID),
                dao.CreateParameter("@ID_DonViGoc", obj.ID_DonViGoc),
                dao.CreateParameter("@IsUpdate", obj.IsUpdate)
            });
            return(dao.SubmitChange());
        }
        public virtual IList<DanhMucItemData> GetDanhMucItems(System.String whereCondition)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);
            dao.SetCommandText(SP_DANHMUCITEM_SELECT_DYNAMIC, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[]{
                dao.CreateParameter("@WhereCondition", whereCondition)
            });

            DataTable table = dao.ExecuteQuery();
            if (table != null && table.Rows.Count > 0)
            {
                IList<DanhMucItemData> list = new List<DanhMucItemData>(table.Rows.Count);
                foreach (DataRow row in table.Rows)
                {
                    list.Add(Convert(row));
                }

                return list;
            }
            return new List<DanhMucItemData>();
        }
        public virtual DanhMucItemData GetDanhMucItemByID(System.Int32 ID, System.String MaLoaiDanhMuc)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);
            dao.SetCommandText(SP_DANHMUCITEM_SELECT_BY_ID, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[]{
                dao.CreateParameter("@ID", ID),
                dao.CreateParameter("@MaLoaiDanhMuc", MaLoaiDanhMuc)
            });

            DataTable table = dao.ExecuteQuery();
            if (table != null && table.Rows.Count > 0)
            {
                return Convert(table.Rows[0]);
            }

            return default(DanhMucItemData);
        }
        public virtual IList<SysGroupData> GetSysGroupPaging(System.String whereCondition, System.Int32 pageSize, System.Int32 currentPage, System.String sortByColumns)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);
            dao.SetCommandText(SP_SYSGROUP_SELECT_PAGING, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[]{
                dao.CreateParameter("@WhereCondition", whereCondition),
                dao.CreateParameter("@PageSize", pageSize),
                dao.CreateParameter("@CurrentPage", currentPage),
                dao.CreateParameter("@SortByColumns", sortByColumns)
            });

            DataTable table = dao.ExecuteQuery();
            if (table != null && table.Rows.Count > 0)
            {
                IList<SysGroupData> list = new List<SysGroupData>(table.Rows.Count);
                foreach (DataRow row in table.Rows)
                {
                    list.Add(Convert(row));
                }

                return list;
            }
            return new List<SysGroupData>();
        }
        public virtual IList<SysGroupData> GetSysGroups(System.Int32 size, System.String whereCondition)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);
            dao.SetCommandText(SP_SYSGROUP_SELECT_TOP_DYNAMIC, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[]{
                dao.CreateParameter("@Size", size),
                dao.CreateParameter("@WhereCondition", whereCondition)
            });

            DataTable table = dao.ExecuteQuery();
            if (table != null && table.Rows.Count > 0)
            {
                IList<SysGroupData> list = new List<SysGroupData>(table.Rows.Count);
                foreach (DataRow row in table.Rows)
                {
                    list.Add(Convert(row));
                }

                return list;
            }
            return new List<SysGroupData>();
        }
        public virtual System.Int32 Change(DanhMucItemData obj)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);
            dao.SetCommandText(SP_DANHMUCITEM_UPDATE, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[]{
                dao.CreateParameter("@ID", obj.ID),
                dao.CreateParameter("@MaLoaiDanhMuc", obj.MaLoaiDanhMuc),
                dao.CreateParameter("@MaDanhMuc", obj.MaDanhMuc),
                dao.CreateParameter("@TenDanhMuc", obj.TenDanhMuc),
                dao.CreateParameter("@MoTa", obj.MoTa),
                dao.CreateParameter("@ThuTu", obj.ThuTu),
                dao.CreateParameter("@IntVal1", obj.IntVal1),
                dao.CreateParameter("@IntVal2", obj.IntVal2),
                dao.CreateParameter("@IntVal3", obj.IntVal3),
                dao.CreateParameter("@DecVal1", obj.DecVal1),
                dao.CreateParameter("@DecVal2", obj.DecVal2),
                dao.CreateParameter("@DecVal3", obj.DecVal3),
                dao.CreateParameter("@StrVal1", obj.StrVal1),
                dao.CreateParameter("@StrVal2", obj.StrVal2),
                dao.CreateParameter("@StrVal3", obj.StrVal3),
                dao.CreateParameter("@Active", obj.Active)

            });
            return dao.SubmitChange();
        }
        public virtual SysGroupData GetSysGroupByID(System.Int32 ID)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);
            dao.SetCommandText(SP_SYSGROUP_SELECT_BY_ID, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[]{
            dao.CreateParameter("@ID", ID)          });

            DataTable table = dao.ExecuteQuery();
            if (table != null && table.Rows.Count > 0)
            {
                return Convert(table.Rows[0]);
            }

            return default(SysGroupData);
        }
        public virtual System.Int32 Change(SysAccountData obj)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);
            dao.SetCommandText(SP_SYSACCOUNT_UPDATE, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[]{
                dao.CreateParameter("@ID", obj.ID),
                dao.CreateParameter("@Username", obj.Username),
                dao.CreateParameter("@Password", obj.Password),
                dao.CreateParameter("@RealName", obj.RealName),
                dao.CreateParameter("@Email", obj.Email),
                dao.CreateParameter("@ID_DonVis", obj.ID_DonVis),
                dao.CreateParameter("@LastAccess", obj.LastAccess),
                dao.CreateParameter("@Active", obj.Active),
                dao.CreateParameter("@AccountType", obj.AccountType),
                dao.CreateParameter("@Creator_ID", obj.Creator_ID),
                dao.CreateParameter("@ID_DonViGoc", obj.ID_DonViGoc),
                dao.CreateParameter("@IsUpdate", obj.IsUpdate)

            });
            return dao.SubmitChange();
        }