Пример #1
0
    ////保存排序
    //protected void btnSave_Click(object sender, EventArgs e)
    //{
    //    TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon();
    //    TPortalClass.HyCategory HyCategory = new TPortalClass.HyCategory();
    //    for (int i = 0; i < rptList.Items.Count; i++)
    //    {
    //        //int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
    //        string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value;
    //        int sortId;
    //        if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
    //        {
    //            sortId = 99;
    //        }
    //        HyCategory.UpdateSort(id, sortId);
    //    }
    //    string pageUrl = HyCommon.CombUrlTxt("list_category.aspx", "page={0}&rnd={1}&cid={2}",
    //        "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid_url.Text + "");
    //    //写系统日志
    //    HyCommon.WriteLog("保存排序", "批量保存类别排序号", Session["uid"].ToString(), Session["uname"].ToString());
    //    Response.Write("<script>alert('保存排序成功!');window.location='" + pageUrl + "';</script>");
    //}
    //批量删除
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon();
        TPortalClass.HyCategory HyCategory = new TPortalClass.HyCategory();
        string ls_tip = "删除成功!";
        for (int i = 0; i < rptList.Items.Count; i++)
        {
            //int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
            string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value;
            CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
            if (cb.Checked)
            {
                //判断是否还有子类别,如果有子类别不能删除
                DataTable dt_sub = HyCategory.GetAllSubColumns(id,"0");
                if (dt_sub.Rows.Count > 0)
                {
                    ls_tip = "有下一级类别的信息无法删除,请先删除下一级类别!";
                }
                else
                {
                    HyCategory.CID = id;
                    HyCategory.Delete();
                }
            }
        }
        string pageUrl = HyCommon.CombUrlTxt("list_category.aspx", "page={0}&rnd={1}&cid={2}",
            "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid_url.Text + "");

        //写系统日志

        HyCommon.WriteLog("删除", "批量删除类别记录", Session["uid"].ToString(), Session["uname"].ToString());
        Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>");
    }
Пример #2
0
 //转到第几页
 protected void btnGoto_Click(object sender, EventArgs e)
 {
     TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon();
     string pageUrl = HyCommon.CombUrlTxt("list_category.aspx", "page={0}&rnd={1}&cid={2}",
         this.txtGotoPage.Text, System.Guid.NewGuid().ToString(), this.txtcid_url.Text);
     Response.Redirect(pageUrl);
 }
Пример #3
0
    //删除图片
    protected void btndelinfo_Click(object sender, EventArgs e)
    {
        string ls_filepath1 = "", ls_filepath2 = "";
        TPortalClass.HyFileatt HyFileatt = new TPortalClass.HyFileatt();
        DataTable dt = HyFileatt.Getdocbyid(this.txtuids.Value);
        if (dt.Rows.Count > 0)
        {
            if (dt.Rows[0]["hy_fm"].ToString() == "1")
            {
                Response.Write("<script>alert('封面图片不能删除');window.location.href=window.location.href;</script>");
                return;
            }

            //删除文件夹里的图片
            ls_filepath1 = Server.MapPath("~/") + dt.Rows[0]["hy_filepath"].ToString();
            ls_filepath2 = Server.MapPath("~/") + dt.Rows[0]["hy_filepath"].ToString().Replace("thumbnail", "original");
            if (System.IO.File.Exists(ls_filepath1))
            {
                System.IO.File.Delete(ls_filepath1);
            }
            if (System.IO.File.Exists(ls_filepath2))
            {
                System.IO.File.Delete(ls_filepath2);
            }
        }

        //删除数据库记录
        HyFileatt.Delete(this.txtuids.Value);
        //操作日志
        TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon();
        HyCommon.WriteLog("删除图片", "删除图片ID:" + this.txtuids.Value, this.Session["hy_id"].ToString(), this.Session["hy_name"].ToString());
        LoadingPictures();
    }
Пример #4
0
 //关健字查询
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon();
     string pageUrl = HyCommon.CombUrlTxt("list_log.aspx", "rnd={0}&keyword_s={1}&keyword_e={2}",
         "" + System.Guid.NewGuid().ToString() + "", "" + this.txtdate_s.Text + "", "" + this.txtdate_e.Text + "");
     Response.Redirect(pageUrl);
 }
Пример #5
0
    //保存
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (this.Session["uid"] == null || this.Session["uid"].ToString() == "")
        {
            this.Response.Redirect("../login.aspx");
        }

        string ls_tip = "保存成功!";

        TPortalClass.HyContent HyContent = new TPortalClass.HyContent();
        TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon();

        HyContent.hy_typeid = this.txtcid.Value;
        HyContent.hy_addTime = this.txtpubtime.Text;
        HyContent.hy_title = this.txttitle.Text;
        HyContent.hy_contentcol = this.content1.Value;

        if (this.txtop.Value == "modify")
        {
            HyContent.ID = System.Int32.Parse(this.txtid.Value);
            //写系统日志
            HyCommon.WriteLog("修改", "修改文章记录[id:" + this.txtid.Value + "]", Session["uid"].ToString(), Session["uname"].ToString());

            HyContent.Update();
        }
        else
        {
            //for (int i = 0; i < 1000; i++)
            //{
            //    HyContent.hy_title = this.txttitle.Text + i;
            //    HyContent.Insert();
            //}

            //检查文章是否重复
            if (!HyContent.IsExist())
            {
                //写系统日志
                HyCommon.WriteLog("新增", "新增文章记录[id:" + this.txtid.Value + "]", Session["uid"].ToString(), Session["uname"].ToString());

                HyContent.Insert();
            }
            else
            {
                this.Response.Write("<script>alert('您添加的标题重复了,请重试!');window.location.href = window.location.href;</script>");
                return;
            }
        }
        Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
        return;
    }
Пример #6
0
    //设置封面
    protected void btnSzfm_Click(object sender, EventArgs e)
    {
        TPortalClass.HyFileatt HyFileatt = new TPortalClass.HyFileatt();
        DataTable dt = HyFileatt.Getdocsfm(this.txtdocid.Value);
        if (dt.Rows.Count > 0)
        {
            HyFileatt.id = dt.Rows[0]["id"].ToString();
            HyFileatt.hy_fm = 0;
            HyFileatt.UpdateFM();
        }

        HyFileatt.id = this.txtfmid.Value;
        HyFileatt.hy_fm = 1;
        HyFileatt.UpdateFM();

        //操作日志
        TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon();
        HyCommon.WriteLog("设置封面", "设置封面图片ID:" + this.txtdocid.Value, this.Session["hy_id"].ToString(), this.Session["hy_name"].ToString());
        LoadingPictures();
    }
Пример #7
0
    //批量删除
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon();
        TPortalClass.HySyslogs HySyslogs = new TPortalClass.HySyslogs();
        string ls_tip = "删除成功!";
        for (int i = 0; i < rptList.Items.Count; i++)
        {
            //int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
            string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value;
            CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
            if (cb.Checked)
            {
                HySyslogs.ID = id;
                HySyslogs.Delete();
            }
        }
        string pageUrl = HyCommon.CombUrlTxt("list_log.aspx", "page={0}&rnd={1}&keyword_s={2}&keyword_e={3}",
            "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtdate_s.Text + "", "" + this.txtdate_e.Text + "");

        HyCommon.WriteLog("删除", "批量删除操作日志记录", Session["uid"].ToString(), Session["uname"].ToString());
        Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>");
    }
Пример #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Session["uploadmessage"] = "";

        Response.CacheControl = "no-cache";

        string lspath = "";
        string ls_fatherid = Request.Params["docid"].ToString();
        string ls_userid = Request.Params["userid"].ToString();

        TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon();

        if (this.Page.Request.Files.Count > 0)
        {
            int k = 0;
            if (this.Page.Request.Files.Count > 8)
            {
                k = 8;
            }
            else
            {
                k = this.Page.Request.Files.Count;
            }
            try
            {
                for (int j = 0; j < k; j++)
                {
                    HttpPostedFile uploadFile = this.Page.Request.Files[j];

                    if (uploadFile.ContentLength > 0)
                    {
                        string ls_ny = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString();
                        string ls_name = uploadFile.FileName;
                        string filename = DateTime.Now.ToString("mmddhhMMss_") + uploadFile.FileName;

                        //将附件上传到服务器目录下
                        lspath = Server.MapPath("~/");  //虚拟目录的位置
                        string lsurl1 = "/upload/original/" + ls_ny;  //原图存放的文件夹
                        string lsurl2 = "/upload/thumbnail/" + ls_ny;    //缩略图存放的文件夹
                        Directory.CreateDirectory(lspath + "/" + lsurl1);
                        Directory.CreateDirectory(lspath + "/" + lsurl2);
                        string str_path1 = lspath + "/" + lsurl1 + "/" + filename;
                        string str_path2 = lspath + "/" + lsurl2 + "/" + filename;
                        uploadFile.SaveAs(str_path1);
                        //压缩图片处理
                        HyCommon.MakeThumbnail(str_path1, str_path2, 290, 290, "WH");

                        //保存数据
                        TPortalClass.HyFileatt HyFileatt = new TPortalClass.HyFileatt();
                        HyFileatt.id = System.Guid.NewGuid().ToString();
                        HyFileatt.hy_addtime = System.DateTime.Now.ToString("yyyy-MM-dd");
                        HyFileatt.hy_fatherid = ls_fatherid;
                        HyFileatt.hy_userid = ls_userid;
                        HyFileatt.hy_filepath = lsurl2 + "/" + filename;
                        HyFileatt.hy_filesize = "";
                        if (HyFileatt.IsExist(ls_fatherid))
                        {
                            HyFileatt.hy_fm = 0;
                        }
                        else
                        {
                            HyFileatt.hy_fm = 1;
                        }
                        if (ls_name.IndexOf(".") >= 0)
                        {
                            HyFileatt.hy_filename = ls_name.Substring(0, ls_name.LastIndexOf("."));
                        }
                        else
                        {
                            HyFileatt.hy_filename = "";
                        }
                        HyFileatt.Insert();
                        //操作日志

                        HyCommon.WriteLog("上传图片", "上传图片", ls_userid, ls_userid);
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write("Message" + ex.ToString());
            }
            finally
            {
            }
        }
    }
Пример #9
0
    private void RptBind()
    {
        if (this.Request.QueryString["page"] != null)
            this.page = int.Parse(this.Request.QueryString["page"].ToString());
        else
            this.page = 1;

        if (this.Request.QueryString["cid"] != null)
            this.txtcid_url.Text = this.Request.QueryString["cid"].ToString();

        //如果depid等于空,则返回按钮隐藏
        if (this.Request.QueryString["cid"] == null || this.Request.QueryString["cid"] == "")
        {
            this.fhsjlb.Visible = false;
        }

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

        TPortalClass.HyCategory HyCategory = new TPortalClass.HyCategory();
        DataTable dt = new DataTable();

        if (this.txtcid_url.Text == "")
        {
            //列出一级类别 0001
            dt = HyCategory.GetFirstlevCategory("0", page, pageSize);
            this.totalCount = HyCategory.GetFirstlevCategoryNum("0");
        }
        else
        {
            //列出子级类别 00010001....
            dt = HyCategory.GetSubCategory(this.txtcid_url.Text, "0", page, pageSize);
            this.totalCount = HyCategory.GetSubCategoryNum(this.txtcid_url.Text, "0");
        }

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

        TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon();
        string pageUrl = HyCommon.CombUrlTxt("list_category.aspx", "page={0}&rnd={1}&cid={2}",
            "__id__", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid_url.Text + "");
        PageContent.InnerHtml = HyCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
    }
Пример #10
0
    private void RptBind()
    {
        if (this.Request.QueryString["page"] != null)
            this.page = int.Parse(this.Request.QueryString["page"].ToString());
        else
            this.page = 1;

        this.txtdate_s.Text = this.keyword_s;
        this.txtdate_e.Text = this.keyword_e;
        txtPageNum.Text = this.pageSize.ToString();
        txtPage.Text = this.page.ToString();

        TPortalClass.HySyslogs HySyslogs = new TPortalClass.HySyslogs();

        TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon();
        string ls_kssj = this.txtdate_s.Text;
        string ls_jssj = this.txtdate_e.Text;

        DataTable dt = HySyslogs.Getlogs_search(ls_kssj, ls_jssj);
        this.totalCount = dt.Rows.Count;
        DataTable tempTable = dt.Clone();
        for (int i = (this.page - 1) * this.pageSize; i < this.page * this.pageSize; i++)
        {
            if (i > dt.Rows.Count - 1)
                break;

            DataRow dr = tempTable.NewRow();
            for (int j = 0; j < dt.Columns.Count; j++)
            {
                dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
            }
            tempTable.Rows.Add(dr);
        }
        rptList.DataSource = tempTable;
        rptList.DataBind();

        string pageUrl = HyCommon.CombUrlTxt("list_log.aspx", "page={0}&rnd={1}&keyword_s={2}&keyword_e={3}",
            "__id__", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtdate_s.Text + "", "" + this.txtdate_e.Text + "");
        PageContent.InnerHtml = HyCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
    }