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/UserSettings/UserSettingService.aspx.cs

98 lines
2.7 KiB
C#

using System;
using System.Collections;
using System.Configuration;
using System.Data;
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.IO;
namespace DSWeb.UserSettings
{
public partial class UserSettingService : System.Web.UI.Page
{
private string strHandle;
private int iType;//类型
private string strUserID;
private string strCompanyID;//公司GID
private string strShowName;//用户显示名
private string strDeptName;//部门名称
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString();
}
if (Session["SHOWNAME"] != null)
{
strShowName = Session["SHOWNAME"].ToString();
}
if (Session["COMPANYID"] != null)
{
strCompanyID = Session["COMPANYID"].ToString();
}
if (Session["DEPTNAME"] != null)
{
strDeptName = Session["DEPTNAME"].ToString();
}
if (Request.QueryString["handle"] != null)
{
strHandle = Request.QueryString["handle"].ToString().Trim().ToLower();
}
if (Request.QueryString["type"] != null)
{
iType = int.Parse(Request.QueryString["type"].ToString());
}
else
{
iType = 0;
}
if (strHandle != null)
{
Response.Write(SaveUserSetting(strUserID));
}
}
private int SaveUserSetting(string tempUserID)
{
int iResult = 0;
string strResult = "";
string strTempTemplateName = "../Templates/";
string strAbsFilePath = "";
string AbsPath = Server.MapPath(strTempTemplateName);
strAbsFilePath += AbsPath + tempUserID + ".js";
//获取绝对地址
if (!Directory.Exists(AbsPath))
{
Directory.CreateDirectory(AbsPath);
}
if (File.Exists(strAbsFilePath))
{
using(StreamReader sr = File.OpenText(strAbsFilePath))
{
string s = "";
while((s = sr.ReadLine())!= null)
{
strResult += s.Replace("\t","");
}
}
}
return iResult;
}
}
}