Example #1
0
        public NResult <EItemInfo> GetAvaliableItem(QItem qItem)
        {
            NResult <EItemInfo> result = new NResult <EItemInfo>();

            try
            {
                using (OOContent db = new OOContent())
                {
                    var list = db.DBItemInfo.Where(a => a.RecordStatus == RecordStatus.Normal).OrderByDescending(a => a.CreatedTime);

                    if (qItem.pageIndex == 0)
                    {
                        result.resultList = list.Take(qItem.pageSize).ToList();
                    }
                    else
                    {
                        result.resultList = list.Skip(qItem.pageIndex * qItem.pageSize).Take(qItem.pageSize).ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.ErrorMsg  = ex.Message;
            }
            return(result);
        }
Example #2
0
        /// <summary>
        /// Creates a NDataReader from a <see cref="DbDataReader" />
        /// </summary>
        /// <param name="reader">The <see cref="DbDataReader" /> to get the records from the Database.</param>
        /// <param name="isMidstream"><see langword="true" /> if we are loading the <see cref="DbDataReader" /> in the middle of reading it.</param>
        /// <remarks>
        /// NHibernate attempts to not have to read the contents of an <see cref="DbDataReader"/> into memory until it absolutely
        /// has to.  What that means is that it might have processed some records from the <see cref="DbDataReader"/> and will
        /// pick up the <see cref="DbDataReader"/> midstream so that the underlying <see cref="DbDataReader"/> can be closed
        /// so a new one can be opened.
        /// </remarks>
        public static NDataReader Create(DbDataReader reader, bool isMidstream)
        {
            var dataReader = new NDataReader();
            var resultList = new List <NResult>(2);

            try
            {
                // if we are in midstream of processing a DataReader then we are already
                // positioned on the first row (index=0)
                if (isMidstream)
                {
                    dataReader.currentRowIndex = 0;
                }

                // there will be atleast one result
                resultList.Add(NResult.Create(reader, isMidstream));

                while (reader.NextResult())
                {
                    // the second, third, nth result is not processed midstream
                    resultList.Add(NResult.Create(reader, false));
                }

                dataReader.results = resultList.ToArray();
            }
            catch (Exception e)
            {
                throw new ADOException("There was a problem converting an DbDataReader to NDataReader", e);
            }
            finally
            {
                reader.Close();
            }
            return(dataReader);
        }
Example #3
0
        protected NResult <T> GetLatestData <T>(int pageSize) where T : EBaseRecord
        {
            NResult <T> result = new NResult <T>();

            try
            {
                using (OOTContent <T> db = new OOTContent <T>())
                {
                    var list = db.Db.OrderByDescending(a => a.CreatedTime).Take(pageSize);

                    result.resultList = list.ToList();
                }
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.ErrorMsg  = ex.Message;
            }

            if (result == null)
            {
                result = new NResult <T>();
            }

            return(result);
        }
Example #4
0
        public NResult <EBanner> GetLatest()
        {
            NResult <EBanner> result = base.GetLatestData <EBanner>(10);

            // NLogHelper.InfoTxt("ttt");


            return(result);
        }
Example #5
0
        public NResult <ETaskInfo> CreateOrUpdate(ETaskInfo obj)
        {
            NResult <ETaskInfo> result = new NResult <ETaskInfo>();

            try
            {
                using (OOContent db = new OOContent())
                {
                    ETaskInfo updateObj = null;
                    if (obj.RefItemId > 0)
                    {
                        string sql       = string.Format("select count(1) from ItemInfo where Id={0}", obj.RefItemId);
                        int    ItemCount = db.Database.SqlQuery <int>(sql).FirstOrDefault();
                        if (ItemCount <= 0)
                        {
                            result.IsSuccess = false;
                            result.ErrorMsg  = "创建任务失败。没有找到对相应的对象!";
                            return(result);
                        }
                    }

                    if (obj.Id != 0)
                    {
                        updateObj = db.DBTaskInfo.Where(a => a.Id == obj.Id).FirstOrDefault();
                    }


                    //新增
                    if (updateObj == null)
                    {
                        db.DBTaskInfo.Add(obj);
                        db.SaveChanges();
                    }
                    //修改
                    else
                    {
                        updateObj.Title        = obj.Title;
                        updateObj.Description  = obj.Description;
                        updateObj.TaskType     = obj.TaskType;
                        updateObj.RecordStatus = obj.RecordStatus;
                        updateObj.RefItemId    = obj.RefItemId;
                        db.SaveChanges();
                    }
                    result.resultObj = obj;
                }
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.ErrorMsg  = ex.Message;
                ErrorToDb(ex.Message);
            }
            return(result);
        }
Example #6
0
        public NResult <EUserInfo> QueryTeamMember()
        {
            NResult <EUserInfo> result = new NResult <EUserInfo>();

            try
            {
            }
            catch (Exception ex)
            {
            }
            return(result);
        }
Example #7
0
        public NResult <EUserInfo> Login(string loginName,
                                         string pwd,
                                         string DeviceIdentify       = "",
                                         string DeviceToken          = "",
                                         DeviceChannel DeviceChannel = DeviceChannel.IOS)
        {
            NResult <EUserInfo> result = new NResult <EUserInfo>();

            try
            {
                NLogHelper.InfoTxt(string.Format("用户{0}登陆,密码:{1},DeviceIdentify:{2}", loginName, pwd, DeviceIdentify));
                using (OOContent db = new OOContent())
                {
                    EUserInfo ui = db.DBUserInfo.Where(a => a.LoginName == loginName && a.Pwd == pwd).FirstOrDefault();
                    //var sql = @"select ui.Id,ui.NickName,
                    //                   ui.Phone,ui.UserRole,
                    //                   ui.HeaderImgUrl,
                    //                   ui.RecordStatus
                    //            from UserInfo as ui
                    //            where ui.LoginName = @LoginName and ui.Pwd = @Pwd";
                    //sql = string.Format(sql, loginName, pwd);
                    //List<SqlParameter> pList = new List<SqlParameter>();
                    //pList.Add(new SqlParameter("@LoginName", loginName));
                    //pList.Add(new SqlParameter("@Pwd", pwd));

                    //RUserInfo ui = db.Database.SqlQuery<RUserInfo>(sql, pList.ToArray()).FirstOrDefault();
                    if (ui == null)
                    {
                        result.ErrorMsg = "用户名或密码错误";
                        return(result);
                    }
                    else
                    {
                        ui.LastLoginDateTime = DateTime.Now;
                        //更新设备对应的手机
                        UpdateDevice(DeviceIdentify, loginName, db);
                        db.SaveChanges();
                    }
                    result.resultObj = ui;
                }
            }
            catch (Exception ex)
            {
                result.ErrorMsg = ex.Message;
                ErrorToDb(ex.Message);
            }
            return(result);
        }
Example #8
0
        public NResult <RUserTask> QueryUserTask(QTask qTask)
        {
            NResult <RUserTask> result = new NResult <RUserTask>();

            try
            {
                using (OOContent db = new OOContent())
                {
                    var sql = @"select t.Title,
                    t.Description as TaskDescription,
                    t.TaskType,
                    t.Id as TaskId,
                    item.Name as ItemName,
                    item.RealUrl,
                    item.Price,
                    ut.UserTaskStatus,
                    ut.UserId,
                    ut.Id  
                    from TaskInfo as t
                    join UserTask as ut on ut.TaskId = t.Id
                    join ItemInfo as item on item.Id = t.RefItemId
                    where ut.UserId = @UserId 
                    order by ut.CreatedTime";

                    //sql = string.Format(sql, qTask.AcceptUserId);
                    SqlParameter[] param = new SqlParameter[] {
                        new SqlParameter("@UserId", qTask.AcceptUserId)
                    };

                    var list = db.Database.SqlQuery <RUserTask>(sql, param);

                    if (qTask.pageIndex == 0)
                    {
                        result.resultList = list.Take(qTask.pageSize).ToList();
                    }
                    else
                    {
                        result.resultList = list.Skip(qTask.pageIndex * qTask.pageSize).Take(qTask.pageSize).ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.ErrorMsg  = ex.Message;
            }
            return(result);
        }
            /// <summary>
            /// Initializes a new instance of the NResult class.
            /// </summary>
            /// <param name="reader">The DbDataReader to populate the Result with.</param>
            /// <param name="isMidstream">
            /// <see langword="true" /> if the <see cref="DbDataReader"/> is already positioned on the record
            /// to start reading from.
            /// </param>
            /// <param name="cancellationToken">A cancellation token that can be used to cancel the work</param>
            internal static async Task <NResult> CreateAsync(DbDataReader reader, bool isMidstream, CancellationToken cancellationToken)
            {
                cancellationToken.ThrowIfCancellationRequested();
                var schemaTable = SafeGetSchemaTable(reader, out var exception);
                var result      = new NResult
                {
                    schemaTable = schemaTable,
                    schemaTableNotSupportedException = exception
                };

                List <object[]> recordsList = new List <object[]>();
                int             rowIndex    = 0;

                // if we are in the middle of processing the reader then don't bother
                // to move to the next record - just use the current one.
                while (isMidstream || await(reader.ReadAsync(cancellationToken)).ConfigureAwait(false))
                {
                    if (rowIndex == 0)
                    {
                        for (int i = 0; i < reader.FieldCount; i++)
                        {
                            string fieldName = reader.GetName(i);
                            result.fieldNameToIndex[fieldName] = i;
                            result.fieldIndexToName.Add(fieldName);
                            result.fieldTypes.Add(reader.GetFieldType(i));
                            result.fieldDataTypeNames.Add(reader.GetDataTypeName(i));
                        }

                        result.colCount = reader.FieldCount;
                    }

                    rowIndex++;

                    object[] colValues = new object[reader.FieldCount];
                    reader.GetValues(colValues);
                    recordsList.Add(colValues);

                    // we can go back to reading a reader like normal and don't need
                    // to consider where we started from.
                    isMidstream = false;
                }

                result.records = recordsList.ToArray();
                return(result);
            }
Example #10
0
        public NResult <EItemInfo> CreateOrUpdate(EItemInfo obj)
        {
            NResult <EItemInfo> result = new NResult <EItemInfo>();

            try
            {
                using (OOContent db = new OOContent())
                {
                    EItemInfo updateObj = null;
                    if (obj.Id != 0)
                    {
                        updateObj = db.DBItemInfo.Where(a => a.Id == obj.Id).FirstOrDefault();
                    }

                    //新增
                    if (updateObj == null)
                    {
                        db.DBItemInfo.Add(obj);
                        db.SaveChanges();
                    }
                    //修改
                    else
                    {
                        updateObj.Channel = obj.Channel;
                        updateObj.Name    = obj.Name;
                        updateObj.Price   = obj.Price;
                        updateObj.RealUrl = obj.RealUrl;
                        updateObj.StoreId = obj.StoreId;

                        updateObj.RecordStatus = obj.RecordStatus;

                        db.SaveChanges();
                    }
                    result.resultObj = obj;
                }
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.ErrorMsg  = ex.Message;
                ErrorToDb(ex.Message);
            }
            return(result);
        }
Example #11
0
            /// <summary>
            /// Initializes a new instance of the NResult class.
            /// </summary>
            /// <param name="reader">The DbDataReader to populate the Result with.</param>
            /// <param name="isMidstream">
            /// <see langword="true" /> if the <see cref="DbDataReader"/> is already positioned on the record
            /// to start reading from.
            /// </param>
            internal static NResult Create(DbDataReader reader, bool isMidstream)
            {
                var result = new NResult
                {
                    schemaTable = reader.GetSchemaTable()
                };

                List <object[]> recordsList = new List <object[]>();
                int             rowIndex    = 0;

                // if we are in the middle of processing the reader then don't bother
                // to move to the next record - just use the current one.
                while (isMidstream || reader.Read())
                {
                    if (rowIndex == 0)
                    {
                        for (int i = 0; i < reader.FieldCount; i++)
                        {
                            string fieldName = reader.GetName(i);
                            result.fieldNameToIndex[fieldName] = i;
                            result.fieldIndexToName.Add(fieldName);
                            result.fieldTypes.Add(reader.GetFieldType(i));
                            result.fieldDataTypeNames.Add(reader.GetDataTypeName(i));
                        }

                        result.colCount = reader.FieldCount;
                    }

                    rowIndex++;

                    object[] colValues = new object[reader.FieldCount];
                    reader.GetValues(colValues);
                    recordsList.Add(colValues);

                    // we can go back to reading a reader like normal and don't need
                    // to consider where we started from.
                    isMidstream = false;
                }

                result.records = recordsList.ToArray();
                return(result);
            }
        /// <summary>
        /// Creates a NDataReader from a <see cref="DbDataReader" />
        /// </summary>
        /// <param name="reader">The <see cref="DbDataReader" /> to get the records from the Database.</param>
        /// <param name="isMidstream"><see langword="true" /> if we are loading the <see cref="DbDataReader" /> in the middle of reading it.</param>
        /// <param name="cancellationToken">A cancellation token that can be used to cancel the work</param>
        /// <remarks>
        /// NHibernate attempts to not have to read the contents of an <see cref="DbDataReader"/> into memory until it absolutely
        /// has to.  What that means is that it might have processed some records from the <see cref="DbDataReader"/> and will
        /// pick up the <see cref="DbDataReader"/> midstream so that the underlying <see cref="DbDataReader"/> can be closed
        /// so a new one can be opened.
        /// </remarks>
        public static async Task <NDataReader> CreateAsync(DbDataReader reader, bool isMidstream, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            var dataReader = new NDataReader();
            var resultList = new List <NResult>(2);

            try
            {
                // if we are in midstream of processing a DataReader then we are already
                // positioned on the first row (index=0)
                if (isMidstream)
                {
                    dataReader.currentRowIndex = 0;
                }

                // there will be atleast one result
                resultList.Add(await(NResult.CreateAsync(reader, isMidstream, cancellationToken)).ConfigureAwait(false));

                while (await(reader.NextResultAsync(cancellationToken)).ConfigureAwait(false))
                {
                    // the second, third, nth result is not processed midstream
                    resultList.Add(await(NResult.CreateAsync(reader, false, cancellationToken)).ConfigureAwait(false));
                }

                dataReader.results = resultList.ToArray();
            }

            catch (OperationCanceledException) { throw; }
            catch (Exception e)
            {
                throw new ADOException("There was a problem converting an DbDataReader to NDataReader", e);
            }
            finally
            {
                reader.Close();
            }
            return(dataReader);
        }
Example #13
0
        public NResult <ETaskInfo> QueryTask(QTask qTask)
        {
            NResult <ETaskInfo> result = new NResult <ETaskInfo>();

            try
            {
                using (OOContent db = new OOContent())
                {
                    var list = db.DBTaskInfo.Where(a => a.TaskType != TaskType.ALL);

                    if (qTask.RecordStatus != RecordStatus.ALL)
                    {
                        list = list.Where(a => a.RecordStatus == RecordStatus.Normal);
                    }

                    list = list.OrderByDescending(a => a.CreatedTime);

                    if (qTask.pageIndex == 0)
                    {
                        result.resultList = list.Take(qTask.pageSize).ToList();
                    }
                    else
                    {
                        result.resultList = list.Skip(qTask.pageIndex * qTask.pageSize).Take(qTask.pageSize).ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.ErrorMsg  = ex.Message;

                ErrorToDb(ex.Message);
            }
            return(result);
        }
Example #14
0
        public NResult <EUserTask> CreateUserTask(long UserId, long TaskId)
        {
            NResult <EUserTask> result = new NResult <EUserTask>();

            try
            {
                using (OOContent db = new OOContent())
                {
                    ETaskInfo task = db.DBTaskInfo.Where(a => a.Id == TaskId).FirstOrDefault();
                    if (task == null || task.RecordStatus == RecordStatus.Blocked)
                    {
                        result.IsSuccess = false;
                        result.ErrorMsg  = "任务已无效,请刷新界面再接受任务";
                        return(result);
                    }
                    //查找状态为【处理中】的订单,如果有则此任务不能接受
                    EUserTask userTask = db.DBUserTask.Where(a => a.TaskId == TaskId &&
                                                             a.UserId == UserId &&
                                                             a.UserTaskStatus == UserTaskStatus.Process).FirstOrDefault();

                    if (userTask != null)
                    {
                        result.IsSuccess = false;
                        result.ErrorMsg  = "已经有相同的任务在执行";
                        result.IntMsg    = -10;
                        result.resultObj = userTask;
                        return(result);
                    }
                    using (TransactionScope ts = new TransactionScope())
                    {
                        //用户接受任务
                        userTask                = new EUserTask();
                        userTask.UserId         = UserId;
                        userTask.TaskId         = TaskId;
                        userTask.UserTaskStatus = UserTaskStatus.Process;
                        userTask.CreatedTime    = DateTime.Now;
                        db.DBUserTask.Add(userTask);
                        db.SaveChanges();

                        //如果是订单任务,创建任务对应的订单
                        if (task.TaskType == TaskType.Order)
                        {
                            EUserTaskOrder userTaskOrder = new EUserTaskOrder()
                            {
                                OrderId    = StringHelper.GenerateOONo(),
                                Qty        = 1,
                                UserTaskId = userTask.Id
                            };
                            db.DBUserTaskOrder.Add(userTaskOrder);
                        }

                        db.SaveChanges();
                        ts.Complete();
                    }



                    result.resultObj = userTask;
                }
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.ErrorMsg  = ex.Message;
                ErrorToDb(ex.Message);
            }
            return(result);
        }
Example #15
0
        /// <summary>
        /// Save To File.
        /// </summary>
        /// <typeparam name="T">The NXmlDocument type.</typeparam>
        /// <param name="fileName">Filename to save.</param>
        /// <param name="obj">The NXmlDocument instance to save.</param>
        /// <returns>Returns NResult instance that contains exception if error occur.</returns>
        public static NResult <bool> SaveToFile <T>(string fileName, T obj)
            where T : NXmlDocument, new()
        {
            MethodBase     med    = MethodBase.GetCurrentMethod();
            NResult <bool> result = new NResult <bool>();

            result.Result = false;
            try
            {
                if (null != obj)
                {
                    List <Type> contentTypes = new List <Type>();
                    // Add Type of object itselt
                    contentTypes.Add(obj.GetType());
                    // Check content types.
                    if (null != obj.Contents && obj.Contents.Count > 0)
                    {
                        foreach (object content in obj.Contents)
                        {
                            if (null == content)
                            {
                                continue;
                            }
                            Type type = content.GetType();
                            // Checks Generic Type.
                            if (type.IsGenericType)
                            {
                                Type[] genTypes = type.GetGenericArguments();

                                foreach (Type genType in genTypes)
                                {
                                    if (null == genType)
                                    {
                                        continue;
                                    }
                                    if (!contentTypes.Contains(genType))
                                    {
                                        contentTypes.Add(genType);
                                    }
                                }
                            }
                            // Add Type It self.
                            if (!contentTypes.Contains(type))
                            {
                                contentTypes.Add(type);
                            }
                        }
                    }
                    // Kepp extra types.
                    Type[] originals = XmlManager.ExtraTypes;
                    // Add content types to Extra Types.
                    XmlManager.ExtraTypes = (null != contentTypes) ?
                                            contentTypes.ToArray() : null;
                    result = XmlManager.SaveToFile(fileName, obj.GetType(), obj);
                    // Restore extra types.
                    XmlManager.ExtraTypes = originals;
                }
            }
            catch (Exception ex)
            {
                med.Err(ex);
                // Set result.
                result.Err = ex;
            }

            return(result);
        }
Example #16
0
        public NResult <EUserInfo> Register(InUserReg userReg)
        {
            NResult <EUserInfo> result        = new NResult <EUserInfo>();
            EUserInfo           ui            = null;
            EUserQRInvite       pQR           = null;
            SMSController       smsController = new SMSController();

            try
            {
                if (string.IsNullOrEmpty(userReg.Phone))
                {
                    result.ErrorMsg = "手机号不能未空";
                    return(result);
                }
                if (string.IsNullOrEmpty(userReg.Pwd))
                {
                    result.ErrorMsg = "密码不能为空";
                    return(result);
                }
                if (string.IsNullOrEmpty(userReg.VerifyCode))
                {
                    result.ErrorMsg = "验证码不能为空";
                    return(result);
                }
                OutAPIResult smsResult = smsController.ConfirmVerification(userReg.Phone, userReg.VerifyCode);

                if (!smsResult.IsSuccess)
                {
                    result.ErrorMsg = smsResult.ErrorMsg;
                    return(result);
                }
                using (OOContent db = new OOContent())
                {
                    using (TransactionScope ts = new TransactionScope())
                    {
                        //创建用户基本信息
                        ui = db.DBUserInfo.Where(a => a.Phone == userReg.Phone).FirstOrDefault();
                        if (ui != null)
                        {
                            result.ErrorMsg = "手机号已存在";
                            return(result);
                        }

                        ui = new EUserInfo();
                        //如果昵称或登陆名为空,则用手机号补充
                        if (string.IsNullOrEmpty(userReg.LoginName))
                        {
                            ui.LoginName = userReg.Phone;
                        }
                        if (string.IsNullOrEmpty(userReg.NickName))
                        {
                            ui.NickName = userReg.Phone;
                        }

                        ui.Phone            = userReg.Phone;
                        ui.Pwd              = userReg.Pwd;
                        ui.UserRole         = IQBCore.OO.BaseEnum.UserRole.User;
                        ui.RecordStatus     = IQBCore.OO.BaseEnum.RecordStatus.Normal;
                        ui.RegisterDateTime = DateTime.Now;
                        ui.RegisterChannel  = RegisterChannel.OOAPP;
                        db.DBUserInfo.Add(ui);

                        //检查邀请码
                        if (!string.IsNullOrEmpty(userReg.InviteCode))
                        {
                            pQR = db.DBUserQRInvite.Where(a => a.InviteCode == userReg.InviteCode).FirstOrDefault();
                            if (pQR == null)
                            {
                                result.ErrorMsg = "邀请码没有找到对应的用户";
                                return(result);
                            }
                        }
                        db.SaveChanges();

                        //创建用户邀请码
                        EUserQRInvite qr = new EUserQRInvite
                        {
                            InviteCode = StringHelper.GenerateUserInviteCode(ui.Phone),
                            QRPath     = "",
                            QRUrl      = "",
                            UserId     = ui.Id
                        };
                        db.DBUserQRInvite.Add(qr);

                        //用户关系
                        EUserRelation ur = new EUserRelation();
                        ur.UserId   = ui.Id;
                        ur.UserName = ui.NickName;

                        if (pQR != null)
                        {
                            ur.PId = pQR.UserId;
                        }
                        db.DBUserRelation.Add(ur);

                        //用户账户
                        EUserBalance ub = new EUserBalance();
                        ub.UserId       = ui.Id;
                        ub.Balance      = 0;
                        ub.CurrencyCode = CoreStatic.Instance.Sys.CurCurrencyCode;
                        db.DBUserBalance.Add(ub);

                        //用户回报
                        EUserReward reward = new EUserReward();
                        reward.UserId          = ui.Id;
                        reward.ADRewardRate    = CoreStatic.Instance.Sys.ADRewardRate;
                        reward.OrderRewardRate = CoreStatic.Instance.Sys.L1RewardRate;
                        reward.IntroRate       = CoreStatic.Instance.Sys.IntroRate;
                        db.DBUserReward.Add(reward);

                        //绑定用户设备和用户手机号
                        UpdateDevice(userReg.DeviceIdentify, userReg.Phone, db);

                        db.SaveChanges();

                        ts.Complete();
                    }

                    result.resultObj = ui;
                }
            }
            catch (Exception ex)
            {
                result.ErrorMsg = ex.Message;
                ErrorToDb(ex.Message);
            }
            return(result);
        }
Example #17
0
        public static NResult <D> LoadFromFile <D>(string fileName)
            where D : NXmlDocument, new()
        {
            MethodBase med          = MethodBase.GetCurrentMethod();
            string     dataTypeName = string.Empty;
            string     assemblyName = string.Empty;
            XElement   xmlDoc       = null;

            NResult <D> result = new NResult <D>();

            try
            {
                // Load data for check information.
                xmlDoc = XElement.Load(fileName);
                if (null != xmlDoc)
                {
                    XElement infoElement = xmlDoc.Descendants("Properties").FirstOrDefault();

                    if (null != infoElement)
                    {
                        /*
                         * XElement contentTypeElement = infoElement.Descendants("ContentType").FirstOrDefault();
                         * if (null != contentTypeElement)
                         * {
                         *  // Gets Data's Type.
                         *  XAttribute dataTypeAttr =
                         *      contentTypeElement.Attribute("DataType");
                         *  dataTypeName = (null != dataTypeAttr) ?
                         *      dataTypeAttr.Value : string.Empty;
                         *  // Gets Config's Assembly.
                         *  XAttribute assmNameAttr =
                         *      contentTypeElement.Attribute("AssemblyName");
                         *  assemblyName = (null != assmNameAttr) ?
                         *      assmNameAttr.Value : string.Empty;
                         *
                         *  if (!string.IsNullOrWhiteSpace(dataTypeName))
                         *  {
                         *      // Trick to add dll name after type
                         *      // in this case is NLib.dll or NLib.Firebird.dll or NLib.ODP.dll.
                         *      Type contentType = null;
                         *      if (!string.IsNullOrWhiteSpace(assemblyName))
                         *      {
                         *          contentType = Type.GetType(dataTypeName + ", " + assemblyName);
                         *      }
                         *      else
                         *      {
                         *          contentType = Type.GetType(dataTypeName);
                         *      }
                         *      // Create Generic Type for NXmlDocument<T>.
                         *      Type type = typeof(NXmlDocument<>).MakeGenericType(contentType);
                         *      // Re-Load from file
                         *      result = XmlManager.LoadFromFile<D>(fileName);
                         *  }
                         * }
                         */
                    }
                }
            }
            catch (Exception ex)
            {
                med.Err(ex);
            }
            finally
            {
                xmlDoc = null;
            }

            return(result);
        }