Пример #1
0
        public IntroductionTypeInfo GetInfo(int id)
        {
            IntroductionTypeInfo info = null;

            SqlParameter[] param =
            {
                new SqlParameter("@id", id)
            };
            var r = DataHelper.ExecuteReader(Config.ConnectString, "usp_Introduction_Type_GetById", param);

            if (r != null)
            {
                info = new IntroductionTypeInfo();
                while (r.Read())
                {
                    info.id          = Int32.Parse(r["id"].ToString());
                    info.name        = r["name"].ToString();
                    info.link        = r["link"].ToString();
                    info.sort        = (object)r["sort"].ToString();
                    info.description = r["description"].ToString();
                    info.keyword     = r["keyword"].ToString();
                }
                r.Close();
                r.Dispose();
            }
            return(info);
        }
Пример #2
0
 public int Add(IntroductionTypeInfo info)
 {
     SqlParameter[] param =
     {
         new SqlParameter("@name",        info.name),
         new SqlParameter("@link",        info.link),
         new SqlParameter("@sort",        info.sort),
         new SqlParameter("@description", info.description),
         new SqlParameter("@keyword",     info.keyword)
     };
     return(int.Parse(DataHelper.ExecuteScalar(Config.ConnectString, "usp_Introduction_Type_Add", param).ToString()));
 }
Пример #3
0
 public int Update(IntroductionTypeInfo info)
 {
     SqlParameter[] param =
     {
         new SqlParameter("@id",          info.id)
         ,                                new SqlParameter("@name",info.name),
         new SqlParameter("@link",        info.link),
         new SqlParameter("@sort",        info.sort),
         new SqlParameter("@description", info.description),
         new SqlParameter("@keyword",     info.keyword)
     };
     return(DataHelper.ExecuteNonQuery(Config.ConnectString, "usp_Introduction_Type_Update", param));
 }
        private bool AddNewCate()
        {
            if (string.IsNullOrEmpty(txtCategoryname.Text) || string.IsNullOrEmpty(txtSort.Text))
            {
                ltrThongbao.Text = "Cần nhập đủ các trường!";
                return(false);
            }
            var info = new IntroductionTypeInfo();

            info.name = txtCategoryname.Text;
            var nextId = UntilityFunction.nextId("tbl_Introduction_Type");

            info.link        = Rewrite.GenCate(info.name, nextId, Rewrite.About);
            info.sort        = int.Parse(txtSort.Text);
            info.description = txtMota.Text;
            info.keyword     = txtTukhoa.Text;
            ServiceFactory.GetInstanceIntroductionType().Add(info);
            return(true);
        }
Пример #5
0
        public List <IntroductionTypeInfo> GetList(int pageIndex, int pageSize, out int total)
        {
            List <IntroductionTypeInfo> list = null;
            var t = 0;

            SqlParameter[] param =
            {
                new SqlParameter("@pageIndex", pageIndex),
                new SqlParameter("@pageSize",  pageSize),
                new SqlParameter("@totalrow",  DbType.Int32)
                {
                    Direction = ParameterDirection.Output
                }
            };
            SqlCommand comx;
            var        r = DataHelper.ExecuteReader(Config.ConnectString, "usp_Introduction_Type_GetList", param, out comx);

            if (r != null)
            {
                list = new List <IntroductionTypeInfo>();
                while (r.Read())
                {
                    var info = new IntroductionTypeInfo();
                    info.id          = Int32.Parse(r["id"].ToString());
                    info.name        = r["name"].ToString();
                    info.link        = r["link"].ToString();
                    info.sort        = (object)r["sort"].ToString();
                    info.description = r["description"].ToString();
                    info.keyword     = r["keyword"].ToString();


                    list.Add(info);
                }
                r.Close();
                r.Dispose();
                t = int.Parse(comx.Parameters[2].Value.ToString());
            }

            total = t;
            return(list);
        }
Пример #6
0
        public List <IntroductionTypeInfo> GetAll()
        {
            List <IntroductionTypeInfo> list = null;
            var r = DataHelper.ExecuteReader(Config.ConnectString, "usp_Introduction_Type_GetAll", null);

            if (r != null)
            {
                list = new List <IntroductionTypeInfo>();
                while (r.Read())
                {
                    var info = new IntroductionTypeInfo();
                    info.id   = Int32.Parse(r["id"].ToString());
                    info.name = r["name"].ToString();
                    info.link = r["link"].ToString();
                    info.sort = int.Parse(r["sort"].ToString());
                    list.Add(info);
                }
                r.Close();
                r.Dispose();
            }
            return(list);
        }