Exemple #1
0
        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();
        }
Exemple #2
0
        /// <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();
        }
Exemple #3
0
        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;
        }