Beispiel #1
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
        TPortalClass.JpGuidePage JpGuidePage = new TPortalClass.JpGuidePage();
        string ls_tip = "删除成功!";
        for (int i = 0; i < rptList.Items.Count; i++)
        {
            string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value;
            CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
            if (cb.Checked)
            {
                JpGuidePage.id = int.Parse(id);
                JpGuidePage.Delete();
            }
        }
        string pageUrl = JpCommon.CombUrlTxt("list_guidepage.aspx", "page={0}&rnd={1}",
            "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "");

        //写系统日志

        string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
        if (userip == null || userip == "")
        {
            userip = Request.ServerVariables["REMOTE_ADDR"];
        }
        JpCommon.WriteLog(userip, "删除", "批量引导页", Session["uid"].ToString(), Session["uname"].ToString());
        Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>");
    }
Beispiel #2
0
    //保存
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.Session["uid"] == null || this.Session["uid"].ToString() == "")
        {
            this.Response.Redirect("../login.aspx");
        }

        string ls_tip = "保存成功!";

        TPortalClass.JpGuidePage JpGuidePage = new TPortalClass.JpGuidePage();
        TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();

        JpGuidePage.hy_name = this.txthy_name.Text;
        JpGuidePage.hy_url = this.txthy_url.Text;
        JpGuidePage.hy_sort = int.Parse(this.txthy_sort.Text);
        JpGuidePage.hy_ifused = Convert.ToInt32(ddlifused.Value);

        string lsfilename = FileUpload1.FileName;
        string lspath = "", lsurl = "", str_path = "";
        if (lsfilename != "")  //attsize
        {
            lsfilename = System.Guid.NewGuid() + "_" + lsfilename;
            //将附件上传到服务器目录下
            lspath = Server.MapPath("~/");  //虚拟目录的位置
            lsurl = "/upload/guidepagepic_yt";  //原图存放的文件夹
            Directory.CreateDirectory(lspath + "/" + lsurl);
            str_path = lspath + "/" + lsurl + "/" + lsfilename;
            FileUpload1.SaveAs(str_path);
            JpGuidePage.hy_images = lsurl + "/" + lsfilename;
        }
        else
        {
            JpGuidePage.hy_images = this.txtpicurl.Value;
        }
        JpGuidePage.hy_addtime = System.DateTime.Now;

        if (this.txtop.Value == "add")
        {
            //写系统日志
            string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
            if (userip == null || userip == "")
            {
                userip = Request.ServerVariables["REMOTE_ADDR"];
            }
            JpCommon.WriteLog(userip, "新增", "新增引导页记录[id:" + this.txtid.Value + "]", Session["uid"].ToString(), Session["uname"].ToString());
            JpGuidePage.Insert();
        }
        else
        {
            JpGuidePage.id = System.Int32.Parse(this.txtid.Value);
            //写系统日志
            string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
            if (userip == null || userip == "")
            {
                userip = Request.ServerVariables["REMOTE_ADDR"];
            }
            JpCommon.WriteLog(userip, "修改", "修改引导页记录[id:" + this.txtid.Value + "]", Session["uid"].ToString(), Session["uname"].ToString());

            JpGuidePage.Update();

        }
        Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
    }
Beispiel #3
0
    private void DataPlay()
    {
        if (this.Request.QueryString["op"] != null)
        {
            this.txtop.Value = this.Request.QueryString["op"].ToString();           //新增还是修改
        }

        if (this.Request.QueryString["id"] != null)
        {
            this.txtid.Value = this.Request.QueryString["id"].ToString();     //文档ID
        }
        TPortalClass.JpGuidePage JpGuidePage = new TPortalClass.JpGuidePage();

        //旧文档
        if (this.txtop.Value == "modify")
        {
            DataTable dt = JpGuidePage.Getdocbyid(int.Parse(this.txtid.Value));
            if (dt.Rows.Count > 0)
            {
                this.txtid.Value = dt.Rows[0]["id"].ToString();
                this.txthy_name.Text = dt.Rows[0]["hy_name"].ToString();
                this.txthy_url.Text = dt.Rows[0]["hy_url"].ToString();
                if (dt.Rows[0]["hy_images"].ToString() != "")
                {
                    this.txtpicurl.Value = dt.Rows[0]["hy_images"].ToString();
                    this.lblpic.Text = "<img src='" + dt.Rows[0]["hy_images"].ToString() + "' onError=\"this.src='/images/index/images/nophoto.jpg';\" width=60px height=55px />";
                }
                if (dt.Rows[0]["hy_ifused"].ToString() == "0")
                {
                    ddlifused.Value = "0";
                }
                else
                {
                    ddlifused.Value = "1";
                }
                this.txthy_sort.Text = dt.Rows[0]["hy_sort"].ToString();
            }
        }
        else
        {
            if (JpGuidePage.GetMaxSort().Rows.Count > 0)
            {
                this.txthy_sort.Text = (Convert.ToInt32(JpGuidePage.GetMaxSort().Rows[0]["hy_sort"].ToString()) + 1).ToString();
            }
            else
            {
                this.txthy_sort.Text = "1";
            }
        }
    }
Beispiel #4
0
    private void RptBind()
    {
        if (this.Request.QueryString["page"] != null)
            this.page = int.Parse(this.Request.QueryString["page"].ToString());
        else
            this.page = 1;

        this.txtKeywords.Text = this.keywords;
        txtPageNum.Text = this.pageSize.ToString();
        txtPage.Text = this.page.ToString();

        TPortalClass.JpGuidePage JpGuidePage = new TPortalClass.JpGuidePage();

        TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
        string ls_key = JpCommon.Filter(this.txtKeywords.Text.Trim());

        DataTable dt = new DataTable();
        string ls_where = "  and   hy_name  like '%" + ls_key + "%' ";

        dt = JpGuidePage.SearchdocsByKey(ls_where, "   order  by  hy_ifused desc ,  hy_sort ", Convert.ToInt32(txtPage.Text), 10);

        this.totalCount = JpGuidePage.SearchdocsByKeyNum(ls_where);

        rptList.DataSource = dt;
        rptList.DataBind();

        string pageUrl = JpCommon.CombUrlTxt("list_guidepage.aspx", "page={0}&rnd={1}&keywords={2}",
            "__id__", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtKeywords.Text + "");
        PageContent.InnerHtml = JpCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
    }
Beispiel #5
0
    public string OutputGuidePageAndURL(string pis_yzm)
    {
        string pos_json = "";
        string ls_yzm = ConfigurationManager.AppSettings["Yanzm"].ToString();
        TPortalClass.DAO db = new DAO();

        StringBuilder sbFirst = new StringBuilder();
        StringBuilder sbSecond = new StringBuilder();
        if (pis_yzm == ls_yzm)
        {
            try
            {
                TPortalClass.JpGuidePage JpGuidePage = new JpGuidePage();
                string ss = "";
                DataTable dt = JpGuidePage.GetdocsByIfusedAndSort();
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (i == 0)
                        {
                            ss = "{\"image\":\"" + dt.Rows[i]["hy_images"].ToString() + "\",\"url\":\"" + dt.Rows[i]["hy_url"].ToString() + "\"}";
                        }
                        else
                        {
                            ss += "," + "{\"image\":\"" + dt.Rows[i]["hy_images"].ToString() + "\",\"url\":\"" + dt.Rows[i]["hy_url"].ToString() + "\"}";
                        }

                    }
                }
                pos_json = "{ \"code\": \"0\", \"list\": [" + ss + "]}";

            }
            catch
            {
                //系统错误
                pos_json = "{\"code\":\"1\"}";
            }
            finally
            {
            }
        }
        else
        {
            //非法调用
            pos_json = "{\"code\":\"2\"}";
        }
        return pos_json;
    }