//[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); }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn dtxc_TaskVote_Log_List(string TaskName, string UserNameBegin) { STReturn stReturn = new STReturn(); DataSet ds = new DataSet(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlDataAdapter sda = new SqlDataAdapter("dtxc.dtxc_TaskVote_Log_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("TaskName", TaskName); dch.AddParameter("UserNameBegin", UserNameBegin); 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 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); }
/// <summary> /// 自有QueryString参数说明:无 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { // 参数解析 int Pager_PageSize = Apq.Convert.ChangeType <int>(Request.QueryString["ps"], 20); int Pager_Page = Apq.Convert.ChangeType <int>(Request.QueryString["p"], 1); // 设置分页相关值 txtPager_PageSize.Text = Pager_PageSize.ToString(); txtPager_Page.Text = Pager_Page.ToString(); WS.Admin.WS2 ws = new dtxc.WS.Admin.WS2(); STReturn stReturn = ws.dtxc_Users_ListChild_Pager(Pager_Page, Pager_PageSize, 0); if (stReturn.NReturn == 1) { rpt.DataSource = stReturn.FNReturn; //绑定对象 rpt.DataBind(); // 设置当前页数 txtPager_Page.Text = stReturn.POuts[0].ToString(); txtPager_PageCount.InnerText = Math.Ceiling(Convert.ToDouble(stReturn.POuts[1]) / Pager_PageSize).ToString(); } }
/// <summary> /// 编辑 /// </summary> public static STReturn ApqPrivilege_Edit(long PID, long ParentID, string PName, string Remark) { STReturn stReturn = new STReturn(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.GlobalObject.SqlConnectionString)) { SqlCommand sc = new SqlCommand("dbo.ApqPrivilege_Edit", SqlConn); sc.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("PID", PID, DbType.Int64); dch.AddParameter("ParentID", ParentID, DbType.Int64); dch.AddParameter("PName", PName); dch.AddParameter("Remark", Remark); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["PID"].Direction = ParameterDirection.InputOutput; sc.Parameters["ParentID"].Direction = ParameterDirection.InputOutput; sc.Parameters["PName"].Direction = ParameterDirection.InputOutput; sc.Parameters["Remark"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.POuts.Add(sc.Parameters["PID"].Value); stReturn.POuts.Add(sc.Parameters["ParentID"].Value); stReturn.POuts.Add(sc.Parameters["PName"].Value); stReturn.POuts.Add(sc.Parameters["Remark"].Value); stReturn.ExMsg = Apq.Convert.ChangeType <string>(sc.Parameters["ExMsg"].Value); SqlConn.Close(); } return(stReturn); }
//#region 注册 ///// <summary> ///// 以用户名注册用户 ///// </summary> ///// <param name="NReturn">返回值</param> ///// <param name="ExMsg">返回信息</param> ///// <param name="LoginName">用户名</param> ///// <param name="binPwd">密码</param> ///// <param name="IDCard">身份证号</param> ///// <param name="IDCardName">身份证姓名</param> ///// <param name="Sex">性别</param> ///// <param name="IDCardPhotoUrl">身份证照片</param> ///// <param name="Users_Name">名字</param> ///// <param name="Users_PhotoUrl">头像</param> ///// <param name="Expire">过期时间</param> ///// <param name="IsAdmin">是否管理员</param> ///// <param name="Birthday">生日</param> ///// <param name="UserID">用户编号</param> ///// <returns></returns> //public static void Apq_Reg_LoginName(ref int NReturn, ref string ExMsg, string LoginName, byte[] binPwd, string IDCard, string IDCardName, byte Sex // , string IDCardPhotoUrl, string Users_Name, string Users_PhotoUrl, DateTime Expire, byte IsAdmin, DateTime Birthday, ref long UserID) //{ // SqlCommand sc = new SqlCommand("Apq_User.Apq_Reg_LoginName"); // sc.CommandType = CommandType.StoredProcedure; // Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); // dch.AddParameter("rtn", 0, DbType.Int32); // dch.AddParameter("ExMsg", ExMsg, DbType.String, -1); // dch.AddParameter("LoginName", LoginName); // dch.AddParameter("binPwd", binPwd); // dch.AddParameter("IDCard", IDCard); // dch.AddParameter("IDCardName", IDCardName); // dch.AddParameter("Sex", Sex, DbType.Byte); // dch.AddParameter("IDCardPhotoUrl", IDCardPhotoUrl); // dch.AddParameter("Users_Name", Users_Name); // dch.AddParameter("Users_PhotoUrl", Users_PhotoUrl); // dch.AddParameter("Expire", Expire); // dch.AddParameter("IsAdmin", IsAdmin, DbType.Byte); // dch.AddParameter("Birthday", Birthday); // dch.AddParameter("UserID", UserID, DbType.Int64); // sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; // sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; // sc.Parameters["UserID"].Direction = ParameterDirection.InputOutput; // using (SqlConnection SqlConn = new SqlConnection(Apq.DB.GlobalObject.SqlConnectionString)) // { // sc.Connection = SqlConn; // SqlConn.Open(); // sc.ExecuteNonQuery(); // NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); // ExMsg = sc.Parameters["ExMsg"].Value.ToString(); // UserID = System.Convert.ToInt64(sc.Parameters["UserID"].Value); // sc.Dispose(); // SqlConn.Close(); // } //} //#endregion #region 登录 /// <summary> /// 登录权限子系统 /// </summary> public static STReturn ApqUser_Login(int UserSrc, string UserName) { STReturn stReturn = new STReturn(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.GlobalObject.SqlConnectionString)) { SqlCommand sc = new SqlCommand("dbo.ApqUser_Login", 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", string.Empty, DbType.String, -1); dch.AddParameter("UserSrc", UserSrc, DbType.Int32); dch.AddParameter("UserName", UserName); dch.AddParameter("UserID", 0, DbType.Int64); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; sc.Parameters["UserID"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.POuts.Add(sc.Parameters["UserID"].Value); stReturn.ExMsg = Apq.Convert.ChangeType<string>(sc.Parameters["ExMsg"].Value); SqlConn.Close(); } return stReturn; }
/// <summary> /// 自有QueryString参数说明: /// Status:{0:普通,1:已审核,2:已结算,3:已作废,10000:已删除} /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { // 参数解析 int Pager_PageSize = Apq.Convert.ChangeType<int>(Request.QueryString["ps"], 20); int Pager_Page = Apq.Convert.ChangeType<int>(Request.QueryString["p"], 1); int[] Status = { 0, 1, 2, 3 }; if (Request.QueryString["Status"] != null && Request.QueryString["Status"].Length > 0) { string[] aryStatus = Request.QueryString["Status"].Split(','); Status = new int[aryStatus.Length]; for (int i = 0; i < Status.Length; i++) { Status[i] = Apq.Convert.ChangeType<int>(aryStatus[i], 1); } } // 设置分页相关值 txtPager_PageSize.Text = Pager_PageSize.ToString(); txtPager_Page.Text = Pager_Page.ToString(); WS.Admin.WS1 ws = new dtxc.WS.Admin.WS1(); STReturn stReturn = ws.TaskList(Pager_Page, Pager_PageSize, Status); if (stReturn.NReturn == 1) { rpt.DataSource = stReturn.FNReturn; //绑定对象 rpt.DataBind(); // 设置当前页数 txtPager_Page.Text = stReturn.POuts[0].ToString(); txtPager_PageCount.InnerText = Math.Ceiling(Convert.ToDouble(stReturn.POuts[1]) / Pager_PageSize).ToString(); } }
//[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); }
/// <summary> /// 编辑 /// </summary> public static STReturn ApqPrivilege_Edit(long PID, long ParentID, string PName, string Remark) { STReturn stReturn = new STReturn(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.GlobalObject.SqlConnectionString)) { SqlCommand sc = new SqlCommand("dbo.ApqPrivilege_Edit", SqlConn); sc.CommandType = CommandType.StoredProcedure; Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); dch.AddParameter("rtn", 0, DbType.Int32); dch.AddParameter("PID", PID, DbType.Int64); dch.AddParameter("ParentID", ParentID, DbType.Int64); dch.AddParameter("PName", PName); dch.AddParameter("Remark", Remark); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["PID"].Direction = ParameterDirection.InputOutput; sc.Parameters["ParentID"].Direction = ParameterDirection.InputOutput; sc.Parameters["PName"].Direction = ParameterDirection.InputOutput; sc.Parameters["Remark"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.POuts.Add(sc.Parameters["PID"].Value); stReturn.POuts.Add(sc.Parameters["ParentID"].Value); stReturn.POuts.Add(sc.Parameters["PName"].Value); stReturn.POuts.Add(sc.Parameters["Remark"].Value); stReturn.ExMsg = Apq.Convert.ChangeType<string>(sc.Parameters["ExMsg"].Value); SqlConn.Close(); } return stReturn; }
//#region 注册 ///// <summary> ///// 以用户名注册用户 ///// </summary> ///// <param name="NReturn">返回值</param> ///// <param name="ExMsg">返回信息</param> ///// <param name="LoginName">用户名</param> ///// <param name="binPwd">密码</param> ///// <param name="IDCard">身份证号</param> ///// <param name="IDCardName">身份证姓名</param> ///// <param name="Sex">性别</param> ///// <param name="IDCardPhotoUrl">身份证照片</param> ///// <param name="Users_Name">名字</param> ///// <param name="Users_PhotoUrl">头像</param> ///// <param name="Expire">过期时间</param> ///// <param name="IsAdmin">是否管理员</param> ///// <param name="Birthday">生日</param> ///// <param name="UserID">用户编号</param> ///// <returns></returns> //public static void Apq_Reg_LoginName(ref int NReturn, ref string ExMsg, string LoginName, byte[] binPwd, string IDCard, string IDCardName, byte Sex // , string IDCardPhotoUrl, string Users_Name, string Users_PhotoUrl, DateTime Expire, byte IsAdmin, DateTime Birthday, ref long UserID) //{ // SqlCommand sc = new SqlCommand("Apq_User.Apq_Reg_LoginName"); // sc.CommandType = CommandType.StoredProcedure; // Apq.Data.Common.DbCommandHelper dch = new Apq.Data.Common.DbCommandHelper(sc); // dch.AddParameter("rtn", 0, DbType.Int32); // dch.AddParameter("ExMsg", ExMsg, DbType.String, -1); // dch.AddParameter("LoginName", LoginName); // dch.AddParameter("binPwd", binPwd); // dch.AddParameter("IDCard", IDCard); // dch.AddParameter("IDCardName", IDCardName); // dch.AddParameter("Sex", Sex, DbType.Byte); // dch.AddParameter("IDCardPhotoUrl", IDCardPhotoUrl); // dch.AddParameter("Users_Name", Users_Name); // dch.AddParameter("Users_PhotoUrl", Users_PhotoUrl); // dch.AddParameter("Expire", Expire); // dch.AddParameter("IsAdmin", IsAdmin, DbType.Byte); // dch.AddParameter("Birthday", Birthday); // dch.AddParameter("UserID", UserID, DbType.Int64); // sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; // sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; // sc.Parameters["UserID"].Direction = ParameterDirection.InputOutput; // using (SqlConnection SqlConn = new SqlConnection(Apq.DB.GlobalObject.SqlConnectionString)) // { // sc.Connection = SqlConn; // SqlConn.Open(); // sc.ExecuteNonQuery(); // NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); // ExMsg = sc.Parameters["ExMsg"].Value.ToString(); // UserID = System.Convert.ToInt64(sc.Parameters["UserID"].Value); // sc.Dispose(); // SqlConn.Close(); // } //} //#endregion #region 登录 /// <summary> /// 登录权限子系统 /// </summary> public static STReturn ApqUser_Login(int UserSrc, string UserName) { STReturn stReturn = new STReturn(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.GlobalObject.SqlConnectionString)) { SqlCommand sc = new SqlCommand("dbo.ApqUser_Login", 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", string.Empty, DbType.String, -1); dch.AddParameter("UserSrc", UserSrc, DbType.Int32); dch.AddParameter("UserName", UserName); dch.AddParameter("UserID", 0, DbType.Int64); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; sc.Parameters["UserID"].Direction = ParameterDirection.InputOutput; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); stReturn.POuts.Add(sc.Parameters["UserID"].Value); stReturn.ExMsg = Apq.Convert.ChangeType <string>(sc.Parameters["ExMsg"].Value); SqlConn.Close(); } return(stReturn); }
/// <summary> /// 获取菜单 /// </summary> //[WebMethod(EnableSession = true, Description = "获取Xml表示的菜单")] //[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn GetXmlMenu() { STReturn stReturn = new STReturn(); stReturn.NReturn = 1; stReturn.ExMsg = "登出成功"; return stReturn; }
/// <summary> /// 获取菜单 /// </summary> //[WebMethod(EnableSession = true, Description = "获取Xml表示的菜单")] //[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn GetXmlMenu() { STReturn stReturn = new STReturn(); stReturn.NReturn = 1; stReturn.ExMsg = "登出成功"; 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); }
protected void Page_Load(object sender, EventArgs e) { //绑定对象 //默认值 string m = Request.QueryString["m"]; switch (m) { //添加 case "a": case "A": break; //查看 //修改 default: //获取数据 using (SqlConnection SqlConn = new SqlConnection(Apq.DB.GlobalObject.SqlConnectionString)) { STReturn stReturn = new STReturn(); SqlDataAdapter sda = new SqlDataAdapter("dtxc.Apq_Users_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("UserID", ApqSession.UserID); 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(); } if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { //页面赋值 txtBalanceMoney.InnerText = ds.Tables[0].Rows[0]["BalanceMoney"].ToString(); } break; } //设置只读 if (m == "v" || m == "V") { } }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn TaskEdit(long TaskID, string TaskName, string TaskContent, DateTime BTime, DateTime ETime, long AddinID, decimal Price, decimal ParentPrice , bool NeedChangeIP, bool IsAutoStart, decimal TaskMoney) { 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_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); }
protected void Page_Load(object sender, EventArgs e) { //绑定对象 //默认值 string m = Request.QueryString["m"]; switch (m) { //添加 case "a": case "A": break; //查看 //修改 default: //获取数据 using (SqlConnection SqlConn = new SqlConnection(Apq.DB.GlobalObject.SqlConnectionString)) { STReturn stReturn = new STReturn(); SqlDataAdapter sda = new SqlDataAdapter("dtxc.Apq_Users_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("UserID", ApqSession.UserID); 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(); } if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { //页面赋值 txtBalanceMoney.InnerText = ds.Tables[0].Rows[0]["BalanceMoney"].ToString(); } break; } //设置只读 if (m == "v" || m == "V") { } }
/// <summary> /// 检测是否登录 /// </summary> /// <param name="stReturn"></param> public static bool CheckLogin(ref 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; }
/// <summary> /// 检测是否登录 /// </summary> /// <param name="stReturn"></param> public static bool CheckLogin(ref 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); }
public string CfdSubmitOrder(string authToken, string counterId, string orderType, string action1, string timeInForce, string expireTime, string limitPrice, string quantity , string ifDoneLimitOrderNo, string ocoStopLimitPrice, string ocoStopLimitQuantity, string stopPrice, string trailingStep , string limitSpread, string triggerPriceType, string conditionOperator, string conditionCompanyCode, string conditionPrice) { Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1); Response.CacheControl = "no-cache"; string tradeEnable = ConfigurationManager.AppSettings["tradeEnable"]; if (tradeEnable != "1") { return("{\"msg\":\"Sorry,you don't have permission to trade.\",\"code\":-1}"); } JObject json = new JObject(); try { string deviceId = Session["openid"].ToString(); UserInfo user = (UserInfo)Session["User"]; string language = Session["language"].ToString(); string result = tradeMgr.getCfdSubmitOrder(deviceId, user.accountNo, user.sessionID, language, authToken, counterId , orderType, action1, timeInForce, expireTime, limitPrice, quantity , ifDoneLimitOrderNo, ocoStopLimitPrice, ocoStopLimitQuantity, stopPrice, trailingStep , limitSpread, triggerPriceType, conditionOperator, conditionCompanyCode, conditionPrice); STReturn ret = Global.chkJsonStats(result); if (int.Parse(ret.retCode) == (int)MsgCode.OPR_SUCC) { return(result); } else { json.Add("code", ret.retCode); json.Add("msg", ret.retMsg); return(json.ToString()); } } catch (WeChatException ex) { json.RemoveAll(); json.Add("code", ex.WeChatErrorCode); json.Add("msg", ex.WeChatErrorMessage); return(json.ToString()); } catch (Exception) { json.RemoveAll(); json.Add("code", (int)MsgCode.SESSION_EXPIRED_ERR); json.Add("msg", ReturnMsg.msgList[(int)MsgCode.SESSION_EXPIRED_ERR]); return(json.ToString()); } }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml)] public STReturn Logout() { STReturn stReturn = new STReturn(); // 结束会话 Session.Abandon(); stReturn.NReturn = 1; stReturn.ExMsg = "登出成功"; return(stReturn); }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml)] public STReturn Logout() { STReturn stReturn = new STReturn(); // 结束会话 Session.Abandon(); stReturn.NReturn = 1; stReturn.ExMsg = "登出成功"; return stReturn; }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn UserEditSelf(long UserID, string Name, short Sex, string PhotoUrl, DateTime Birthday , string IDCard, string Alipay) { STReturn stReturn = new 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; }
//[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); }
public string FtFxFxmnSubmitOrder(string product, string encryptedPIN, string authToken, string symbol, string exchange, string action1, string orderType , string price, string qty, string expiry, string stopLimitPrice, string ocoType, string ocoPrice) { Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1); Response.CacheControl = "no-cache"; string tradeEnable = ConfigurationManager.AppSettings["tradeEnable"]; if (tradeEnable != "1") { return("{\"msg\":\"Sorry,you don't have permission to trade.\",\"code\":-1}"); } JObject json = new JObject(); try { string deviceId = Session["openid"].ToString(); UserInfo user = (UserInfo)Session["User"]; string language = Session["language"].ToString(); string result = tradeMgr.getFtFxFxmnSubmitOrder(deviceId, user.accountNo, user.sessionID, language , product, encryptedPIN, authToken, symbol, exchange, action1, orderType , price, qty, expiry, stopLimitPrice, ocoType, ocoPrice); STReturn ret = Global.chkJsonStats(result); if (int.Parse(ret.retCode) == (int)MsgCode.OPR_SUCC) { return(result); } else { json.Add("code", ret.retCode); json.Add("msg", ret.retMsg); return(json.ToString()); } } catch (WeChatException ex) { json.RemoveAll(); json.Add("code", ex.WeChatErrorCode); json.Add("msg", ex.WeChatErrorMessage); return(json.ToString()); } catch (Exception) { json.RemoveAll(); json.Add("code", (int)MsgCode.SESSION_EXPIRED_ERR); json.Add("msg", ReturnMsg.msgList[(int)MsgCode.SESSION_EXPIRED_ERR]); return(json.ToString()); } }
public string UtSubmitOrder(string encryptedPIN, string counterId, string action1, string fundSource , string paymentCurrency, string invAmount, string unit, string switchInID, string emailNotification , string declaration, string termCondition) { Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1); Response.CacheControl = "no-cache"; string tradeEnable = ConfigurationManager.AppSettings["tradeEnable"]; if (tradeEnable != "1") { return("{\"msg\":\"Sorry,you don't have permission to trade.\",\"code\":-1}"); } JObject json = new JObject(); try { string deviceId = Session["openid"].ToString(); UserInfo user = (UserInfo)Session["User"]; string language = Session["language"].ToString(); string result = tradeMgr.getUtSubmitOrder(deviceId, user.accountNo, user.sessionID, language, encryptedPIN, counterId, action1 , fundSource, paymentCurrency, invAmount, unit, switchInID, emailNotification, declaration, termCondition); STReturn ret = Global.chkJsonStats(result); if (int.Parse(ret.retCode) == (int)MsgCode.OPR_SUCC) { return(result); } else { json.Add("code", ret.retCode); json.Add("msg", ret.retMsg); return(json.ToString()); } } catch (WeChatException ex) { json.RemoveAll(); json.Add("code", ex.WeChatErrorCode); json.Add("msg", ex.WeChatErrorMessage); return(json.ToString()); } catch (Exception) { json.RemoveAll(); json.Add("code", (int)MsgCode.SESSION_EXPIRED_ERR); json.Add("msg", ReturnMsg.msgList[(int)MsgCode.SESSION_EXPIRED_ERR]); return(json.ToString()); } }
public string StocksValidateOrder(string passwordE2ee, string counterId, string action1, string orderType, string limitPrice, string triggerPrice, string quantity , string settlementCurrency, string payment, string triggerPriceType, string validity, string gtd) { Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1); Response.CacheControl = "no-cache"; string tradeEnable = ConfigurationManager.AppSettings["tradeEnable"]; if (tradeEnable != "1") { return("{\"msg\":\"Sorry,you don't have permission to trade.\",\"code\":-1}"); } JObject json = new JObject(); try { string deviceId = Session["openid"].ToString(); UserInfo user = (UserInfo)Session["User"]; string language = Session["language"].ToString(); string result = tradeMgr.getStocksValidateOrder(deviceId, user.accountNo, user.sessionID, language , user.encryptedPIN, counterId, action1, orderType, limitPrice, triggerPrice, quantity , settlementCurrency, payment, triggerPriceType, validity, gtd); STReturn ret = Global.chkJsonStats(result); if (int.Parse(ret.retCode) != (int)MsgCode.PARSE_JSON_ERROR) { return(result); } else { json.Add("code", ret.retCode); json.Add("msg", ret.retMsg); return(json.ToString()); } } catch (WeChatException ex) { json.RemoveAll(); json.Add("code", ex.WeChatErrorCode); json.Add("msg", ex.WeChatErrorMessage); return(json.ToString()); } catch (Exception) { json.RemoveAll(); json.Add("code", (int)MsgCode.SESSION_EXPIRED_ERR); json.Add("msg", ReturnMsg.msgList[(int)MsgCode.SESSION_EXPIRED_ERR]); return(json.ToString()); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); // 非会员提示登录并跳到登录页面 STReturn stReturn = new STReturn(); if (!CheckLogin(ref stReturn, ApqSession)) { ClientScript.RegisterStartupScript(this.GetType(), "scdtxc_CheckLoginPage", @" alert(""请登录""); top.location = ""../Login.aspx""; ", true); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); // 非管理员提示后跳转到会员首页 STReturn stReturn = new STReturn(); if (!CheckPwdExpire(ref stReturn, ApqSession)) { ClientScript.RegisterStartupScript(this.GetType(), "dtxc_CheckAdminPage", @" alert(""密码已过期,请修改密码""); top.location = ""../ifLoginNameInfo.aspx"" ", true); } }
public ActionResult Presession() { Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1); Response.CacheControl = "no-cache"; //ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //logger.Info("weOpenid=" + Session["openid"]); JObject json = new JObject(); try { string deviceId = Session["openid"].ToString(); //string language = LANGUAGE_VALUE; string language = Session["language"].ToString(); string result = authMgr.getPresession(deviceId, language); STReturn ret = Global.chkJsonStats(result); json.Add("code", ret.retCode); json.Add("msg", ret.retMsg); if (int.Parse(ret.retCode) != (int)MsgCode.OPR_SUCC) { //when retcode status not succ,directly return retcode and msg to frontend return(Content(json.ToString())); } Presession presession = new Presession().parsePresession(result); json.Add("sessionID", presession.sessionID); json.Add("randomNo", presession.randomNo); json.Add("publicKey", presession.publicKey); Session["Presession"] = presession; return(Content(json.ToString())); } catch (WeChatException ex) { json.RemoveAll(); json.Add("code", ex.WeChatErrorCode); json.Add("msg", ex.WeChatErrorMessage); return(Content(json.ToString())); } catch (Exception) { json.RemoveAll(); json.Add("code", (int)MsgCode.SYSTEM_ERR); json.Add("msg", ReturnMsg.msgList[(int)MsgCode.SYSTEM_ERR]); return(Content(json.ToString())); } }
public string SearchCounter(string productFlag, string module, string market, string Exchange, string keyword, string count) { Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1); Response.CacheControl = "no-cache"; JObject json = new JObject(); try { string disableCFDUT = ConfigurationManager.AppSettings["disableCFDUT"]; if (disableCFDUT == "true") {//filter UT,CFD,CFDDMA int iFlag = int.Parse(productFlag); iFlag &= 57; productFlag = iFlag.ToString(); }//filter UT,CFD,CFDDMA string deviceId = Session["openid"].ToString(); UserInfo user = (UserInfo)Session["User"]; string language = Session["language"].ToString(); string result = counterMgr.getSearchCounter(deviceId, user.accountNo, user.sessionID, language , productFlag, module, market, Exchange, keyword, count); STReturn ret = Global.chkJsonStats(result); if (int.Parse(ret.retCode) == (int)MsgCode.OPR_SUCC) { return(result); } else { json.Add("code", ret.retCode); json.Add("msg", ret.retMsg); return(json.ToString()); } } catch (WeChatException ex) { json.RemoveAll(); json.Add("code", ex.WeChatErrorCode); json.Add("msg", ex.WeChatErrorMessage); return(json.ToString()); } catch (Exception) { json.RemoveAll(); json.Add("code", (int)MsgCode.SESSION_EXPIRED_ERR); json.Add("msg", ReturnMsg.msgList[(int)MsgCode.SESSION_EXPIRED_ERR]); return(json.ToString()); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); // 非管理员提示后跳转到会员首页 STReturn stReturn = new STReturn(); if (!CheckAdmin(ref stReturn, ApqSession)) { ClientScript.RegisterStartupScript(this.GetType(), "dtxc_CheckAdminPage", @" alert(""您不是管理员,请访问会员页面""); top.location = ""../Main.htm"" ", true); } }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn AddinList(int Pager_Page, int Pager_PageSize, long AddinID) { 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.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", Pager_Page, DbType.Int32); dch.AddParameter("Pager_PageSize", Pager_PageSize); dch.AddParameter("Pager_RowCount", 0, DbType.Int32); dch.AddParameter("AddinID", AddinID); 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 string CfdRefreshLimitBalance() { Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1); Response.CacheControl = "no-cache"; string tradeEnable = ConfigurationManager.AppSettings["tradeEnable"]; if (tradeEnable != "1") { return("{\"msg\":\"Sorry,you don't have permission to trade.\",\"code\":-1}"); } JObject json = new JObject(); try { string deviceId = Session["openid"].ToString(); UserInfo user = (UserInfo)Session["User"]; string language = Session["language"].ToString(); string result = tradeMgr.getCfdRefreshLimitBalance(deviceId, user.accountNo, user.sessionID, language); STReturn ret = Global.chkJsonStats(result); if (int.Parse(ret.retCode) == (int)MsgCode.OPR_SUCC) { return(result); } else { json.Add("code", ret.retCode); json.Add("msg", ret.retMsg); return(json.ToString()); } } catch (WeChatException ex) { json.RemoveAll(); json.Add("code", ex.WeChatErrorCode); json.Add("msg", ex.WeChatErrorMessage); return(json.ToString()); } catch (Exception) { json.RemoveAll(); json.Add("code", (int)MsgCode.SESSION_EXPIRED_ERR); json.Add("msg", ReturnMsg.msgList[(int)MsgCode.SESSION_EXPIRED_ERR]); return(json.ToString()); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); // 非管理员提示后跳转到会员首页 STReturn stReturn = new STReturn(); if (!CheckPwdExpire(ref stReturn, ApqSession)) { ClientScript.RegisterStartupScript(this.GetType(), "dtxc_CheckAdminPage", @" alert(""密码已过期,请修改密码""); top.location = ""../ifLoginNameInfo.aspx"" ", true); } }
/// <summary> /// 检测是否管理员 /// </summary> /// <param name="stReturn"></param> public static bool CheckAdmin(ref STReturn stReturn, Apq.Web.SessionState.HttpSessionState ApqSession) { if (!CheckPwdExpire(ref stReturn, ApqSession)) { return(false); } if (!Convert.ToBoolean(ApqSession.User.Rows[0]["IsAdmin"])) { stReturn.NReturn = -1; stReturn.ExMsg = "非管理员不能使用该功能"; return(false); } return(true); }
protected override void OnInit(EventArgs e) { base.OnInit(e); // 非管理员提示后跳转到会员首页 STReturn stReturn = new STReturn(); if (!CheckAdmin(ref stReturn, ApqSession)) { ClientScript.RegisterStartupScript(this.GetType(), "dtxc_CheckAdminPage", @" alert(""您不是管理员,请访问会员页面""); top.location = ""../Main.htm"" ", true); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); // 非会员提示登录并跳到登录页面 STReturn stReturn = new STReturn(); if (!CheckLogin(ref stReturn, ApqSession)) { ClientScript.RegisterStartupScript(this.GetType(), "scdtxc_CheckLoginPage", @" alert(""请登录""); top.location = ""../Login.aspx""; ", true); } }
/// <summary> /// 检测是否管理员 /// </summary> /// <param name="stReturn"></param> public static bool CheckAdmin(ref STReturn stReturn, Apq.Web.SessionState.HttpSessionState ApqSession) { if (!CheckPwdExpire(ref stReturn, ApqSession)) { return false; } if (!Convert.ToBoolean(ApqSession.User.Rows[0]["IsAdmin"])) { stReturn.NReturn = -1; stReturn.ExMsg = "非管理员不能使用该功能"; return false; } return true; }
protected void Page_Load(object sender, EventArgs e) { STReturn stReturn = new STReturn(); HttpSessionState ApqSession = new HttpSessionState(Session); if (CheckLoginPage.CheckLogin(ref stReturn, ApqSession)) { txtUserName.Text = ApqSession.User.Rows[0]["UserName"].ToString(); } else { ClientScript.RegisterStartupScript(this.GetType(), "scdtxc_CheckLogin", @" alert(""请登录""); top.location = ""Login.aspx""; ", 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); }
public ActionResult Disclaimer(string product, string disclaimerType) { Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1); Response.CacheControl = "no-cache"; JObject json = new JObject(); if (Global.isSessionTimeOut(Session["User"])) { return(RedirectToAction("Login", "Base")); } try { UserInfo user = (UserInfo)Session["User"]; string deviceId = Session["openid"].ToString(); string language = Session["language"].ToString(); string result = portMgr.getGlobalDisclaimer(deviceId, user.accountNo, user.sessionID, language, product, disclaimerType); STReturn ret = Global.chkJsonStats(result); if (int.Parse(ret.retCode) == (int)MsgCode.OPR_SUCC) { return(Content(result)); } else { json.Add("code", ret.retCode); json.Add("msg", ret.retMsg); return(Content(json.ToString())); } } catch (WeChatException ex) { json.RemoveAll(); json.Add("code", ex.WeChatErrorCode); json.Add("msg", ex.WeChatErrorMessage); return(Content(json.ToString())); } catch (Exception) { json.RemoveAll(); json.Add("code", (int)MsgCode.SESSION_EXPIRED_ERR); json.Add("msg", ReturnMsg.msgList[(int)MsgCode.SESSION_EXPIRED_ERR]); return(Content(json.ToString())); } }
//[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; }
/// <summary> /// 检测密码过期 /// </summary> /// <param name="stReturn"></param> public static bool CheckPwdExpire(ref STReturn stReturn, Apq.Web.SessionState.HttpSessionState ApqSession) { if (!CheckLogin(ref stReturn, ApqSession)) { return(false); } /* * if (Convert.ToDateTime(ApqSession.User.Rows[0]["LoginPwdExpire"]) > DateTime.Now) * { * stReturn.NReturn = 2; * stReturn.ExMsg = "密码已过期,请修改密码"; * return false; * } */ return(true); }
/// <summary> /// 检测密码过期 /// </summary> /// <param name="stReturn"></param> public static bool CheckPwdExpire(ref STReturn stReturn, Apq.Web.SessionState.HttpSessionState ApqSession) { if (!CheckLogin(ref stReturn, ApqSession)) { return false; } /* if (Convert.ToDateTime(ApqSession.User.Rows[0]["LoginPwdExpire"]) > DateTime.Now) { stReturn.NReturn = 2; stReturn.ExMsg = "密码已过期,请修改密码"; return false; } */ return true; }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn UserPayoutReg(decimal Payout) { STReturn stReturn = new 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.GlobalObject.SqlConnectionString)) { 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; }
protected void Page_Load(object sender, EventArgs e) { //绑定对象 //默认值 txtBTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); txtETime.Text = DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd"); string m = Request.QueryString["m"]; switch (m) { //添加 case "a": case "A": break; //查看 //修改 default: //获取数据 long TaskID = Convert.ToInt64(Request.QueryString["TaskID"]); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { STReturn stReturn = new STReturn(); SqlDataAdapter sda = new SqlDataAdapter("dtxc.Apq_Task_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("TaskID", TaskID); 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(); } if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { //页面赋值 txtTaskID.Text = ds.Tables[0].Rows[0]["TaskID"].ToString(); txtTaskName.Text = ds.Tables[0].Rows[0]["TaskName"].ToString(); cbNeedChangeIP.Checked = Convert.ToBoolean(ds.Tables[0].Rows[0]["NeedChangeIP"]); cbIsAutoStart.Checked = Convert.ToBoolean(ds.Tables[0].Rows[0]["IsAutoStart"]); txtBTime.Text = Convert.ToDateTime(ds.Tables[0].Rows[0]["BTime"]).ToString("yyyy-MM-dd"); txtETime.Text = Convert.ToDateTime(ds.Tables[0].Rows[0]["ETime"]).ToString("yyyy-MM-dd"); txtTaskContent.Text = ds.Tables[0].Rows[0]["TaskContent"].ToString(); txtAddinID.Text = ds.Tables[0].Rows[0]["AddinID"].ToString(); txtTaskMoney.Text = ds.Tables[0].Rows[0]["TaskMoney"].ToString(); txtPrice.Text = ds.Tables[0].Rows[0]["Price"].ToString(); txtParentPrice.Text = ds.Tables[0].Rows[0]["ParentPrice"].ToString(); } break; } //设置只读 if (m == "v" || m == "V") { txtTaskID.Enabled = false; txtTaskName.Enabled = false; cbNeedChangeIP.Enabled = false; cbIsAutoStart.Enabled = false; txtBTime.Enabled = false; txtETime.Enabled = false; txtTaskContent.Enabled = false; txtAddinID.Enabled = false; txtTaskMoney.Enabled = false; txtPrice.Enabled = false; txtParentPrice.Enabled = false; txtBTime.Enabled = false; txtETime.Enabled = false; } }
/// <summary> /// 执行登录存储过程 /// </summary> /// <param name="UserName">用户名</param> /// <param name="binLoginPwd">密码</param> /// <returns></returns> private STReturn DBLogin(string UserName, byte[] binLoginPwd) { STReturn stReturn = new STReturn(); DataSet ds = new DataSet(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlDataAdapter sda = new SqlDataAdapter("dtxc.dtxc_Login_UserName", 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("UserName", UserName); dch.AddParameter("LoginPwd", binLoginPwd); 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(); } // 返回客户端 string SqlLoginPwd = Apq.Data.SqlClient.Common.ConvertToSqlON(binLoginPwd); if (stReturn.NReturn > 0) { stReturn.FNReturn = ds.Tables[0]; stReturn.POuts = new object[] { UserName, SqlLoginPwd }; } 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, XmlSerializeString = true)] public STReturn UserEditLoginPwd(string LoginPwd_C, string LoginPwd) { STReturn stReturn = new 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; }
/// <summary> /// 删除 /// </summary> public static STReturn ApqUser_Delete(long PID, long ParentID) { STReturn stReturn = new STReturn(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.GlobalObject.SqlConnectionString)) { SqlCommand sc = new SqlCommand("dbo.ApqUser_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("PID", PID, DbType.Int64); dch.AddParameter("ParentID", ParentID, DbType.Int64); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; SqlConn.Open(); sc.ExecuteNonQuery(); stReturn.NReturn = System.Convert.ToInt32(sc.Parameters["rtn"].Value); SqlConn.Close(); } return stReturn; }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn dtxc_Reg_UserName(string Name, string UserName, string LoginPwd, short Sex, string PhotoUrl, long IntroUserID, string Alipay, int UserType , DateTime Birthday, string IDCard, string IDCard_Name, short IDCard_Sex, string IDCard_PhotoUrl) { STReturn stReturn = new STReturn(); 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)); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlCommand sc = new SqlCommand("dtxc.dtxc_Reg_UserName", 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); IPAddress ipa; if (IPAddress.TryParse(HttpContext.Current.Request.UserHostAddress, out ipa)) { dch.AddParameter("RegIP", ipa.GetAddressBytes()); } dch.AddParameter("Name", Name); dch.AddParameter("UserName", UserName); dch.AddParameter("LoginPwd", binLoginPwd); dch.AddParameter("Sex", Sex); dch.AddParameter("PhotoUrl", PhotoUrl); dch.AddParameter("Birthday", Birthday.ToString("yyyy-MM-dd HH:mm:ss.fff")); dch.AddParameter("Alipay", Alipay); dch.AddParameter("IntroUserID", IntroUserID); dch.AddParameter("UserType", UserType); dch.AddParameter("Expire", DateTime.Now.AddYears(10).ToString("yyyy-MM-dd HH:mm:ss.fff")); dch.AddParameter("IDCard", IDCard); dch.AddParameter("IDCard_Name", IDCard_Name); dch.AddParameter("IDCard_Sex", IDCard_Sex); dch.AddParameter("IDCard_PhotoUrl", IDCard_PhotoUrl); dch.AddParameter("UserID", 0, DbType.Int64); sc.Parameters["rtn"].Direction = ParameterDirection.ReturnValue; sc.Parameters["ExMsg"].Direction = ParameterDirection.InputOutput; sc.Parameters["UserID"].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["UserID"].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; }
protected void Page_Load(object sender, EventArgs e) { //绑定对象 //默认值 txtRegTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); txtExpire.Text = DateTime.Now.AddYears(1).ToString("yyyy-MM-dd"); string m = Request.QueryString["m"]; switch (m) { //添加 case "a": case "A": break; //查看 //修改 default: //获取数据 using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { STReturn stReturn = new STReturn(); SqlDataAdapter sda = new SqlDataAdapter("dtxc.dtxc_Users_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("UserID", ApqSession.UserID); 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(); } if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { //页面赋值 txtUserID.Text = ds.Tables[0].Rows[0]["UserID"].ToString(); txtName.Text = ds.Tables[0].Rows[0]["Name"].ToString(); ddlSex.SelectedValue = ds.Tables[0].Rows[0]["Sex"].ToString(); txtAlipay.Text = ds.Tables[0].Rows[0]["Alipay"].ToString(); if (!Convert.IsDBNull(ds.Tables[0].Rows[0]["Birthday"])) txtBirthday.Text = Convert.ToDateTime(ds.Tables[0].Rows[0]["Birthday"]).ToString("yyyy-MM-dd"); txtExpire.Text = Convert.ToDateTime(ds.Tables[0].Rows[0]["Expire"]).ToString("yyyy-MM-dd"); txtRegTime.Text = Convert.ToDateTime(ds.Tables[0].Rows[0]["RegTime"]).ToString("yyyy-MM-dd"); txtIntroUserID.Text = ds.Tables[0].Rows[0]["IntroUserID"].ToString(); txtIDCard.Text = ds.Tables[0].Rows[0]["IDCard"].ToString(); } break; } //设置只读 if (m == "v" || m == "V") { txtUserID.Enabled = false; txtName.Enabled = false; ddlSex.Enabled = false; txtAlipay.Enabled = false; txtBirthday.Enabled = false; txtIntroUserID.Enabled = false; txtIDCard.Enabled = false; } }
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 STReturn dtxc_TaskVote_Log_List(string TaskName, string UserNameBegin) { STReturn stReturn = new STReturn(); DataSet ds = new DataSet(); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { SqlDataAdapter sda = new SqlDataAdapter("dtxc.dtxc_TaskVote_Log_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("TaskName", TaskName); dch.AddParameter("UserNameBegin", UserNameBegin); 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; }
protected void Page_Load(object sender, EventArgs e) { //绑定对象 string m = Request.QueryString["m"]; switch (m) { //添加 case "a": case "A": break; //查看 //修改 default: //获取数据 long AddinID = Convert.ToInt64(Request.QueryString["AddinID"]); using (SqlConnection SqlConn = new SqlConnection(Apq.DB.Common.GetSqlConnectionString("SqlConnectionString2"))) { STReturn stReturn = new STReturn(); 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(); } if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { //页面赋值 txtAddinID.Text = ds.Tables[0].Rows[0]["AddinID"].ToString(); txtAddinName.Text = ds.Tables[0].Rows[0]["AddinName"].ToString(); txtAddinUrl.Text = ds.Tables[0].Rows[0]["AddinUrl"].ToString(); txtAddinDescript.Text = ds.Tables[0].Rows[0]["AddinDescript"].ToString(); } break; } //设置只读 if (m == "v" || m == "V") { txtAddinID.Enabled = false; txtAddinName.Enabled = false; txtAddinUrl.Enabled = false; txtAddinDescript.Enabled = false; } }
//[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml, XmlSerializeString = true)] public STReturn TaskEdit(long TaskID, string TaskName, string TaskContent, DateTime BTime, DateTime ETime, long AddinID, decimal Price, decimal ParentPrice , bool NeedChangeIP, bool IsAutoStart, decimal TaskMoney) { 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_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; }