예제 #1
0
        /// <summary>
        /// 查询日志表中所有日志信息
        /// </summary>
        /// <returns> list集合List Journaltable </returns>
        public List <Journaltable> DAL_select_Journaltable_all()
        {
            List <Journaltable> list = new List <Journaltable>();

            SqlDataReader dr = sqlHelper.ExecuteReader("select_journaltable");

            while (dr.Read())
            {
                Journaltable jour = new Journaltable();
                jour.titleID    = Convert.ToInt32(dr["titleID"]);
                jour.title      = dr["title"].ToString();
                jour.createtime = Convert.ToDateTime(dr["createtime"]);
                jour.username   = dr["username"].ToString();
                jour.name       = dr["name"].ToString();
                jour.digests    = dr["digests"].ToString();
                jour.content    = dr["content"].ToString();
                jour.Clicks     = Convert.ToInt32(dr["Clicks"]);
                jour.commentnum = Convert.ToInt32(dr["commentnum"]);
                jour.sort       = dr["sort"].ToString();
                jour.islook     = Convert.ToInt32(dr["islook"]);
                jour.iscomment  = Convert.ToInt32(dr["iscomment"]);

                list.Add(jour);
            }
            return(list);
        }
예제 #2
0
        /// <summary>根据日志id查询日志信息
        /// 根据日志id查询日志信息
        /// </summary>
        /// <param name="a"> id </param>
        /// <returns>list集合</returns>
        public List <Journaltable> select_Journaltable_where_titleID(int a)
        {
            SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@titleID", a) };

            List <Journaltable> list = new List <Journaltable>();
            SqlDataReader       dr   = sqlHelper.ExecuteReader("select_Journaltable_where_titleID", parm);

            while (dr.Read())
            {
                Journaltable jour = new Journaltable();
                jour.titleID    = Convert.ToInt32(dr["titleID"]);
                jour.title      = dr["title"].ToString();
                jour.createtime = Convert.ToDateTime(dr["createtime"]);
                jour.username   = dr["username"].ToString();
                jour.name       = dr["name"].ToString();
                jour.digests    = dr["digests"].ToString();
                jour.content    = dr["content"].ToString();
                jour.Clicks     = Convert.ToInt32(dr["Clicks"]);
                jour.commentnum = Convert.ToInt32(dr["commentnum"]);
                jour.sort       = dr["sort"].ToString();
                jour.islook     = Convert.ToInt32(dr["islook"]);
                jour.iscomment  = Convert.ToInt32(dr["iscomment"]);

                list.Add(jour);
            }
            return(list);
        }
예제 #3
0
        /// <summary>
        /// 在分类的情况下 查询所有可见 日志信息
        /// </summary>
        /// <param name="pagesize">页大小</param>
        /// <param name="pageindex">也索引</param>
        /// <param name="count">中页数</param>
        /// <returns> List 集合Journaltable</returns>
        public List <Journaltable> DAl_proc_select_Journaltable_sort_all(string sort, int pagesize, int pageindex, ref int pagecount)
        {
            List <Journaltable> list = new List <Journaltable>();
            string        stion      = sqlHelper.stringconnection;
            SqlConnection con2       = new SqlConnection(stion);

            con2.Open();
            SqlCommand cmd2 = new SqlCommand("all_Journaltable_N2_sort", con2);

            cmd2.CommandType = CommandType.StoredProcedure;
            SqlParameter[] parrmdd = new SqlParameter[]
            {
                new SqlParameter("@sort", sort)
            };
            cmd2.Parameters.AddRange(parrmdd);
            int a = Convert.ToInt32(cmd2.ExecuteScalar());

            con2.Close();



            SqlConnection con = new SqlConnection(stion);

            con.Open();
            SqlCommand cmd = new SqlCommand("all_Journaltable_sort", con);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter[] paarm = new SqlParameter[]
            {
                new SqlParameter("@sort", sort),
                new SqlParameter("@pageSize", pagesize),
                new SqlParameter("@PageIndex", pageindex)
            };
            cmd.Parameters.AddRange(paarm);

            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                Journaltable jour = new Journaltable();
                jour.titleID    = Convert.ToInt32(dr["titleID"]);
                jour.title      = dr["title"].ToString();
                jour.createtime = Convert.ToDateTime(dr["createtime"]);
                jour.username   = dr["username"].ToString();
                jour.name       = dr["name"].ToString();
                jour.digests    = dr["digests"].ToString();
                jour.content    = dr["content"].ToString();
                jour.Clicks     = Convert.ToInt32(dr["Clicks"]);
                jour.commentnum = Convert.ToInt32(dr["commentnum"]);
                jour.sort       = dr["sort"].ToString();
                jour.islook     = Convert.ToInt32(dr["islook"]);
                jour.iscomment  = Convert.ToInt32(dr["iscomment"]);
                list.Add(jour);
            }
            pagecount = a / pagesize;
            return(list);
        }
예제 #4
0
        /// <summary>
        /// 管理员根据员工姓名查询所有该用户的日志信息
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pagesize"></param>
        /// <param name="pageindex"></param>
        /// <param name="pagecounts"></param>
        /// <returns></returns>
        public List <Journaltable> Page_admin_select_journaltable_where_name_putongusername(string name, int pagesize, int pageindex, ref int pagecounts)
        {
            List <Journaltable> list = new List <Journaltable>();

            string        striconnection = sqlHelper.stringconnection;
            SqlConnection con            = new SqlConnection(striconnection);

            con.Open();
            SqlCommand cmd = new SqlCommand("Page_admin_select_journaltable_where_name_putongusername", con);

            //cmd.Connection = con;
            cmd.CommandType = CommandType.StoredProcedure;
            //cmd.CommandText = "Page_admin_select_journaltable_where_name_putongusername";
            SqlParameter[] parm = new SqlParameter[] {
                new SqlParameter("@name", name),
                new SqlParameter("@pageSize", pagesize),
                new SqlParameter("@PageIndex", pageindex)
            };
            cmd.Parameters.AddRange(parm);
            SqlParameter pagecount = new SqlParameter("@count", SqlDbType.Int); //创建一个参数

            pagecount.Direction = ParameterDirection.Output;                    //设置参数类型为输出参数
            cmd.Parameters.Add(pagecount);                                      //把参数添加到命令对象的参数列表中
            int page = Convert.ToInt32(pagecount.Value);

            pagecounts = page / pagesize;

            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                Journaltable jour = new Journaltable();
                jour.titleID    = Convert.ToInt32(dr["titleID"]);
                jour.title      = dr["title"].ToString();
                jour.createtime = Convert.ToDateTime(dr["createtime"]);
                jour.username   = dr["username"].ToString();
                jour.name       = dr["name"].ToString();
                jour.digests    = dr["digests"].ToString();
                jour.content    = dr["content"].ToString();
                jour.Clicks     = Convert.ToInt32(dr["Clicks"]);
                jour.commentnum = Convert.ToInt32(dr["commentnum"]);
                jour.sort       = dr["sort"].ToString();
                jour.islook     = Convert.ToInt32(dr["islook"]);
                jour.iscomment  = Convert.ToInt32(dr["iscomment"]);

                list.Add(jour);
            }
            return(list);
        }
예제 #5
0
        /// <summary>
        /// 更新日志表中的数据
        /// </summary>
        /// <param name="jou"></param>
        /// <returns></returns>
        public int update_jourelnal_where_titleID(Journaltable jou)
        {
            SqlParameter[] parm = new SqlParameter[]
            {
                new SqlParameter("@titleID", jou.titleID),
                new SqlParameter("@title", jou.title),
                //new SqlParameter ("@createtime",jou.createtime ),
                //new SqlParameter ("@username",jou.username ),
                //new SqlParameter ("@name",jou.name ),
                new SqlParameter("@digests", jou.digests),
                new SqlParameter("@content", jou.content),
                //new SqlParameter ("@Clicks",jou.Clicks ),
                //new SqlParameter ("@commentnum",jou.commentnum ),
                new SqlParameter("@sort", jou.sort),
                new SqlParameter("@islook", jou.islook),
                new SqlParameter("@iscomment", jou.iscomment)
            };
            int a = sqlHelper.ExecuteNonQuery("update_journaltable_where_titleID", parm);

            return(a);
        }
예제 #6
0
 /// <summary>
 /// 更新日志表中的数据
 /// </summary>
 /// <param name="jou"></param>
 /// <returns></returns>
 public int update_jourelnal_where_titleID(Journaltable jou)
 {
     return(new DAL_insert_Journaltable().update_jourelnal_where_titleID(jou));
 }
예제 #7
0
 /// <summary>
 /// 向日志表中插入数据
 /// </summary>
 /// <param name="jou"></param>
 /// <returns></returns>
 public int insert_Journaltable_where_username(Journaltable jou)
 {
     return(new DAL_insert_Journaltable().insert_Journaltable_where_username(jou));
 }
예제 #8
0
    protected void btn_Click(object sender, EventArgs e)
    {
        if (ViewState["Page"] != null)
        {
            Journaltable jour = new Journaltable();
            jour.titleID   = Convert.ToInt32(Session["edittitleID"]);
            jour.title     = this.txttitle.Text;                       //标题
            jour.digests   = this.txtzhaiyao.Text;                     //摘要
            jour.content   = FCKeditor1.Value.Trim();                  //日志内容
            jour.iscomment = (this.CheckBox2.Checked == true ? 0 : 1); //是否可见
            jour.islook    = (this.CheckBox1.Checked == true ? 0 : 1); //是否可以访问
            if (this.RadioButton1.Checked == true)
            {
                jour.sort = "体育";
            }                                              //所属分类
            else if (this.RadioButton2.Checked == true)
            {
                jour.sort = "财经";
            }
            else if (this.RadioButton3.Checked == true)
            {
                jour.sort = "房产";
            }
            else if (this.RadioButton4.Checked == true)
            {
                jour.sort = "娱乐";
            }
            else if (this.RadioButton5.Checked == true)
            {
                jour.sort = "计算机技术";
            }
            else if (this.RadioButton6.Checked == true)
            {
                jour.sort = "其他";
            }

            int a = new BLL_insert_Journaltable().update_jourelnal_where_titleID(jour);
            if (a > 0)
            {
                Page.ClientScript.RegisterStartupScript(typeof(string), "j", "<script>alert('修改成功')</script>");
                //start();
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(typeof(string), "飞", "<script>alert('修改失败')</script>");
            }
        }
        else
        {
            Journaltable jour = new Journaltable();

            jour.title     = this.txttitle.Text;                     //标题
            jour.digests   = this.txtzhaiyao.Text;                   //摘要
            jour.content   = FCKeditor1.Value.Trim();                //日志内容
            jour.iscomment = (this.CheckBox2.Checked == true ? 0:1); //是否可见
            jour.islook    = (this.CheckBox1.Checked == true ? 0:1); //是否可以访问
            if (this.RadioButton1.Checked == true)
            {
                jour.sort = "体育";
            }                                            //所属分类
            else if (this.RadioButton2.Checked == true)
            {
                jour.sort = "财经";
            }
            else if (this.RadioButton3.Checked == true)
            {
                jour.sort = "房产";
            }
            else if (this.RadioButton4.Checked == true)
            {
                jour.sort = "娱乐";
            }
            else if (this.RadioButton5.Checked == true)
            {
                jour.sort = "计算机技术";
            }
            else if (this.RadioButton6.Checked == true)
            {
                jour.sort = "其他";
            }
            try
            {
                jour.username = Session["username"].ToString(); //用户名
                jour.name     = Session["name"].ToString();     //姓名
            }
            catch (Exception)
            {
                throw;
            }
            jour.createtime = DateTime.Now;
            int a = new BLL_insert_Journaltable().insert_Journaltable_where_username(jour);
            if (a > 0)
            {
                Page.ClientScript.RegisterStartupScript(typeof(string), "j", "<script>alert('保存成功')</script>");
                //start();
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(typeof(string), "飞", "<script>alert('保存失败')</script>");
            }
        }
    }