123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace LYFZ.WeixinServers.WeiXinAPP
- {
- public partial class AuthorizationInfoLis : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- CommonHandler.CheckLoginJump(this);
- if (!IsPostBack)
- {
- if (Request.QueryString["Keyword"] != null)
- {
- Keyword = Request.QueryString["Keyword"].ToString().Trim();
- }
- if (Request.QueryString["type"] != null)
- {
- if (Request.QueryString["type"].ToString().Trim() == "refresh")
- {
- Global.RefreshLoadAuthorizationInfoDaTable();
- }
- }
- if (Request.QueryString["del"] != null && Request.QueryString["del"].ToString().Length>0)
- {
- try
- {
- if (CommonHandler.CheckAdmin(this))
- {
- int delID = Convert.ToInt32(Request.QueryString["del"].ToString());
-
- deleteAuthorization_info(delID);
-
- }
-
- }
- catch (Exception ex){
- showMsegesBox("删除失败,请重试.错误原因:"+ex.Message);
- }
- }
- }
- bindUserList();
- }
- string Keyword = "";
- public string PagingInfoHtml = "";
- void deleteAuthorization_info(int id)
- {
- if (Authorization_infoDal.Delete(id))
- {
- this.Response.Redirect("AuthorizationInfoLis.aspx");
- }
- else {
- showMsegesBox("删除失败,请重试.");
- }
- }
- void showMsegesBox(string msg)
- {
- Response.Write("<script>alert('" + msg + "');document.location='AuthorizationInfoLis.aspx';</script>"); return;
- }
- LYFZ.WeixinServiceDate.DAL.DAL_Authorization_info Authorization_infoDal = new WeixinServiceDate.DAL.DAL_Authorization_info();
- public System.Text.StringBuilder Authorization_infoListHtmlTb = new System.Text.StringBuilder();
- void bindUserList()
- {
- string whereStr = "";
- if (Keyword.Length > 0)
- {
- whereStr = " [JMGDomainName] like '%" + Keyword + "%' or [CompanyName] like '%" + Keyword + "%' or [authorizer_appid] like '%" + Keyword + "%' ";
- }
- DataRow[] cacheRows = Global.AuthorizationInfoDaTable.Select(whereStr.Trim(), "id desc");
- int sumCount = cacheRows.Length;
- string countInfo = "当前缓存共" + sumCount.ToString() + "条记录";
- PagingInfoHtml = LYFZ.WXLibrary.PageTabList.GetPagingInfo_Web(1, 1, countInfo);
- DataTable authorizationInfoDaTable = Global.AuthorizationInfoDaTable;// Authorization_infoDal.GetList("1=1");
- for (int i = 0; i < cacheRows.Length; i++)
- {
- DataRow row = cacheRows[i];//authorizationInfoDaTable.Rows[i];
- string AuthorizeStatus = row["AuthorizeStatus"].ToString() == "0" ? "已取消授权" : "已授权";
- Authorization_infoListHtmlTb.Append("<tr>"
- + " <td>" + row["id"].ToString() + "</td>"
- + " <td>" + row["CompanyName"].ToString() + "<br />" + row["JMGDomainName"].ToString() + "</td>"
- + " <td>" + row["authorizer_appid"].ToString() + "</td>"
- + " <td>" + AuthorizeStatus + "</td>"
- + " <td><b>授权令牌(Access_token):</b>" + row["authorizer_access_token"].ToString() + "<br /><b>令牌有效时间(Expires_in):</b>" + row["expires_in"].ToString() + "<br /><b>授权刷新令牌(Access_refresh_token):</b>" + row["authorizer_refresh_token"].ToString() + "<br /><b>最新刷新令牌的时间:</b>" + Convert.ToDateTime(row["RefreshTokenTime"]).ToString("yyyy-MM-dd HH:mm") + "</td>"
- + "<td>" + Convert.ToDateTime(row["CreateTime"]).ToString("yyyy-MM-dd HH:mm") + "</td>"
- + "<td>" + Convert.ToDateTime(row["UpdateTime"]).ToString("yyyy-MM-dd HH:mm") + "</td>"
- + " <td>"
- + "<a href=\"AuthorizationInfoLis.aspx?eid=" + row["id"].ToString() + "&authorizer_appid=" + row["authorizer_appid"].ToString() + "\" style=\"margin-right:10px;\"><i class=\"icon-pencil\"></i></a>"
- + "<a href=\"#myModal\" role=\"button\" onclick=\"setModalValue(" + row["id"].ToString() + ")\" data-toggle=\"modal\"><i class=\"icon-remove\"></i></a>"
- + "</td>"
- + " </tr>");
- }
- }
-
- }
- }
|