Ejemplo n.º 1
0
        public ReturnValue getEntityList(string sql)
        {
            ReturnValue _result = new ReturnValue();

            _result.SQLText = sql;
            _result.Success = true;

            try
            {
                EntityList  _datalist = new EntityList();
                DataFactory _dal      = this.getDataFactory();

                DataTable dt = _dal.getDataTable(sql);
                foreach (DataRow dr in dt.Rows)
                {
                    PEntity _item = this._oEntity.BindDataToNEntity(dr);
                    _datalist.Add(_item);
                }
                _result.ObjectList = _datalist;
            }
            catch (DBException exa)
            {
                _result.ObjectList = new EntityList();
                _result.Success    = false;
                _result.ErrMessage = exa.ToString() + "---" + _globalErrorHandler.ExceptionToString(exa);
                _result.Code       = exa.ErrorCode;
            }
            catch (Exception ex)
            {
                _result.ObjectList = new EntityList();
                _result.Success    = false;
                _result.ErrMessage = ex.Message + "--" + ex.InnerException + "--" + ex.StackTrace + "---" + _globalErrorHandler.ExceptionToString(ex);
            }
            return(_result);
        }
Ejemplo n.º 2
0
        public ReturnValue getEntity(string sql)
        {
            ReturnValue _result = new ReturnValue();


            _result.SQLText = sql;
            _result.Success = true;

            try
            {
                DataFactory _dal = this.getDataFactory();
                DataTable   dt   = _dal.getDataTable(sql);

                // PEntity _item = Activator.CreateInstance(EntityType) as PEntity;

                PEntity _item = Helper.CreateNewEntityInstanceOf(EntityType) as PEntity;
                _item.TableName = _oEntity.TableName;

                if (dt.Rows.Count > 0)
                {
                    _item = this._oEntity.BindDataToNEntity(dt.Rows[dt.Rows.Count - 1]);
                }

                _result.Object = _item;
            }
            catch (DBException exa)
            {
                _result.Object     = Helper.CreateNewEntityInstanceOf(EntityType);
                _result.Success    = false;
                _result.ErrMessage = exa.ToString();
                _result.ErrMessage = exa.ToString() + "---" + _globalErrorHandler.ExceptionToString(exa) + "---" + sql;
                _result.Code       = exa.ErrorCode;
            }
            catch (Exception ex)
            {
                _result.Object     = Helper.CreateNewEntityInstanceOf(EntityType);
                _result.Success    = false;
                _result.ErrMessage = ex.Message + "--" + ex.InnerException + "--" + ex.StackTrace + "--" + _globalErrorHandler.ExceptionToString(ex) + "---" + sql;
            }
            return(_result);
        }
Ejemplo n.º 3
0
 public PGateway(PEntity o, Transaction trans)
 {
     underGateway(o.DataConnectProviders);
     this._oEntity = o;
     this._trans   = trans;
 }
Ejemplo n.º 4
0
 public PGateway(PEntity o)
 {
     underGateway(o.DataConnectProviders);
     this._oEntity = o;
 }