Exemplo n.º 1
0
 public int InsertPersonGen(PersonGen personGen)
 {
     try
     {
         //return (int)baseDao.Insert<PersonGen>(personGen);
         baseDao.Insert <PersonGen>(personGen);
         return(1);
     }
     catch (Exception ex) {
         throw new DalException("dao出错");
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 删除PersonGen
        /// </summary>
        /// <param name="personGen">PersonGen实体对象</param>
        /// <returns>状态代码</returns>
        public int DeletePersonGen(PersonGen personGen)
        {
            try
            {
                Object result  = baseDao.Delete <PersonGen>(personGen);
                int    iReturn = Convert.ToInt32(result);

                return(iReturn);
            }
            catch (Exception ex)
            {
                throw new DalException("调用PersonGen时,访问Delete时出错", ex);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///  检索PersonGen,带翻页
        /// </summary>
        /// <param name="obj">PersonGen实体对象检索条件</param>
        /// <param name="pagesize">每页记录数</param>
        /// <param name="pageNo">页码</param>
        /// <returns>检索结果</returns>
        public IList <PersonGen> GetListByPage(PersonGen obj, int pagesize, int pageNo)
        {
            try
            {
                StringBuilder sbSql = new StringBuilder(200);

                sbSql.Append(@"select CityId, ContryId, ID, Remark from Person (nolock) ");
                sbSql.Append(" order by ID desc ");
                sbSql.Append(string.Format("OFFSET {0} ROWS FETCH NEXT {1} ROWS ONLY", (pageNo - 1) * pagesize, pagesize));
                IList <PersonGen> list = baseDao.SelectList <PersonGen>(sbSql.ToString());
                return(list);
            }
            catch (Exception ex)
            {
                throw new DalException("调用PersonGenDao时,访问GetListByPage时出错", ex);
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            //BaseDao dao = BaseDaoFactory.CreateBaseDao("DalTest");
            //var result = dao.SelectDataTable("select 1");
            //Console.Read();

            var dao    = DALFactory.PersonGenDao;
            var person = new PersonGen();

            //person.ID = 1;
            person.ContryId = 1;
            person.CityId   = 1;
            person.Remark   = "用户1";
            dao.InsertPersonGen(person);

            var person2 = new PersonGen();

            // person2.ID = 2;
            person2.ContryId = 2;
            person2.CityId   = 2;
            person2.Remark   = "用户2";
            dao.InsertPersonGen(person2);

            //var allUsers = dao.GetAll();

            var list = new List <int> {
                1, 2, 3, 4, 5
            };

            list.RemoveAll(c => c == 1 || c == 2);
            Console.WriteLine("result:");
            foreach (var i in list)
            {
                Console.WriteLine($"{i}");
            }
            RightManagerInvoker.AddRight();

            Console.ReadLine();
        }