//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml)] public STReturn Login_UserName(string UserName, string LoginPwd) { // 先清除已登录数据 Session.Clear(); STReturn stReturn = new STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (LoginPwd.Length < 1) { stReturn.NReturn = -1; stReturn.ExMsg = "密码不允许为空"; return(stReturn); } System.Security.Cryptography.SHA512 SHA512 = System.Security.Cryptography.SHA512.Create(); byte[] binLoginPwd = SHA512.ComputeHash(System.Text.Encoding.Unicode.GetBytes(LoginPwd)); stReturn = DBLogin(UserName, binLoginPwd); // Session操作 if (stReturn.NReturn > 0) { ApqSession.User = stReturn.FNReturn as DataTable; } ApqSession.LoginTime = DateTime.Now; return(stReturn); }
public STReturn Login_UserNameFromCookie(string UserName, string SqlLoginPwd) { // 先清除已登录数据 Session.Clear(); STReturn stReturn = new STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (SqlLoginPwd.Length < 63) { stReturn.NReturn = -1; stReturn.ExMsg = "密码不允许为空"; return(stReturn); } byte[] binLoginPwd = Apq.Data.SqlClient.Common.ParseSqlON <byte[]>(System.Data.SqlDbType.VarBinary, SqlLoginPwd) as byte[]; stReturn = DBLogin(UserName, binLoginPwd); // Session操作 if (stReturn.NReturn > 0) { ApqSession.User = stReturn.FNReturn as DataTable; } ApqSession.LoginTime = DateTime.Now; return(stReturn); }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public Apq.STReturn TaskAdd(string TaskName, string TaskContent, DateTime BTime, DateTime ETime, long AddinID, decimal Price, decimal ParentPrice , bool NeedChangeIP, bool IsAutoStart, decimal TaskMoney) { Apq.STReturn stReturn = new Apq.STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckPwdExpire(ref stReturn, ApqSession)) { return(stReturn); } long UserID = System.Convert.ToInt64(ApqSession.User.Rows[0]["UserID"]); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlCommand sc = new SqlCommand("dtxc.Apq_Task_Insert", SqlConn); sc.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("_OperID", UserID); dch.AddParameter("_OpTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); IPAddress ipa; if (IPAddress.TryParse(HttpContext.Current.Request.UserHostAddress, out ipa)) { dch.AddParameter("_OperIP", ipa.GetAddressBytes()); } dch.AddParameter("TaskName", TaskName); dch.AddParameter("TaskContent", TaskContent); dch.AddParameter("BTime", BTime); dch.AddParameter("ETime", ETime); dch.AddParameter("AddinID", AddinID); dch.AddParameter("Price", Price); dch.AddParameter("ParentPrice", ParentPrice); dch.AddParameter("NeedChangeIP", NeedChangeIP); dch.AddParameter("IsAutoStart", IsAutoStart); dch.AddParameter("TaskMoney", TaskMoney); dch.AddParameter("TaskID", 0); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; sc.Parameters["TaskID"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.ExMsg = sc.Parameters["ExMsg"].Value.ToString(); stReturn.POuts = new object[] { sc.Parameters["TaskID"].Value }; sc.Dispose(); SqlConn.Close(); } return(stReturn); }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn TaskListSelf(int Pager_Page, int Pager_PageSize, int[] Status) { STReturn stReturn = new STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckPwdExpire(ref stReturn, ApqSession)) { return(stReturn); } DataSet ds = new DataSet(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.GlobalObject.SqlConnectionString)) { DataTable dtStatus = new DataTable(); dtStatus.Columns.Add("ID", typeof(int)); foreach (int i in Status) { dtStatus.Rows.Add(i); } SqlDataAdapter sda = new SqlDataAdapter("dtxc.Apq_Task_ListSelf", SqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sda.SelectCommand); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("Pager_Page", Pager_Page, DbType.Int32); dch.AddParameter("Pager_PageSize", Pager_PageSize); dch.AddParameter("Pager_RowCount", 0, DbType.Int32); dch.AddParameter("UserID", ApqSession.UserID); sda.SelectCommand.Parameters.Add("Status", SqlDbType.Structured); sda.SelectCommand.Parameters["Status"].TypeName = "tvp:t_int"; sda.SelectCommand.Parameters["Status"].Value = dtStatus; sda.SelectCommand.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sda.SelectCommand.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_Page"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_RowCount"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sda.Fill(ds); stReturn.NReturn = System.Convert.ToInt32(sda.SelectCommand.Parameters["rtn"].Value); stReturn.ExMsg = sda.SelectCommand.Parameters["ExMsg"].Value.ToString(); stReturn.FNReturn = ds.Tables[0]; stReturn.POuts = new object[] { sda.SelectCommand.Parameters["Pager_Page"].Value, sda.SelectCommand.Parameters["Pager_RowCount"].Value }; sda.Dispose(); SqlConn.Close(); } return(stReturn); }
public pdbp.WS.STReturn Login_LoginName(string LoginName, string LoginPwd) { pdbp.WS.Login Lg = new pdbp.WS.Login(); pdbp.WS.STReturn stReturn = Lg.Login_LoginName(LoginName, LoginPwd); if (stReturn.NReturn == 1) { Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(HttpContext.Current.Session); // 记录登录状态 ApqSession.UserID = Apq.Convert.ChangeType<long>(stReturn.POuts[0]); ApqSession.NickName = Apq.Convert.ChangeType<string>(stReturn.POuts[2]); ApqSession.LoginName = LoginName; ApqSession.LoginTime = DateTime.Now; // 写入客户端Cookie if (HttpContext.Current.Response.Cookies.AllKeys.Contains(ConfigurationManager.AppSettings["Cookie-UserSrc"])) HttpContext.Current.Response.Cookies.Remove(ConfigurationManager.AppSettings["Cookie-UserSrc"]); if (HttpContext.Current.Response.Cookies.AllKeys.Contains(ConfigurationManager.AppSettings["Cookie-LoginName"])) HttpContext.Current.Response.Cookies.Remove(ConfigurationManager.AppSettings["Cookie-LoginName"]); if (HttpContext.Current.Response.Cookies.AllKeys.Contains(ConfigurationManager.AppSettings["Cookie-LoginPwd"])) HttpContext.Current.Response.Cookies.Remove(ConfigurationManager.AppSettings["Cookie-LoginPwd"]); HttpCookie cookieUserSrc = new HttpCookie(ConfigurationManager.AppSettings["Cookie-UserSrc"], "1"); HttpCookie cookieLoginName = new HttpCookie(ConfigurationManager.AppSettings["Cookie-LoginName"], LoginName); HttpCookie cookieLoginPwd = new HttpCookie(ConfigurationManager.AppSettings["Cookie-LoginPwd"], Apq.Convert.ChangeType<string>(stReturn.POuts[1])); cookieUserSrc.Expires = cookieLoginName.Expires = cookieLoginPwd.Expires = DateTime.Now.AddYears(1); HttpContext.Current.Response.Cookies.Add(cookieUserSrc); HttpContext.Current.Response.Cookies.Add(cookieLoginName); HttpContext.Current.Response.Cookies.Add(cookieLoginPwd); } return stReturn; }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn UserEdit(long UserID, string Name, string UserName, string LoginPwd, short Sex, string PhotoUrl, DateTime Expire, bool Status , bool IsAdmin, DateTime Birthday, int UserType, string IDCard, string Alipay) { STReturn stReturn = new STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckAdmin(ref stReturn, ApqSession)) { return(stReturn); } using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlCommand sc = new SqlCommand("dtxc.dtxc_Users_Update", SqlConn); sc.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("_OperID", ApqSession.UserID); dch.AddParameter("_OpTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); IPAddress ipa; if (IPAddress.TryParse(HttpContext.Current.Request.UserHostAddress, out ipa)) { dch.AddParameter("_OperIP", ipa.GetAddressBytes()); } dch.AddParameter("UserID", UserID); dch.AddParameter("Name", Name); dch.AddParameter("UserName", UserName); dch.AddParameter("LoginPwd", LoginPwd); dch.AddParameter("Sex", Sex); dch.AddParameter("PhotoUrl", PhotoUrl); dch.AddParameter("Expire", Expire.ToString("yyyy-MM-dd HH:mm:ss.fff")); dch.AddParameter("Status", Status); dch.AddParameter("IsAdmin", IsAdmin); dch.AddParameter("UserType", UserType); dch.AddParameter("Birthday", Birthday); dch.AddParameter("IDCard", IDCard); dch.AddParameter("Alipay", Alipay); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.ExMsg = sc.Parameters["ExMsg"].Value.ToString(); sc.Dispose(); SqlConn.Close(); } return(stReturn); }
/// <summary> /// 检测是否管理员 /// </summary> /// <param name="stReturn"></param> public static bool CheckAdmin(ref Apq.STReturn stReturn, Apq.Web.SessionState.HttpSessionState ApqSession) { if (!ApqSession.IsAdmin) { stReturn.NReturn = -1; stReturn.ExMsg = "只有管理员才能访问该页面"; return(false); } return(true); }
/// <summary> /// 检测是否登录 /// </summary> /// <param name="stReturn"></param> public static bool CheckLogin(ref Apq.STReturn stReturn, Apq.Web.SessionState.HttpSessionState ApqSession) { if (ApqSession.User == null || ApqSession.User.Rows.Count == 0) { stReturn.NReturn = -1; stReturn.ExMsg = "请登录"; return(false); } return(true); }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public Apq.STReturn UserEditSelf(long UserID, string Name, short Sex, string PhotoUrl, DateTime Birthday , string IDCard, string Alipay) { Apq.STReturn stReturn = new Apq.STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckPwdExpire(ref stReturn, ApqSession)) { return stReturn; } using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlCommand sc = new SqlCommand("dtxc.dtxc_User_UpdateSelf", SqlConn); sc.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("_OperID", ApqSession.UserID); dch.AddParameter("_OpTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); IPAddress ipa; if (IPAddress.TryParse(HttpContext.Current.Request.UserHostAddress, out ipa)) { dch.AddParameter("_OperIP", ipa.GetAddressBytes()); } dch.AddParameter("UserID", UserID); dch.AddParameter("Name", Name); dch.AddParameter("Sex", Sex); dch.AddParameter("PhotoUrl", PhotoUrl); //dch.AddParameter("Expire", Expire.ToString("yyyy-MM-dd HH:mm:ss.fff")); //dch.AddParameter("Status", Status); //dch.AddParameter("IsAdmin", IsAdmin); dch.AddParameter("Birthday", Birthday); dch.AddParameter("IDCard", IDCard); dch.AddParameter("Alipay", Alipay); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.ExMsg = sc.Parameters["ExMsg"].Value.ToString(); sc.Dispose(); SqlConn.Close(); } return stReturn; }
public static bool CheckPwdExpire(ref Apq.STReturn stReturn, Apq.Web.SessionState.HttpSessionState ApqSession) { /* * if (Convert.ToDateTime(ApqSession.User.Rows[0]["LoginPwdExpire"]) > DateTime.Now) * { * stReturn.NReturn = -1 * stReturn.ExMsg = "密码已过期,请修改密码"; * return false; * } */ return(true); }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn AddinAdd(string AddinName, string AddinUrl, string AddinDescript) { STReturn stReturn = new STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckAdmin(ref stReturn, ApqSession)) { return(stReturn); } long UserID = Convert.ToInt64(ApqSession.User.Rows[0]["UserID"]); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlCommand sc = new SqlCommand("dtxc.Apq_Addin_Insert", SqlConn); sc.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("_OperID", UserID); dch.AddParameter("_OpTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); IPAddress ipa; if (IPAddress.TryParse(HttpContext.Current.Request.UserHostAddress, out ipa)) { dch.AddParameter("_OperIP", ipa.GetAddressBytes()); } dch.AddParameter("AddinName", AddinName); dch.AddParameter("AddinUrl", AddinUrl); dch.AddParameter("AddinDescript", AddinDescript); dch.AddParameter("AddinID", 0); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; sc.Parameters["AddinID"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.ExMsg = sc.Parameters["ExMsg"].Value.ToString(); stReturn.POuts = new object[] { sc.Parameters["AddinID"].Value }; sc.Dispose(); SqlConn.Close(); } return(stReturn); }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn UsersListChild(int Pager_Page, int Pager_PageSize, long UserID, bool ContainsSelf, bool ContainsGrand) { STReturn stReturn = new STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckAdmin(ref stReturn, ApqSession)) { return(stReturn); } DataSet ds = new DataSet(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.GlobalObject.SqlConnectionString)) { SqlDataAdapter sda = new SqlDataAdapter("dtxc.Apq_Users_ListChild", SqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sda.SelectCommand); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("Pager_Page", Pager_Page, DbType.Int32); dch.AddParameter("Pager_PageSize", Pager_PageSize); dch.AddParameter("Pager_RowCount", 0, DbType.Int32); dch.AddParameter("UserID", UserID); dch.AddParameter("ContainsSelf", ContainsSelf); dch.AddParameter("ContainsGrand", ContainsGrand); sda.SelectCommand.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sda.SelectCommand.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_Page"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_RowCount"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sda.Fill(ds); stReturn.NReturn = System.Convert.ToInt32(sda.SelectCommand.Parameters["rtn"].Value); stReturn.ExMsg = sda.SelectCommand.Parameters["ExMsg"].Value.ToString(); stReturn.FNReturn = ds.Tables[0]; stReturn.POuts = new object[] { sda.SelectCommand.Parameters["Pager_Page"].Value, sda.SelectCommand.Parameters["Pager_RowCount"].Value }; sda.Dispose(); SqlConn.Close(); } return(stReturn); }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public Apq.STReturn AddinList(int start, int limit, short IsLookup, long LookupID) { Apq.STReturn stReturn = new Apq.STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckAdmin(ref stReturn, ApqSession)) { return(stReturn); } DataSet ds = new DataSet(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlDataAdapter sda = new SqlDataAdapter("dtxc.Apq_Addin_List", SqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sda.SelectCommand); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("Pager_Page", start / limit + 1, DbType.Int32); dch.AddParameter("Pager_PageSize", limit); dch.AddParameter("Pager_RowCount", 0, DbType.Int32); dch.AddParameter("IsLookup", IsLookup, DbType.Int16); dch.AddParameter("LookupID", LookupID); sda.SelectCommand.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sda.SelectCommand.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_Page"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_RowCount"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sda.Fill(ds); stReturn.NReturn = System.Convert.ToInt32(sda.SelectCommand.Parameters["rtn"].Value); stReturn.ExMsg = sda.SelectCommand.Parameters["ExMsg"].Value.ToString(); stReturn.FNReturn = ds.Tables[0]; stReturn.POuts = new object[] { sda.SelectCommand.Parameters["Pager_Page"].Value, sda.SelectCommand.Parameters["Pager_RowCount"].Value }; sda.Dispose(); SqlConn.Close(); } return(stReturn); }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public Apq.STReturn AddinList(int start, int limit, short IsLookup, long LookupID) { Apq.STReturn stReturn = new Apq.STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckAdmin(ref stReturn, ApqSession)) { return stReturn; } DataSet ds = new DataSet(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlDataAdapter sda = new SqlDataAdapter("dtxc.Apq_Addin_List", SqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sda.SelectCommand); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("Pager_Page", start / limit + 1, DbType.Int32); dch.AddParameter("Pager_PageSize", limit); dch.AddParameter("Pager_RowCount", 0, DbType.Int32); dch.AddParameter("IsLookup", IsLookup, DbType.Int16); dch.AddParameter("LookupID", LookupID); sda.SelectCommand.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sda.SelectCommand.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_Page"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_RowCount"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sda.Fill(ds); stReturn.NReturn = System.Convert.ToInt32(sda.SelectCommand.Parameters["rtn"].Value); stReturn.ExMsg = sda.SelectCommand.Parameters["ExMsg"].Value.ToString(); stReturn.FNReturn = ds.Tables[0]; stReturn.POuts = new object[]{ sda.SelectCommand.Parameters["Pager_Page"].Value, sda.SelectCommand.Parameters["Pager_RowCount"].Value }; sda.Dispose(); SqlConn.Close(); } return stReturn; }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn dtxc_Users_ListChild_Pager(int Pager_Page, int Pager_PageSize, long UserID) { STReturn stReturn = new STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckAdmin(ref stReturn, ApqSession)) { return stReturn; } DataSet ds = new DataSet(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlDataAdapter sda = new SqlDataAdapter("dtxc.dtxc_Users_ListChild_Pager", SqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sda.SelectCommand); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("Pager_Page", Pager_Page, DbType.Int32); dch.AddParameter("Pager_PageSize", Pager_PageSize); dch.AddParameter("Pager_RowCount", 0, DbType.Int32); dch.AddParameter("UserID", UserID); sda.SelectCommand.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sda.SelectCommand.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_Page"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_RowCount"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sda.Fill(ds); stReturn.NReturn = System.Convert.ToInt32(sda.SelectCommand.Parameters["rtn"].Value); stReturn.ExMsg = sda.SelectCommand.Parameters["ExMsg"].Value.ToString(); stReturn.FNReturn = ds.Tables[0]; stReturn.POuts = new object[]{ sda.SelectCommand.Parameters["Pager_Page"].Value, sda.SelectCommand.Parameters["Pager_RowCount"].Value }; sda.Dispose(); SqlConn.Close(); } return stReturn; }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public Apq.STReturn TaskListCanTake(int Pager_Page, int Pager_PageSize) { Apq.STReturn stReturn = new Apq.STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckPwdExpire(ref stReturn, ApqSession)) { return(stReturn); } DataSet ds = new DataSet(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlDataAdapter sda = new SqlDataAdapter("dtxc.Apq_Task_ListCanTake", SqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sda.SelectCommand); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("Pager_Page", Pager_Page, DbType.Int32); dch.AddParameter("Pager_PageSize", Pager_PageSize); dch.AddParameter("Pager_RowCount", 0, DbType.Int32); dch.AddParameter("UserID", ApqSession.UserID); sda.SelectCommand.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sda.SelectCommand.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_Page"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_RowCount"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sda.Fill(ds); stReturn.NReturn = System.Convert.ToInt32(sda.SelectCommand.Parameters["rtn"].Value); stReturn.ExMsg = sda.SelectCommand.Parameters["ExMsg"].Value.ToString(); stReturn.FNReturn = ds.Tables[0]; stReturn.POuts = new object[] { sda.SelectCommand.Parameters["Pager_Page"].Value, sda.SelectCommand.Parameters["Pager_RowCount"].Value }; sda.Dispose(); SqlConn.Close(); } return(stReturn); }
/// <summary> /// 检测是否管理员 /// </summary> /// <param name="stReturn"></param> public static bool CheckAdmin(ref Apq.STReturn stReturn, Apq.Web.SessionState.HttpSessionState ApqSession) { if (!CheckPwdExpire(ref stReturn, ApqSession)) { return(false); } if (!System.Convert.ToBoolean(ApqSession.User.Rows[0]["IsAdmin"])) { stReturn.NReturn = -1; stReturn.ExMsg = "非管理员不能使用该功能"; return(false); } return(true); }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn NewsList(int Pager_Page, int Pager_PageSize) { STReturn stReturn = new STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); //if (!CheckLogin(ref stReturn, ApqSession)) //{ // return stReturn; //} DataSet ds = new DataSet(); long UserID = Convert.ToInt64(ApqSession.User.Rows[0]["UserID"]); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.GlobalObject.SqlConnectionString)) { SqlDataAdapter sda = new SqlDataAdapter("dtxc.News_List", SqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sda.SelectCommand); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("Pager_Page", Pager_Page); dch.AddParameter("Pager_PageSize", Pager_PageSize); dch.AddParameter("Pager_RowCount", 0, DbType.Int32); sda.SelectCommand.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sda.SelectCommand.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_RowCount"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sda.Fill(ds); stReturn.NReturn = System.Convert.ToInt32(sda.SelectCommand.Parameters["rtn"].Value); stReturn.ExMsg = sda.SelectCommand.Parameters["ExMsg"].Value.ToString(); stReturn.FNReturn = ds.Tables[0]; stReturn.POuts = new object[] { sda.SelectCommand.Parameters["Pager_RowCount"].Value }; sda.Dispose(); SqlConn.Close(); } return(stReturn); }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn TaskDelete(long TaskID) { STReturn stReturn = new STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckPwdExpire(ref stReturn, ApqSession)) { return(stReturn); } long UserID = Convert.ToInt64(ApqSession.User.Rows[0]["UserID"]); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.GlobalObject.SqlConnectionString)) { SqlCommand sc = new SqlCommand("dtxc.Apq_Task_Delete", SqlConn); sc.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("_OperID", UserID); dch.AddParameter("_OpTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); IPAddress ipa; if (IPAddress.TryParse(HttpContext.Current.Request.UserHostAddress, out ipa)) { dch.AddParameter("_OperIP", ipa.GetAddressBytes()); } dch.AddParameter("TaskID", TaskID); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.ExMsg = sc.Parameters["ExMsg"].Value.ToString(); sc.Dispose(); SqlConn.Close(); } return(stReturn); }
protected override void OnInit(EventArgs e) { base.OnInit(e); ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); string UserName = Request.Cookies["UserName"] == null ? string.Empty : Request.Cookies["UserName"].Value; string SqlLoginPwd = Request.Cookies["SqlLoginPwd"] == null ? string.Empty : Request.Cookies["SqlLoginPwd"].Value; if (ApqSession.User == null || ApqSession.User.Rows.Count == 0) { if (UserName.Length > 1 && SqlLoginPwd.Length > 2) { dtxc.WS.WS2 ws = new dtxc.WS.WS2(); ws.Login_UserNameFromCookie(UserName, SqlLoginPwd); } } }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public Apq.STReturn NewsList(int Pager_Page, int Pager_PageSize) { Apq.STReturn stReturn = new Apq.STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); //if (!CheckLogin(ref stReturn, ApqSession)) //{ // return stReturn; //} DataSet ds = new DataSet(); long UserID = System.Convert.ToInt64(ApqSession.User.Rows[0]["UserID"]); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.GlobalObject.SqlConnectionString)) { SqlDataAdapter sda = new SqlDataAdapter("dtxc.News_List", SqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sda.SelectCommand); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("Pager_Page", Pager_Page); dch.AddParameter("Pager_PageSize", Pager_PageSize); dch.AddParameter("Pager_RowCount", 0, DbType.Int32); sda.SelectCommand.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sda.SelectCommand.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_RowCount"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sda.Fill(ds); stReturn.NReturn = System.Convert.ToInt32(sda.SelectCommand.Parameters["rtn"].Value); stReturn.ExMsg = sda.SelectCommand.Parameters["ExMsg"].Value.ToString(); stReturn.FNReturn = ds.Tables[0]; stReturn.POuts = new object[]{ sda.SelectCommand.Parameters["Pager_RowCount"].Value }; sda.Dispose(); SqlConn.Close(); } return stReturn; }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public Apq.STReturn UserPayoutReg(decimal Payout) { Apq.STReturn stReturn = new Apq.STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckPwdExpire(ref stReturn, ApqSession)) { return(stReturn); } using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlCommand sc = new SqlCommand("dtxc.dtxc_Payout_Reg", SqlConn); sc.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("_OperID", ApqSession.UserID); dch.AddParameter("_OpTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); IPAddress ipa; if (IPAddress.TryParse(HttpContext.Current.Request.UserHostAddress, out ipa)) { dch.AddParameter("_OperIP", ipa.GetAddressBytes()); } dch.AddParameter("Payout", Payout); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.ExMsg = sc.Parameters["ExMsg"].Value.ToString(); sc.Dispose(); SqlConn.Close(); } return(stReturn); }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public Apq.STReturn AddinListOne(long AddinID) { Apq.STReturn stReturn = new Apq.STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckAdmin(ref stReturn, ApqSession)) { return(stReturn); } DataSet ds = new DataSet(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlDataAdapter sda = new SqlDataAdapter("dtxc.Apq_Addin_ListOne", SqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sda.SelectCommand); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("AddinID", AddinID); sda.SelectCommand.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sda.SelectCommand.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sda.Fill(ds); stReturn.NReturn = System.Convert.ToInt32(sda.SelectCommand.Parameters["rtn"].Value); stReturn.ExMsg = sda.SelectCommand.Parameters["ExMsg"].Value.ToString(); stReturn.FNReturn = ds.Tables[0]; sda.Dispose(); SqlConn.Close(); } return(stReturn); }
public pdbp.WS.STReturn Login_LoginName(string LoginName, string LoginPwd) { pdbp.WS.Login Lg = new pdbp.WS.Login(); pdbp.WS.STReturn stReturn = Lg.Login_LoginName(LoginName, LoginPwd); if (stReturn.NReturn == 1) { Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(HttpContext.Current.Session); // 记录登录状态 ApqSession.UserID = Apq.Convert.ChangeType <long>(stReturn.POuts[0]); ApqSession.NickName = Apq.Convert.ChangeType <string>(stReturn.POuts[2]); ApqSession.LoginName = LoginName; ApqSession.LoginTime = DateTime.Now; // 写入客户端Cookie if (HttpContext.Current.Response.Cookies.AllKeys.Contains(ConfigurationManager.AppSettings["Cookie-UserSrc"])) { HttpContext.Current.Response.Cookies.Remove(ConfigurationManager.AppSettings["Cookie-UserSrc"]); } if (HttpContext.Current.Response.Cookies.AllKeys.Contains(ConfigurationManager.AppSettings["Cookie-LoginName"])) { HttpContext.Current.Response.Cookies.Remove(ConfigurationManager.AppSettings["Cookie-LoginName"]); } if (HttpContext.Current.Response.Cookies.AllKeys.Contains(ConfigurationManager.AppSettings["Cookie-LoginPwd"])) { HttpContext.Current.Response.Cookies.Remove(ConfigurationManager.AppSettings["Cookie-LoginPwd"]); } HttpCookie cookieUserSrc = new HttpCookie(ConfigurationManager.AppSettings["Cookie-UserSrc"], "1"); HttpCookie cookieLoginName = new HttpCookie(ConfigurationManager.AppSettings["Cookie-LoginName"], LoginName); HttpCookie cookieLoginPwd = new HttpCookie(ConfigurationManager.AppSettings["Cookie-LoginPwd"], Apq.Convert.ChangeType <string>(stReturn.POuts[1])); cookieUserSrc.Expires = cookieLoginName.Expires = cookieLoginPwd.Expires = DateTime.Now.AddYears(1); HttpContext.Current.Response.Cookies.Add(cookieUserSrc); HttpContext.Current.Response.Cookies.Add(cookieLoginName); HttpContext.Current.Response.Cookies.Add(cookieLoginPwd); } return(stReturn); }
protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public Apq.STReturn TaskEdit(long TaskID, string TaskName, string TaskContent, DateTime BTime, DateTime ETime, long AddinID, decimal Price, decimal ParentPrice , bool NeedChangeIP, bool IsAutoStart, decimal TaskMoney) { Apq.STReturn stReturn = new Apq.STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckPwdExpire(ref stReturn, ApqSession)) { return stReturn; } long UserID = System.Convert.ToInt64(ApqSession.User.Rows[0]["UserID"]); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlCommand sc = new SqlCommand("dtxc.Apq_Task_Update", SqlConn); sc.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("_OperID", UserID); dch.AddParameter("_OpTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); IPAddress ipa; if (IPAddress.TryParse(HttpContext.Current.Request.UserHostAddress, out ipa)) { dch.AddParameter("_OperIP", ipa.GetAddressBytes()); } dch.AddParameter("TaskID", TaskID); dch.AddParameter("TaskName", TaskName); dch.AddParameter("TaskContent", TaskContent); dch.AddParameter("BTime", BTime); dch.AddParameter("ETime", ETime); dch.AddParameter("AddinID", AddinID); dch.AddParameter("Price", Price); dch.AddParameter("ParentPrice", ParentPrice); dch.AddParameter("NeedChangeIP", NeedChangeIP); dch.AddParameter("IsAutoStart", IsAutoStart); dch.AddParameter("TaskMoney", TaskMoney); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.ExMsg = sc.Parameters["ExMsg"].Value.ToString(); sc.Dispose(); SqlConn.Close(); } return stReturn; }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public Apq.STReturn TaskBalance(long TaskID) { Apq.STReturn stReturn = new Apq.STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckPwdExpire(ref stReturn, ApqSession)) { return stReturn; } using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlCommand sc = new SqlCommand("dtxc.Apq_Task_BalanceOne", SqlConn); sc.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("_OperID", ApqSession.UserID); dch.AddParameter("_OpTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); IPAddress ipa; if (IPAddress.TryParse(HttpContext.Current.Request.UserHostAddress, out ipa)) { dch.AddParameter("_OperIP", ipa.GetAddressBytes()); } dch.AddParameter("UserID", ApqSession.UserID); dch.AddParameter("TaskID", TaskID); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.ExMsg = sc.Parameters["ExMsg"].Value.ToString(); sc.Dispose(); SqlConn.Close(); } return stReturn; }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public Apq.STReturn UserEditLoginPwd(string LoginPwd_C, string LoginPwd) { Apq.STReturn stReturn = new Apq.STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckLogin(ref stReturn, ApqSession)) { return(stReturn); } // 检测旧密码 System.Security.Cryptography.SHA512 SHA512 = System.Security.Cryptography.SHA512.Create(); byte[] binLoginPwd_C = SHA512.ComputeHash(System.Text.Encoding.Unicode.GetBytes(LoginPwd_C)); string SqlLoginPwd_C = Apq.Data.SqlClient.Common.ConvertToSqlON(binLoginPwd_C); string SqlLoginPwd_DB = Apq.Data.SqlClient.Common.ConvertToSqlON(ApqSession.User.Rows[0]["LoginPwd"]); if (SqlLoginPwd_C != SqlLoginPwd_DB) { stReturn.NReturn = -1; stReturn.ExMsg = "原密码输入错误"; return(stReturn); } byte[] binLoginPwd = SHA512.ComputeHash(System.Text.Encoding.Unicode.GetBytes(LoginPwd)); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlCommand sc = new SqlCommand("dtxc.dtxc_User_UpdateLoginPwd", SqlConn); sc.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("_OperID", ApqSession.UserID); dch.AddParameter("_OpTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); IPAddress ipa; if (IPAddress.TryParse(HttpContext.Current.Request.UserHostAddress, out ipa)) { dch.AddParameter("_OperIP", ipa.GetAddressBytes()); } dch.AddParameter("UserID", ApqSession.UserID); dch.AddParameter("LoginPwd", binLoginPwd); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.ExMsg = sc.Parameters["ExMsg"].Value.ToString(); sc.Dispose(); SqlConn.Close(); } // 更新Session中的密码信息 ApqSession.User.Rows[0]["LoginPwd"] = binLoginPwd; // 返回客户端 stReturn.FNReturn = Apq.Data.SqlClient.Common.ConvertToSqlON(binLoginPwd); return(stReturn); }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public Apq.STReturn AddinListOne(long AddinID) { Apq.STReturn stReturn = new Apq.STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckAdmin(ref stReturn, ApqSession)) { return stReturn; } DataSet ds = new DataSet(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlDataAdapter sda = new SqlDataAdapter("dtxc.Apq_Addin_ListOne", SqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sda.SelectCommand); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("AddinID", AddinID); sda.SelectCommand.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sda.SelectCommand.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sda.Fill(ds); stReturn.NReturn = System.Convert.ToInt32(sda.SelectCommand.Parameters["rtn"].Value); stReturn.ExMsg = sda.SelectCommand.Parameters["ExMsg"].Value.ToString(); stReturn.FNReturn = ds.Tables[0]; sda.Dispose(); SqlConn.Close(); } return stReturn; }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public Apq.STReturn PayoutConfirm(long PayoutID) { Apq.STReturn stReturn = new Apq.STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckAdmin(ref stReturn, ApqSession)) { return stReturn; } long UserID = System.Convert.ToInt64(ApqSession.User.Rows[0]["UserID"]); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.GlobalObject.SqlConnectionString)) { SqlCommand sc = new SqlCommand("dtxc.dtxc_Payout_Confirm", SqlConn); sc.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("_OperID", UserID); dch.AddParameter("_OpTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); IPAddress ipa; if (IPAddress.TryParse(HttpContext.Current.Request.UserHostAddress, out ipa)) { dch.AddParameter("_OperIP", ipa.GetAddressBytes()); } dch.AddParameter("PayoutID", PayoutID); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.ExMsg = sc.Parameters["ExMsg"].Value.ToString(); sc.Dispose(); SqlConn.Close(); } return stReturn; }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn TaskList(int Pager_Page, int Pager_PageSize, int[] Status) { STReturn stReturn = new STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckAdmin(ref stReturn, ApqSession)) { return stReturn; } DataSet ds = new DataSet(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { DataTable dtStatus = new DataTable(); dtStatus.Columns.Add("ID", typeof(int)); foreach (int i in Status) { dtStatus.Rows.Add(i); } SqlDataAdapter sda = new SqlDataAdapter("dtxc.Apq_Task_List", SqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sda.SelectCommand); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("Pager_Page", Pager_Page, DbType.Int32); dch.AddParameter("Pager_PageSize", Pager_PageSize); dch.AddParameter("Pager_RowCount", 0, DbType.Int32); sda.SelectCommand.Parameters.Add("Status", SqlDbType.Structured); sda.SelectCommand.Parameters["Status"].TypeName = "tvp:t_int"; sda.SelectCommand.Parameters["Status"].Value = dtStatus; sda.SelectCommand.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sda.SelectCommand.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_Page"].Direction = ParameterDirection.InputOutput; sda.SelectCommand.Parameters["Pager_RowCount"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sda.Fill(ds); stReturn.NReturn = System.Convert.ToInt32(sda.SelectCommand.Parameters["rtn"].Value); stReturn.ExMsg = sda.SelectCommand.Parameters["ExMsg"].Value.ToString(); stReturn.FNReturn = ds.Tables[0]; stReturn.POuts = new object[]{ sda.SelectCommand.Parameters["Pager_Page"].Value, sda.SelectCommand.Parameters["Pager_RowCount"].Value }; sda.Dispose(); SqlConn.Close(); } return stReturn; }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn AddinAdd(string AddinName, string AddinUrl, string AddinDescript) { STReturn stReturn = new STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckAdmin(ref stReturn, ApqSession)) { return stReturn; } long UserID = Convert.ToInt64(ApqSession.User.Rows[0]["UserID"]); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlCommand sc = new SqlCommand("dtxc.Apq_Addin_Insert", SqlConn); sc.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("_OperID", UserID); dch.AddParameter("_OpTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); IPAddress ipa; if (IPAddress.TryParse(HttpContext.Current.Request.UserHostAddress, out ipa)) { dch.AddParameter("_OperIP", ipa.GetAddressBytes()); } dch.AddParameter("AddinName", AddinName); dch.AddParameter("AddinUrl", AddinUrl); dch.AddParameter("AddinDescript", AddinDescript); dch.AddParameter("AddinID", 0); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; sc.Parameters["AddinID"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.ExMsg = sc.Parameters["ExMsg"].Value.ToString(); stReturn.POuts = new object[] { sc.Parameters["AddinID"].Value }; sc.Dispose(); SqlConn.Close(); } return stReturn; }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml)] public STReturn Login_UserName(string UserName, string LoginPwd) { // 先清除已登录数据 Session.Clear(); STReturn stReturn = new STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (LoginPwd.Length < 1) { stReturn.NReturn = -1; stReturn.ExMsg = "密码不允许为空"; return stReturn; } System.Security.Cryptography.SHA512 SHA512 = System.Security.Cryptography.SHA512.Create(); byte[] binLoginPwd = SHA512.ComputeHash(System.Text.Encoding.Unicode.GetBytes(LoginPwd)); stReturn = DBLogin(UserName, binLoginPwd); // Session操作 if (stReturn.NReturn > 0) { ApqSession.User = stReturn.FNReturn as DataTable; } ApqSession.LoginTime = DateTime.Now; return stReturn; }
public STReturn Login_UserNameFromCookie(string UserName, string SqlLoginPwd) { // 先清除已登录数据 Session.Clear(); STReturn stReturn = new STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (SqlLoginPwd.Length < 63) { stReturn.NReturn = -1; stReturn.ExMsg = "密码不允许为空"; return stReturn; } byte[] binLoginPwd = Apq.Data.SqlClient.Common.ParseSqlON<byte[]>(System.Data.SqlDbType.VarBinary, SqlLoginPwd) as byte[]; stReturn = DBLogin(UserName, binLoginPwd); // Session操作 if (stReturn.NReturn > 0) { ApqSession.User = stReturn.FNReturn as DataTable; } ApqSession.LoginTime = DateTime.Now; return stReturn; }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public Apq.STReturn UserEditLoginPwd(string LoginPwd_C, string LoginPwd) { Apq.STReturn stReturn = new Apq.STReturn(); Apq.Web.SessionState.HttpSessionState ApqSession = new Apq.Web.SessionState.HttpSessionState(Session); if (!CheckLoginPage.CheckLogin(ref stReturn, ApqSession)) { return stReturn; } // 检测旧密码 System.Security.Cryptography.SHA512 SHA512 = System.Security.Cryptography.SHA512.Create(); byte[] binLoginPwd_C = SHA512.ComputeHash(System.Text.Encoding.Unicode.GetBytes(LoginPwd_C)); string SqlLoginPwd_C = Apq.Data.SqlClient.Common.ConvertToSqlON(binLoginPwd_C); string SqlLoginPwd_DB = Apq.Data.SqlClient.Common.ConvertToSqlON(ApqSession.User.Rows[0]["LoginPwd"]); if (SqlLoginPwd_C != SqlLoginPwd_DB) { stReturn.NReturn = -1; stReturn.ExMsg = "原密码输入错误"; return stReturn; } byte[] binLoginPwd = SHA512.ComputeHash(System.Text.Encoding.Unicode.GetBytes(LoginPwd)); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlCommand sc = new SqlCommand("dtxc.dtxc_User_UpdateLoginPwd", SqlConn); sc.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("ExMsg", stReturn.ExMsg, DbType.String, -1); dch.AddParameter("_OperID", ApqSession.UserID); dch.AddParameter("_OpTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); IPAddress ipa; if (IPAddress.TryParse(HttpContext.Current.Request.UserHostAddress, out ipa)) { dch.AddParameter("_OperIP", ipa.GetAddressBytes()); } dch.AddParameter("UserID", ApqSession.UserID); dch.AddParameter("LoginPwd", binLoginPwd); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.ExMsg = sc.Parameters["ExMsg"].Value.ToString(); sc.Dispose(); SqlConn.Close(); } // 更新Session中的密码信息 ApqSession.User.Rows[0]["LoginPwd"] = binLoginPwd; // 返回客户端 stReturn.FNReturn = Apq.Data.SqlClient.Common.ConvertToSqlON(binLoginPwd); return stReturn; }