protected void Page_Load(object sender, EventArgs e)
        {
            int Id = 0;

            if (!Page.IsPostBack)
            {
                string idStr = Request.QueryString["Id"];

                if (idStr != null && idStr != string.Empty)
                {
                    try
                    {
                        Id = Convert.ToInt32(idStr);
                    }
                    catch
                    {
                        Id = -1;
                    }
                }
                TBInfoService infoService = new TBInfoService();
                int           ok          = infoService.DeleteInfoById(Id);
                if (ok > 0)
                {
                    Response.Redirect("searchshow.aspx");
                }
                else
                {
                    Response.Write("删除失败");
                }
            }
        }
示例#2
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string key = txtKey.Text;
            string con = ddlCondition.SelectedValue;
            int    ok  = -1;

            if (rbAll.Checked == true)
            {
                ok = 0;
            }//全字搜索
            else if (rbLike.Checked == true)
            {
                ok = 1;
            }//模糊搜索
            TBInfoService infoService = new TBInfoService();

            key = key.Trim();
            ArrayList list = infoService.GetInfoByCondition(ok, key, con);

            gdvCon.DataSource = list;
            gdvCon.DataBind();
            if (list.Count == 0)
            {
                lblGv.Text = "无结果";
            }
            else
            {
                lblGv.Text = "";
            }
        }
        protected void Button_OK_Click(object sender, EventArgs e)
        {
            string TypeId  = DropDownList1.SelectedValue;
            string title   = TextBox_Title.Text;
            string content = TextBox_Content.Text;
            string phone   = TextBox_Phone.Text;
            string linkMan = TextBox_Linkman.Text;
            string email   = TextBox_Email.Text;

            TBInfo info = new TBInfo();

            info.InfoType    = Convert.ToInt32(TypeId);
            info.InfoTitle   = title;
            info.InfoContent = content;
            info.InfoLinkMan = linkMan;
            info.InfoEmail   = email;
            info.InfoPhone   = phone;
            info.InfoDate    = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now);
            info.InfoState   = 1;
            info.InfoPayFor  = 0;

            TBInfoService infoService = new TBInfoService();
            int           ok          = infoService.AddTbInfo(info);

            if (0 < ok)
            {
                Labe_Message.Text = "<script> alert('发布成功');</script>";
            }
            else
            {
                Labe_Message.Text = "<script> alert('发布失败');</script>";
                Labe_Message.Text = DBHelper.Message;
            }
        }
        protected void Button_OK_Click(object sender, EventArgs e)
        {
            string typeId   = DropDownList_Type.SelectedValue;
            string title    = TextBox_Title.Text;
            string conntent = TextBox_Content.Text;
            string phone    = TextBox_Phone.Text;
            string linkMan  = TextBox_Linkman.Text;
            string email    = TextBox_Email.Text;

            TBInfo info = new TBInfo();

            info.InfoType    = Convert.ToInt32(typeId);
            info.InfoTitle   = title;
            info.InfoLinkMan = linkMan;
            info.InfoContent = conntent;
            info.InfoPhone   = phone;
            info.InfoEmail   = email;
            info.Id          = Convert.ToInt32(HiddenField_Id.Value);

            TBInfoService infoService = new TBInfoService();
            int           ok          = infoService.UpdateInfo(info);

            if (ok > 0)
            {
                Labe_Message.Text = "<script>alert('修改成功');location.href='searchshow.aspx';</script>";
            }
            else
            {
                Response.Write(DBHelper.Message);
                Labe_Message.Text = "<script>alert('修改失败')</script>";
            }
        }
        private void showData()
        {
            TBInfoService infoService = new TBInfoService();
            int           typeId      = Convert.ToInt32(DropDownList_Type.SelectedValue);
            string        key         = TextBox_Keys.Text.Trim();
            ArrayList     list        = infoService.GetInfoList(typeId, key, 0, -1, searchtype);

            GridView_Info.DataSource = list;
            GridView_Info.DataBind();
        }
        private void showInfo(int id)
        {
            TBInfoService infoService = new TBInfoService();
            TBInfo        info        = infoService.GetTheNewInfoById(id);

            DropDownList_Type.SelectedValue = info.InfoType.ToString();
            TextBox_Title.Text   = info.InfoTitle;
            TextBox_Content.Text = info.InfoContent;
            TextBox_Phone.Text   = info.InfoPhone;
            TextBox_Email.Text   = info.InfoEmail;
            TextBox_Linkman.Text = info.InfoLinkMan;
        }
示例#7
0
        private void showInfoByPayFor()
        {
            TBInfoService infoService = new TBInfoService();
            ArrayList     list1       = infoService.GetInfoList(0, "", 8, 1, 0);

            Repeater_Payfor.DataSource = list1;
            Repeater_Payfor.DataBind();

            ArrayList list0 = infoService.GetInfoList(2, "", 5, 0, -1);

            Repeater_FreeInfo2.DataSource = list0;
            Repeater_FreeInfo2.DataBind();

            ArrayList list7 = infoService.GetInfoList(7, "", 5, 0, -1);

            Repeater_FreeInfo7.DataSource = list7;
            Repeater_FreeInfo7.DataBind();
        }
示例#8
0
        public void showData(int typeId)
        {
            TBInfoService infoSeervice = new TBInfoService();
            TBInfo        info         = infoSeervice.GetTheNewInfoByPayFor(1, typeId);

            TBTypeService typeService = new TBTypeService();
            string        typeName    = typeService.GetTBTypeById(typeId);

            Label_PayName.Text = typeName;


            Labe_Title1.Text = info.InfoTitle;
            Label_Date1.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", Convert.ToDateTime(info.InfoDate));

            string content1 = info.InfoContent;

            if (content1 == null)
            {
                content1 = "内容为空";
            }
            if (content1.Length > 20)
            {
                content1 = content1.Substring(0, 20);
            }
            Label_Content1.Text = content1;


            Label_Linkman1.Text = info.InfoLinkMan;
            string phone1 = info.InfoPhone;

            if (phone1 == null)
            {
                phone1 = "0000000000";
            }
            Label_Phone1.Text = phone1.Substring(0, 7) + "****";
            Label_Email1.Text = info.InfoEmail;
        }