示例#1
0
 /// <summary>
 /// 发布信息
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public int AddInfo(Info info)
 {
     string sql = "insert into tb_info(info_type, info_title, info_content, info_linkman, info_phone, info_email, info_date, info_state, info_payfor)values(@type, @title, @content, @linkman, @phone, @email, @time, 1, 0)";
     SqlParameter[] value = new SqlParameter[]
     {
         new SqlParameter("@type", info.Info_type),
         new SqlParameter("@title", info.Info_title),
         new SqlParameter("@content", info.Info_content),
         new SqlParameter("@linkman", info.Info_linkman),
         new SqlParameter("@phone", info.Info_phone),
         new SqlParameter("@email", info.Info_email),
         new SqlParameter("@time", info.Info_date)
     };
     int num = DBHelper.executeCommand(sql, value);
     return num;
 }
示例#2
0
 protected void Ok_Click(object sender, EventArgs e)
 {
     TbInfoService infoService = new TbInfoService();
     string date = string.Format("{0:yyyy-MM-dd hh:mm:ss}", DateTime.Now);
     Info info = new Info();
     info.Info_type = Convert.ToInt32(TbTypeList.SelectedValue);
     info.Info_content = txtContent.Text;
     info.Info_email = email.Text;
     info.Info_linkman = linkman.Text;
     info.Info_phone = phone.Text;
     info.Info_title = infoTitle.Text;
     info.Info_date = date;
     int num = infoService.AddInfo(info);
     if (num == 1)
     {
         Response.Write("<script>alert('发布成功'); window.location.href = '../show/listshow.aspx?id=" + info.Id + "'; </script>");
     }
     else
         Response.Write("<script>alert('发布失败')</script>");
 }
示例#3
0
 /// <summary>
 /// 根据编号查找信息
 /// </summary>
 /// <param name="typeId"></param>
 /// <returns></returns>
 public Info CheckId(int typeId)
 {
     Info info = null;
     string sql = "select * from tb_info  where tb_info.id = @id";
     SqlParameter[] value = new SqlParameter[]{
         new SqlParameter("@id", typeId)
     };
     DataTable dt = DBHelper.GetDataTable(sql, value);
     if (dt.Rows.Count > 0)
     {
         DataRow dr = dt.Rows[0];
         info = new Info();
         info.Id = Convert.ToInt32(dr["id"]);
         //info.Info_content = dr["info_content"].ToString();
         info.Info_date = dr["info_date"].ToString();
         info.Info_email = dr["info_email"].ToString();
         info.Info_linkman = dr["info_linkman"].ToString();
         info.Info_phone = dr["info_phone"].ToString();
         info.Info_title = dr["info_title"].ToString();
         info.Info_type = Convert.ToInt32(dr["info_type"]);
     }
     return info;
 }
示例#4
0
        /// <summary>
        /// 查询信息
        /// </summary>
        /// <param name="typeId"></param>
        /// <param name="keys"></param>
        /// <param name="type"></param>
        /// <param name="all"></param>
        /// <returns></returns>
        public ArrayList searchInfo(int typeId, string keys, string type, int all)
        {
            ArrayList list = new ArrayList();
            string sql = null;
            Info info = null;
            sql = "select tb_info.*, tb_type.type_intro from tb_info inner join tb_type on tb_info.info_type = tb_type.id where 1=1";
            if (typeId > 0)
                sql += " and info_type =" + typeId;
            if (all == 0)
            {
                if (keys != "" && type != "")
                    sql += " and " + type + "=" + keys;
                else if (keys != "")
                    sql += " and info_title like '%" + keys+"%'";
            }
            else if (all == 1)
            {
                if (keys != "" && type != "")
                    sql += " and " + type + " like '%" + keys + "%'";
                else if (keys != "")
                    sql += " and info_title like '%" + keys + "%'";
            }
            DataTable dt = DBHelper.GetDataTable(sql);
            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    info = new Info();

                    try
                    {
                        info.Id = Convert.ToInt32(dr["id"]);
                        info.Info_title = dr["info_title"].ToString();
                        info.Info_date = dr["info_date"].ToString();
                        info.Info_content = dr["info_content"].ToString();
                        info.Info_phone = dr["info_phone"].ToString();
                        info.Info_linkman = dr["info_linkman"].ToString();
                        info.Info_email = dr["info_email"].ToString();
                        info.TbType.TypeIntro = dr["type_intro"].ToString();
                        list.Add(info);
                    }
                    catch (Exception e)
                    {

                        Console.WriteLine(e.Message);
                    }
                }
            }
            return list;
        }
示例#5
0
 /// <summary>
 /// 修改信息
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public int ModifyInfo(Info info)
 {
     string sql = "update tb_info set info_type = @type, info_title = @title, info_content = @content, info_linkman = @linkman, info_phone = @phone, info_email = @email, info_date = @time where id = @id";
     SqlParameter[] value = new SqlParameter[]
     {
         new SqlParameter("@type", info.Info_type),
         new SqlParameter("@title", info.Info_title),
         new SqlParameter("@content", info.Info_content),
         new SqlParameter("@linkman", info.Info_linkman),
         new SqlParameter("@phone", info.Info_phone),
         new SqlParameter("@email", info.Info_email),
         new SqlParameter("@time", info.Info_date),
         new SqlParameter("@id", info.Id)
     };
     int num = DBHelper.executeCommand(sql, value);
     return num;
 }
示例#6
0
 /// <summary>
 /// 首页缴费信息推荐
 /// </summary>
 /// <returns></returns>
 public ArrayList GetNewInfoPayfor()
 {
     ArrayList list = new ArrayList();
     string sql = null;
     Info info = null;
     sql = "select top 8 * from tb_info inner join tb_type on tb_info.info_type = tb_type.id where tb_info.info_payfor = 1 ";
     DataTable dt = DBHelper.GetDataTable(sql);
     try
     {
         if (dt != null)
         {
             foreach (DataRow dr in dt.Rows)
             {
                 info = new Info();
                 info.Id = Convert.ToInt32(dr["id"]);
                 info.Info_title = dr["info_title"].ToString();
                 info.Info_date = dr["info_date"].ToString();
                 info.Info_content = dr["info_content"].ToString();
                 info.Info_phone = dr["info_phone"].ToString();
                 info.Info_linkman = dr["info_linkman"].ToString();
                 info.Info_email = dr["info_email"].ToString();
                 info.TbType.TypeIntro = dr["type_intro"].ToString();
                 list.Add(info);
             }
         }
     }
     catch (Exception e) {
         Console.WriteLine(e.Message);
     }
     return list;
 }
示例#7
0
 public ArrayList GetNewInfoNoPay(int typeId)
 {
     ArrayList list = new ArrayList();
     string sql = null;
     Info info = null;
     sql = "select top 5 * from tb_info where info_payfor = 0 and info_type = "+typeId;
     DataTable dt = DBHelper.GetDataTable(sql);
     if (dt != null)
     {
         foreach (DataRow dr in dt.Rows)
         {
             try
             {
                 info = new Info();
                 info.Id = Convert.ToInt32(dr["id"]);
                 info.Info_title = dr["info_title"].ToString();
                 list.Add(info);
             }
             catch (Exception e)
             {
                 Console.WriteLine(e.Message);
             }
         }
     }
     return list;
 }
示例#8
0
 /// <summary>
 /// 查找最新的免费缴费信息
 /// </summary>
 /// <param name="pay"></param>
 /// <returns></returns>
 public Info CheckNewInfoByPay(int pay, int typeId)
 {
     Info info = null;
     string sql = "select * from tb_info where info_payfor = @pay";
     if (typeId > 0)
     {
         sql += " and info_type = @type";
     }
     sql += " order by id desc";
     SqlParameter[] value = new SqlParameter[]{
         new SqlParameter("@pay", pay),
         new SqlParameter("@type", typeId)
     };
     DataTable dt = DBHelper.GetDataTable(sql, value);
     try
     {
         if (dt.Rows.Count > 0)
         {
             DataRow dr = dt.Rows[0];
             info = new Info();
             info.Id = Convert.ToInt32(dr["id"]);
             info.Info_content = dr["info_content"].ToString();
             info.Info_date = dr["info_date"].ToString();
             info.Info_email = dr["info_email"].ToString();
             info.Info_linkman = dr["info_linkman"].ToString();
             info.Info_phone = dr["info_phone"].ToString();
             info.Info_title = dr["info_title"].ToString();
             info.Info_type = Convert.ToInt32(dr["info_type"]);
         }
     }
     catch (Exception e) {
         Console.WriteLine(e.Message);
     }
     return info;
 }
示例#9
0
        private void showData(int typeId)
        {
            Info info = new Info();
            string content = null;
            TbInfoService infoservice = new TbInfoService();
            info = infoservice.CheckNewInfoByPay(1, typeId);
             //       Labe_Message.Text = DBHelper.Message;
            if (info != null)
            {
                title1.Text = info.Info_title;
                time1.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", info.Info_date);
                if (info.Info_content == null || info.Info_content == string.Empty) {
                    info.Info_content = "无内容";
                }

                if (info.Info_content.Length > 20)
                {
                    content = info.Info_content.Substring(0, 19) + "...";
                }
                else
                    content = info.Info_content;
                content1.Text = content;
                try
                {
                    if (info.Info_phone.Length == 11)
                        phone1.Text = info.Info_phone.Substring(0, 7) + "****";
                    linkman1.Text = info.Info_linkman;
                    email1.Text = "***" + info.Info_email.Substring(3);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            else
                content1.Text = "暂时没有此类消息";

            info = infoservice.CheckNewInfoByPay(0, typeId);
              //      Labe_Message.Text = DBHelper.Message;
            if (info != null)
            {
                title0.Text = info.Info_title;
                time0.Text = info.Info_date;
                if (info.Info_content == null || info.Info_content == string.Empty)
                {
                    info.Info_content = "无内容";
                }
                if (info.Info_content.Length > 20)
                {
                    content = info.Info_content.Substring(0, 19) + "...";
                }
                else
                    content = info.Info_content;
                content0.Text = content;
                phone0.Text = info.Info_phone.Substring(0, 7) + "****";
                linkman0.Text = info.Info_linkman;
                email0.Text = "***" + info.Info_email.Substring(3);
            }
            else
                content0.Text = "暂时没有此类消息";
        }