//=========================================================================
        //  FunctionName : AutoGenerateUserID
        /// <summary>
        /// 自动生成UserID编号方法
        /// </summary>
        /// <returns>返回UserID新编号</returns>
        //=========================================================================
        public string AutoGenerateUserID(T_PM_UserInfoApplicationData appData)
        {
            int    intNumberLength = 5;
            string strPrefix       = ("U").ToString();

            strPrefix = strPrefix.ToLower() == "null" ? "" : strPrefix;
            T_PM_UserInfoBusinessEntity instanceT_PM_UserInfoBusinessEntity = (T_PM_UserInfoBusinessEntity)CreateBusinessEntityInstance(typeof(T_PM_UserInfoBusinessEntity));
            string        strMaxValue;
            StringBuilder sbNewID = new StringBuilder(string.Empty);

            sbNewID.Append(strPrefix);

            strMaxValue = instanceT_PM_UserInfoBusinessEntity.GetMaxValue(strPrefix, intNumberLength).ToString();
            if (strMaxValue != String.Empty)
            {
                if (strMaxValue.Length == strPrefix.Length + intNumberLength)
                {
                    int intMaxValue = Convert.ToInt32(strMaxValue.Substring(strPrefix.Length, intNumberLength)) + 1;
                    sbNewID.Append(FillZeroToString(intMaxValue.ToString(), intNumberLength));
                }
                else
                {
                    sbNewID.Append(FillZeroToString("1", intNumberLength));
                }
            }
            else
            {
                sbNewID.Append(FillZeroToString("1", intNumberLength));
            }

            return(sbNewID.ToString());
        }
        //=========================================================================
        //  FunctionName : Query
        /// <summary>
        /// 检索方法
        /// </summary>
        /// <param name="appData">应用数据实体</param>
        /// <returns>返回数据实体对象</returns>
        //=========================================================================
        public T_PM_UserInfoApplicationData Query(T_PM_UserInfoApplicationData appData)
        {
            T_PM_UserInfoBusinessEntity instanceT_PM_UserInfoBusinessEntity = (T_PM_UserInfoBusinessEntity)CreateBusinessEntityInstance(typeof(T_PM_UserInfoBusinessEntity));

            instanceT_PM_UserInfoBusinessEntity.AppData = appData;
            if (instanceT_PM_UserInfoBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.PK)
            {
                instanceT_PM_UserInfoBusinessEntity.SelectByKey();
                instanceT_PM_UserInfoBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            else if (instanceT_PM_UserInfoBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.ID)
            {
                instanceT_PM_UserInfoBusinessEntity.SelectByObjectID();
                instanceT_PM_UserInfoBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            else if (instanceT_PM_UserInfoBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.ALL)
            {
                instanceT_PM_UserInfoBusinessEntity.SelectByAnyCondition();
                instanceT_PM_UserInfoBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            else
            {
                instanceT_PM_UserInfoBusinessEntity.SelectByAnyCondition();
                instanceT_PM_UserInfoBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            return(instanceT_PM_UserInfoBusinessEntity.AppData);
        }
        //=========================================================================
        //  FunctionName : Count
        /// <summary>
        /// 统计记录数方法
        /// </summary>
        /// <param name="appData">应用数据实体</param>
        /// <returns>返回数据实体对象</returns>
        //=========================================================================
        public T_PM_UserInfoApplicationData Count(T_PM_UserInfoApplicationData appData)
        {
            T_PM_UserInfoBusinessEntity instanceT_PM_UserInfoBusinessEntity = (T_PM_UserInfoBusinessEntity)CreateBusinessEntityInstance(typeof(T_PM_UserInfoBusinessEntity));

            instanceT_PM_UserInfoBusinessEntity.AppData = appData;
            instanceT_PM_UserInfoBusinessEntity.CountByAnyCondition();
            instanceT_PM_UserInfoBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            return(instanceT_PM_UserInfoBusinessEntity.AppData);
        }
        //=========================================================================
        //  FunctionName : Modify
        /// <summary>
        /// 更新方法
        /// </summary>
        /// <param name="appData">应用数据实体</param>
        /// <returns>返回数据实体对象</returns>
        //=========================================================================
        public T_PM_UserInfoApplicationData Modify(T_PM_UserInfoApplicationData appData)
        {
            T_PM_UserInfoBusinessEntity instanceT_PM_UserInfoBusinessEntity = (T_PM_UserInfoBusinessEntity)CreateBusinessEntityInstance(typeof(T_PM_UserInfoBusinessEntity));

            instanceT_PM_UserInfoBusinessEntity.AppData = appData;
            if (instanceT_PM_UserInfoBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.PK)
            {
                if (instanceT_PM_UserInfoBusinessEntity.IsExistByKey() == true)
                {
                    instanceT_PM_UserInfoBusinessEntity.UpdateByKey();
                    instanceT_PM_UserInfoBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
                }
                else
                {
                    instanceT_PM_UserInfoBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Failure;
                }
            }
            else if (instanceT_PM_UserInfoBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.ID)
            {
                if (instanceT_PM_UserInfoBusinessEntity.IsExistByObjectID() == true)
                {
                    instanceT_PM_UserInfoBusinessEntity.UpdateByObjectID();
                    instanceT_PM_UserInfoBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
                }
                else
                {
                    instanceT_PM_UserInfoBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Failure;
                }
            }
            else if (instanceT_PM_UserInfoBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.BATCH)
            {
                instanceT_PM_UserInfoBusinessEntity.UpdateByObjectIDBatch();
                instanceT_PM_UserInfoBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            else if (instanceT_PM_UserInfoBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.ALL)
            {
                instanceT_PM_UserInfoBusinessEntity.UpdateByAnyCondition();
                instanceT_PM_UserInfoBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            else
            {
                if (instanceT_PM_UserInfoBusinessEntity.IsExistByObjectID() == true)
                {
                    instanceT_PM_UserInfoBusinessEntity.UpdateByObjectID();
                    instanceT_PM_UserInfoBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
                }
                else
                {
                    instanceT_PM_UserInfoBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Failure;
                }
            }
            return(instanceT_PM_UserInfoBusinessEntity.AppData);
        }
        //=========================================================================
        //  FunctionName : Add
        /// <summary>
        /// 添加方法
        /// </summary>
        /// <param name="appData">应用数据实体</param>
        /// <returns>返回数据实体对象</returns>
        //=========================================================================
        public T_PM_UserInfoApplicationData Add(T_PM_UserInfoApplicationData appData)
        {
            T_PM_UserInfoBusinessEntity instanceT_PM_UserInfoBusinessEntity = (T_PM_UserInfoBusinessEntity)CreateBusinessEntityInstance(typeof(T_PM_UserInfoBusinessEntity));

            instanceT_PM_UserInfoBusinessEntity.AppData = appData;
            if (instanceT_PM_UserInfoBusinessEntity.IsExistByKey() == false)
            {
                instanceT_PM_UserInfoBusinessEntity.Insert();
                instanceT_PM_UserInfoBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            else
            {
                instanceT_PM_UserInfoBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Failure;
            }
            return(instanceT_PM_UserInfoBusinessEntity.AppData);
        }
        public static IEnumerable <T_PM_UserInfoApplicationData> GetCollectionFromImportDataTable(DataTable dt)
        {
            List <T_PM_UserInfoApplicationData> collection = new List <T_PM_UserInfoApplicationData>();

            foreach (DataRow dr in dt.Rows)
            {
                T_PM_UserInfoApplicationData applicationData = new T_PM_UserInfoApplicationData()
                {
                    ObjectID      = (dr.ReadGuidNullable("ObjectID") == null ? null : dr.ReadGuidNullable("ObjectID").ToString()),
                    UserID        = dr.ReadString("UserID"),
                    UserLoginName = dr.ReadString("UserLoginName"),
                    UserGroupID   = dr.ReadString("UserGroupID"),
                    SubjectID     = dr.ReadString("SubjectID"),
                    UserNickName  = dr.ReadString("UserNickName"),
                    Password      = dr.ReadString("Password"),
                    XB            = dr.ReadString("XB"),
                    MZ            = dr.ReadString("MZ"),
                    ZZMM          = dr.ReadString("ZZMM"),
                    SFZH          = dr.ReadString("SFZH"),
                    SJH           = dr.ReadString("SJH"),
                    BGDH          = dr.ReadString("BGDH"),
                    JTDH          = dr.ReadString("JTDH"),
                    Email         = dr.ReadString("Email"),
                    QQH           = dr.ReadString("QQH"),
                    LoginTime     = dr.ReadDateTimeNullable("LoginTime"),
                    LastLoginIP   = dr.ReadString("LastLoginIP"),
                    LastLoginDate = dr.ReadDateTimeNullable("LastLoginDate"),
                    LoginTimes    = dr.ReadInt32Nullable("LoginTimes"),
                    UserStatus    = dr.ReadString("UserStatus"),
                    vcode         = (dr.ReadGuidNullable("vcode") == null ? null : dr.ReadGuidNullable("vcode").ToString()),
                    lcode         = (dr.ReadGuidNullable("lcode") == null ? null : dr.ReadGuidNullable("lcode").ToString()),
                };
                collection.Add(applicationData);
            }
            return(collection);
        }