public int Login(ref string ReturnDescription) { DataTable table = new Tables.T_CardPasswordAgents().Open("", "ID=" + this.ID, ""); if ((table == null) || (table.Rows.Count < 1)) { ReturnDescription = "用户不存在"; return(-1); } if (table.Rows[0]["Password"].ToString() != PF.EncryptPassword(this.Password)) { ReturnDescription = "密码错误"; return(-2); } if (table.Rows[0]["State"].ToString() != "1") { ReturnDescription = "代理商帐号已经过期"; return(-2); } this.Name = table.Rows[0]["Name"].ToString(); this.Password = table.Rows[0]["Password"].ToString(); this.Company = table.Rows[0]["Company"].ToString(); this.Url = table.Rows[0]["Url"].ToString(); this.State = _Convert.StrToShort(table.Rows[0]["State"].ToString(), 0); this.SaveUserIDToCookie(); return(0); }
private int Valid(ref DataSet ReturnDS, ref short State, int AgentID, string TimeStamp, string Sign, params object[] Params) { DateTime time; try { time = DateTime.Parse(TimeStamp); } catch { this.BuildReturnDataSetForError(-11, "时间戳格式错误", ref ReturnDS); return(-4); } State = 0; TimeSpan span = (TimeSpan)(DateTime.Now - time); if (Math.Abs(span.TotalSeconds) > 300.0) { this.BuildReturnDataSetForError(-2, "访问超时", ref ReturnDS); return(-2); } Thread.Sleep(200); DataTable table = new Tables.T_CardPasswordAgents().Open("", "[ID] = " + AgentID.ToString(), ""); if (table == null) { this.BuildReturnDataSetForError(-9999, "未知错误", ref ReturnDS); return(-9999); } if (table.Rows.Count < 1) { this.BuildReturnDataSetForError(-1, "代理商ID错误", ref ReturnDS); return(-1); } string str = table.Rows[0]["IPAddressLimit"].ToString(); if ((str != "") && (("," + str + ",").IndexOf("," + this.GetClientIPAddress() + ",") < 0)) { this.BuildReturnDataSetForError(-3, "IP地址限制", ref ReturnDS); return(-3); } string str2 = table.Rows[0]["Key"].ToString(); string str3 = AgentID.ToString() + TimeStamp; foreach (object obj2 in Params) { str3 = str3 + this.ParamterToString(obj2); } if (Encrypt.MD5(str3 + str2).ToLower() != Sign.ToLower()) { this.BuildReturnDataSetForError(-4, "签名校验失败", ref ReturnDS); return(-4); } State = _Convert.StrToShort(table.Rows[0]["State"].ToString(), 0); return(0); }
private void BindData() { DataTable dt = new Tables.T_CardPasswordAgents().Open("[ID], [Name]", "", "[ID]"); if (dt == null) { PF.GoError(4, "数据库繁忙,请重试", "Admin_CardPasswordAdd"); } else { ControlExt.FillDropDownList(this.ddlCardPasswordAgents, dt, "Name", "ID"); } }
public int EditByID(ref string ReturnDescription) { if (this.ID < 0) { throw new Exception("CardPassword 尚未初始化到具体的数据实例上,请先使用 GetInformation 等获取数据信息"); } DataTable table = new Tables.T_CardPasswordAgents().Open("", "[ID] = " + this.ID, ""); if ((table == null) || (table.Rows.Count < 1)) { ReturnDescription = "数据库读写错误"; return(-1); } new Tables.T_CardPasswordAgents { Company = { Value = this.Company }, Password = { Value = this.Password }, Name = { Value = this.Name }, State = { Value = this.State }, Url = { Value = this.Url } }.Update("[ID] = " + this.ID.ToString()); return(0); }
public int GetInformationByID(ref string ReturnDescription) { if (this.ID < 0) { throw new Exception("CardPassword 尚未初始化到具体的数据实例上,请先使用 GetInformation 等获取数据信息"); } DataTable table = new Tables.T_CardPasswordAgents().Open("", "[ID] = " + this.ID, ""); if ((table == null) || (table.Rows.Count < 1)) { ReturnDescription = "数据库读写错误"; return(-1); } this.Name = table.Rows[0]["Name"].ToString(); this.Password = table.Rows[0]["Password"].ToString(); this.Company = table.Rows[0]["Company"].ToString(); this.Url = table.Rows[0]["Url"].ToString(); this.State = _Convert.StrToShort(table.Rows[0]["State"].ToString(), 0); return(0); }