Esempio n. 1
0
        /// <summary>
        /// 新增或修改用户登录信息
        /// </summary>
        /// <param name="info"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        public static bool AddOrUpdateUserLoginInfo(UserLogin info, EnumAddOrUpdate mode)
        {
            bool           ret   = false;
            IDbConnection  conn  = null;
            IDbCommand     cmd   = null;
            IDbTransaction trans = null;

            try
            {
                IUserLogin dp = DataProvider.DbUserLoginDP;
                conn = DbConnOperation.CreateMySqlConnection();
                cmd  = conn.CreateCommand();
                conn.Open();
                trans           = conn.BeginTransaction();
                cmd.Transaction = trans;
                ret             = dp.AddOrUpdateUserLoginInfo(cmd, info, mode);
                trans.Commit();
            }
            catch (Exception ex)
            {
                if (trans != null)
                {
                    trans.Rollback();
                }
                log.Error(string.Format("AddOrUpdateUserLoginInfo()出错,错误信息如下:{0}", ex.Message));
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }
            return(ret);
        }