public override bool Save(DBAccess dba, bool update) { dba.ReInit(); dba.AddTable(DBConst.ACAT0200); dba.AddParam(DBConst.ACAT0201, Order); dba.AddParam(DBConst.ACAT0204, Parent); dba.AddParam(DBConst.ACAT0205, Text); dba.AddParam(DBConst.ACAT0206, Tips); dba.AddParam(DBConst.ACAT0207, Icon); dba.AddParam(DBConst.ACAT0208, Meta); dba.AddParam(DBConst.ACAT0209, Memo); dba.AddParam(DBConst.ACAT020A, DBConst.SQL_NOW, false); if (update) { dba.AddWhere(DBConst.ACAT0202, UserCode); dba.AddWhere(DBConst.ACAT0203, Id); dba.AddVcs(DBConst.ACAT020C, DBConst.ACAT020D, Operate, Cat.OPT_UPDATE); return 1 == dba.ExecuteUpdate(); } dba.AddParam(DBConst.ACAT0202, UserCode); dba.AddParam(DBConst.ACAT0203, Id); dba.AddParam(DBConst.ACAT020B, DBConst.SQL_NOW, false); dba.AddVcs(DBConst.ACAT020C, DBConst.ACAT020D); return 1 == dba.ExecuteInsert(); }
/// <summary> /// 用户注册(网页方式) /// </summary> /// <param name="name">登录用户</param> /// <param name="pass">用户口令</param> /// <param name="mail">电子邮件</param> /// <returns></returns> public int WpSignUp(string name, string pass, string mail) { #region 用户名判断 DBAccess dba = new DBAccess(); dba.AddTable(DBConst.C3010400); dba.AddColumn(DBConst.C3010402); dba.AddWhere(string.Format("{0}='{1}' OR {2}='{3}'", DBConst.C3010405, name, DBConst.C3010406, mail)); DataTable dt = dba.ExecuteSelect(); if (dt.Rows.Count != 0) { return IMsg.MSG_SIGNUP_EXIST; } #endregion #region 用户信息 dba.ReInit(); dba.AddTable(DBConst.C3010400); dba.AddColumn(string.Format("MAX({0}) {0}", DBConst.C3010402)); dba.AddWhere(string.Format("LENGTH({0})=8", DBConst.C3010402)); dt = dba.ExecuteSelect(); string code = ""; if (dt != null && dt.Rows.Count > 0) { code = dt.Rows[0][0].ToString(); } if (CharUtil.IsValidateCode(code)) { code = CharUtil.GenerateUserCode(code); } else { code = "A0000000"; } #endregion string hash = HashUtil.UtcTimeInHex(false); #region 真实信息 dba.ReInit(); dba.AddTable(DBConst.C3010300); dba.AddParam(DBConst.C3010301, hash); dba.AddParam(DBConst.C3010302, code); dba.AddParam(DBConst.C3010303, ""); dba.AddParam(DBConst.C3010304, ""); dba.AddParam(DBConst.C3010305, 1); dba.AddParam(DBConst.C3010306, null); dba.AddParam(DBConst.C3010307, ""); dba.AddParam(DBConst.C3010308, DBConst.SQL_NOW, false); dba.AddParam(DBConst.C3010309, DBConst.SQL_NOW, false); if (dba.ExecuteInsert() != 1) { return IMsg.MSG_SIGNUP_INNER; } #endregion #region 在线信息 dba.ReInit(); dba.AddTable(DBConst.C3010400); dba.AddParam(DBConst.C3010401, hash); dba.AddParam(DBConst.C3010402, code); dba.AddParam(DBConst.C3010403, "0"); dba.AddParam(DBConst.C3010404, "0"); dba.AddParam(DBConst.C3010405, name); dba.AddParam(DBConst.C3010406, mail); dba.AddParam(DBConst.C3010407, name); dba.AddParam(DBConst.C3010408, "0"); dba.AddParam(DBConst.C3010409, ""); dba.AddParam(DBConst.C301040A, ""); dba.AddParam(DBConst.C301040B, ""); dba.AddParam(DBConst.C301040C, DBConst.SQL_NOW, false); dba.AddParam(DBConst.C301040D, DBConst.SQL_NOW, false); if (dba.ExecuteInsert() != 1) { return IMsg.MSG_SIGNUP_INNER; } #endregion #region 联系方式 dba.ReInit(); dba.AddTable(DBConst.C3010500); dba.AddParam(DBConst.C3010501, "0"); dba.AddParam(DBConst.C3010502, IUser.MAJOR_04); dba.AddParam(DBConst.C3010503, hash); dba.AddParam(DBConst.C3010504, code); dba.AddParam(DBConst.C3010505, "sctteqacvfxgqgtb");// 电子邮件 dba.AddParam(DBConst.C3010506, mail); dba.AddParam(DBConst.C3010507, ""); dba.AddParam(DBConst.C3010508, DBConst.SQL_NOW, false); dba.AddParam(DBConst.C3010509, DBConst.SQL_NOW, false); if (dba.ExecuteInsert() != 1) { return IMsg.MSG_SIGNUP_INNER; } #endregion #region 安全信息 _Data = new byte[256]; new Random().NextBytes(_Data); string info = Digest(name.ToLower(), pass, _Data); dba.ReInit(); dba.AddTable(DBConst.C3010600); dba.AddParam(DBConst.C3010601, hash); dba.AddParam(DBConst.C3010602, hash); dba.AddParam(DBConst.C3010603, info); dba.AddParam(DBConst.C3010604, mail); dba.AddParam(DBConst.C3010605, ""); dba.AddParam(DBConst.C3010606, ""); dba.AddParam(DBConst.C3010607, ""); dba.AddParam(DBConst.C3010608, ""); dba.AddParam(DBConst.C3010609, ""); dba.AddParam(DBConst.C301060A, ""); dba.AddParam(DBConst.C301060B, ""); dba.AddParam(DBConst.C301060C, ""); dba.AddParam(DBConst.C301060D, ""); dba.AddParam(DBConst.C301060E, ""); dba.AddParam(DBConst.C301060F, Convert.ToBase64String(_Data)); dba.AddParam(DBConst.C3010610, DBConst.SQL_NOW, false); dba.AddParam(DBConst.C3010611, DBConst.SQL_NOW, false); if (dba.ExecuteInsert() != 1) { return IMsg.MSG_SIGNUP_INNER; } #endregion #region 权限分配 dba.ReInit(); dba.AddTable(DBConst.C3010200); dba.AddParam(DBConst.C3010201, hash); dba.AddParam(DBConst.C3010202, hash); dba.AddParam(DBConst.C3010203, "sctvsxyttfzeqqgq");//一般用户 dba.AddParam(DBConst.C3010204, "APWD0000"); dba.AddParam(DBConst.C3010205, ""); dba.AddParam(DBConst.C3010206, DBConst.SQL_NOW, false); dba.AddParam(DBConst.C3010207, DBConst.SQL_NOW, false); if (dba.ExecuteInsert() != 1) { return IMsg.MSG_SIGNUP_INNER; } #endregion _Name = name; _Code = code; _Rank = IUser.LEVEL_02;//一般用户 return IMsg.MSG_SIGNUP_SUCCESS; }
private void ProcessRSA(XmlWriter writer) { string t = HashUtil.UtcTimeInHex(); RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); DBAccess dba = new DBAccess(); dba.AddTable(DBConst.C3010000); dba.AddParam(DBConst.C3010001, t); dba.AddParam(DBConst.C3010002, DBConst.SQL_NOW, false); dba.AddParam(DBConst.C3010003, CharUtil.Text2DB(rsa.ToXmlString(true))); dba.AddParam(DBConst.C3010004, 0); dba.ExecuteInsert(); writer.WriteStartElement("RSA"); writer.WriteElementString("t", t); writer.WriteElementString("k", rsa.ToXmlString(false)); writer.WriteEndElement(); }