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="oldPass"></param> /// <param name="newPass"></param> /// <returns></returns> public bool WpSignPk(string oldPass, string newPass) { // 口令验证 string tmpPwds = Digest(_Name, oldPass, _Data); // 执行查询 var dba = new DBAccess(); dba.AddTable(DBConst.C3010600); dba.AddColumn(DBConst.C3010603); dba.AddWhere(DBConst.C3010602, _Hash); DataTable dt = dba.ExecuteSelect(); // 数据验证 if (dt.Rows.Count != 1) { return false; } oldPass = dt.Rows[0][0].ToString(); if (tmpPwds != oldPass) { return false; } tmpPwds = Digest(_Name, newPass, _Data); // 修改口令 dba.ReInit(); dba.AddTable(DBConst.C3010600); dba.AddParam(DBConst.C3010603, tmpPwds); dba.AddParam(DBConst.C3010610, DBConst.SQL_NOW, false); dba.AddWhere(DBConst.C3010602, _Hash); return 1 == dba.ExecuteUpdate(); }
public static MNote NextNote() { if (_Note == null) { _Note = new MNote(); _Note.Update = DateTime.MinValue; var dba = new DBAccess(); dba.AddTable(DBConst.W2060000); dba.AddColumn(DBConst.W2060003); dba.AddWhere(DBConst.W2060001, "1"); var data = dba.ExecuteSelect(); if (data.Rows.Count == 1) { _Note.Order = "" + data.Rows[0][DBConst.W2060003]; } _Note.Update = DateTime.MinValue; } if (_Note.Update.Day != DateTime.Now.Day) { var dba = new DBAccess(); dba.AddTable(DBConst.W2060100); dba.AddColumn(DBConst.W2060105); dba.AddColumn(DBConst.W2060109); dba.AddColumn(DBConst.W206010A); dba.AddWhere(DBConst.W2060105, ">", "" + _Note.Order, false); dba.AddSort(DBConst.W2060105); dba.AddLimit(1); var dat = dba.ExecuteSelect(); if (dat.Rows.Count < 1) { dba.ReInit(); dba.AddTable(DBConst.W2060100); dba.AddColumn(DBConst.W2060109); dba.AddColumn(DBConst.W206010A); dba.AddSort(DBConst.W2060105); dba.AddLimit(1); dat = dba.ExecuteSelect(); if (dat.Rows.Count < 1) { _Note.Text = "^_^"; return _Note; } } var row = dat.Rows[0]; _Note.Name = "" + row[DBConst.W2060109]; _Note.Text = "" + row[DBConst.W206010A]; _Note.Order = "" + row[DBConst.W2060105]; _Note.Update = DateTime.Now; dba.ReInit(); dba.AddTable(DBConst.W2060000); dba.AddParam(DBConst.W2060003, _Note.Order); dba.AddWhere(DBConst.W2060001, "1"); dba.ExecuteUpdate(); } return _Note; }
private byte[] Encrypt(string t, byte[] data) { DBAccess dba = new DBAccess(); dba.AddTable(DBConst.C3010000); dba.AddColumn(DBConst.C3010003); dba.AddWhere(DBConst.C3010001, CharUtil.Text2DB(t)); dba.AddWhere(DBConst.C3010004, "0"); DataTable dt = dba.ExecuteSelect(); if (dt.Rows.Count != 1) { return null; } string key = dt.Rows[0][0] as string; using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider()) { rsa.FromXmlString(key); data = rsa.Encrypt(data, false); } dba.ReInit(); dba.AddTable(DBConst.C3010000); dba.AddParam(DBConst.C3010004, 1); dba.AddWhere(DBConst.C3010001, CharUtil.Text2DB(t)); dba.AddWhere(DBConst.C3010004, "0", false); dba.ExecuteUpdate(); return data; }