You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Users/usergrid.aspx.cs

89 lines
3.1 KiB
C#

3 years ago
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
using System.Text;
using DSWeb.EntityDA;
namespace DSWeb.Users
{
public partial class usergrid : System.Web.UI.Page
{
//string strPath = System.Web.HttpContext.Current.Request.Path;
private const string strSql = " SELECT A.GID,A.USERNAME,A.CODENAME,A.PASSWORD,A.SHOWNAME,A.ENROLLTIME,D.USERNAME as CREATEUSER,C.NAME as COMPANYNAME,'../users/edit.aspx?handle=edit&id=' as OpenHandle "
+ " FROM [user] as A INNER JOIN user_company as B ON A.GID = B.USERID INNER JOIN company as C ON B.COMPANYID = C.GID INNER JOIN [user] as D ON A.CREATEUSER = D.GID ";
public string strUserID;//登录用户GID
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString();
}
else
{
Server.Transfer("~/Error/FriendError.aspx");
return;
//strUserID = "";
//hdUserID.Value = "";
}
if (!IsPostBack)
{
this.wucGridView1.gvBind(strSql);
//GridView grid = (GridView)this.wucGridView1.Controls[0].FindControl("GridView1");
//grid.Columns[1].Visible = false;
//grid.Columns[grid.Columns.Count - 1].Visible = false;
}
if (Request.QueryString["getinfo"] != null)
{
GetInfo(strSql);
Response.End();
}
if (Request.QueryString["refresh"] != null)
{
wucGridView1.gvBind(strSql);
Response.End();
}
}
private void GetInfo(string sql) //右键详细菜单函数
{
int id = 0;
if (!int.TryParse(Request.QueryString["id"], out id))
{
Response.Write("error");
return;
}
//string sql = "select * from price_cust where pcid=" + id.ToString();
DataTable dt = DB.GetTable(sql);
if (dt.Rows.Count == 0)
{
Response.Write("error");
return;
}
DataRow row = dt.Rows[0];
StringBuilder sb = new StringBuilder();
sb.Append("<table>");
sb.AppendFormat("<tr><td>详细信息</td></tr>");
sb.AppendFormat("<tr><td>ID</td><td>{0}</td></tr>", row["GID"]);
sb.AppendFormat("<tr><td>报价单号:</td><td>{0}</td></tr>", row["USERNAME"]);
sb.AppendFormat("<tr><td>客户名称:</td><td>{0}</td></tr>", row["CODENAME"]);
sb.AppendFormat("<tr><td>录入人:</td><td>{0}</td></tr>", row["PASSWORD"]);
sb.Append("</table>");
Response.Write(sb.ToString());
}
}
}