Esempio n. 1
0
    //保存排序
    protected void btnSave_Click(object sender, EventArgs e)
    {
        TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
        TPortalClass.JpRole JpRole = new TPortalClass.JpRole();
        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;
            float sortId;
            if (!float.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
            {
                sortId = 99;
            }
            JpRole.Updatesort(id, sortId);
        }
        string pageUrl = JpCommon.CombUrlTxt("list_role.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('保存排序成功!');window.location='" + pageUrl + "';</script>");
    }
Esempio n. 2
0
    //批量删除
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
        TPortalClass.JpRole JpRole = new TPortalClass.JpRole();
        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)
            {
                JpRole.hy_roleid = id;
                JpRole.Delete();
            }
        }
        string pageUrl = JpCommon.CombUrlTxt("list_role.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>");
    }
Esempio n. 3
0
    //保存
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (this.Session["uid"].ToString() == "")
            this.Response.Redirect("../login.aspx");

        string ls_tip = "保存成功!";

        //新文档时
        TPortalClass.JpRole JpRole = new TPortalClass.JpRole();
        JpRole.hy_roleid = this.txthy_roleid.Text;
        JpRole.hy_rolename = this.txthy_rolename.Text;
        JpRole.hy_sort = float.Parse(this.txthy_sort.Text);
        if (this.txtop.Value == "add")
        {
            //写系统日志
            TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
            string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
            if (userip == null || userip == "")
            {
                userip = Request.ServerVariables["REMOTE_ADDR"];
            }
            JpCommon.WriteLog(userip, "新增", "新增权限记录[id:" + this.txthy_roleid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString());

            JpRole.Insert();
        }
        else
        {
            //写系统日志
            TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
            string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
            if (userip == null || userip == "")
            {
                userip = Request.ServerVariables["REMOTE_ADDR"];
            }
            JpCommon.WriteLog(userip, "修改", "修改权限记录[id:" + this.txthy_roleid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString());

            JpRole.Update();
        }
        Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
    }
Esempio n. 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.JpRole JpRole = new TPortalClass.JpRole();
        DataTable dt = JpRole.Getrolesbyrolename(this.txtKeywords.Text);
        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 = Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}",
        //        this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property, "__id__");
        TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
        string pageUrl = JpCommon.CombUrlTxt("list_role.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);
    }
Esempio n. 5
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.txthy_roleid.Text = this.Request.QueryString["id"].ToString();     //部门ID
     }
     TPortalClass.JpRole JpRole = new TPortalClass.JpRole();
     //旧文档
     if (this.txtop.Value == "modify")
     {
         txthy_roleid.Enabled = false;
         DataTable dt = JpRole.Getrole(this.txthy_roleid.Text);
         if (dt.Rows.Count > 0)
         {
             this.txthy_rolename.Text = dt.Rows[0]["hy_rolename"].ToString();
             this.txthy_sort.Text = dt.Rows[0]["hy_sort"].ToString();
         }
     }
 }