示例#1
0
 public List<StateProvince> GetAll()
 {
     StateProvinceDAC _stateProvinceComponent = new StateProvinceDAC();
      IDataReader reader =  _stateProvinceComponent.GetAllStateProvince().CreateDataReader();
      List<StateProvince> _stateProvinceList = new List<StateProvince>();
      while(reader.Read())
      {
      if(_stateProvinceList == null)
          _stateProvinceList = new List<StateProvince>();
          StateProvince _stateProvince = new StateProvince();
          if(reader["StateProvinceId"] != DBNull.Value)
              _stateProvince.StateProvinceId = Convert.ToInt32(reader["StateProvinceId"]);
          if(reader["StateProvinceCode"] != DBNull.Value)
              _stateProvince.StateProvinceCode = Convert.ToString(reader["StateProvinceCode"]);
          if(reader["CountryRegionCode"] != DBNull.Value)
              _stateProvince.CountryRegionCode = Convert.ToString(reader["CountryRegionCode"]);
          if(reader["IsOnlyStateProvince"] != DBNull.Value)
              _stateProvince.IsOnlyStateProvince = Convert.ToBoolean(reader["IsOnlyStateProvince"]);
          if(reader["Name"] != DBNull.Value)
              _stateProvince.Name = Convert.ToString(reader["Name"]);
          if(reader["RowGuid"] != DBNull.Value)
              _stateProvince.RowGuid = new Guid(reader["RowGuid"].ToString());
          if(reader["ModifiedDate"] != DBNull.Value)
              _stateProvince.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
      _stateProvince.NewRecord = false;
      _stateProvinceList.Add(_stateProvince);
      }             reader.Close();
      return _stateProvinceList;
 }
示例#2
0
 public StateProvince GetByID(int _stateProvinceId)
 {
     StateProvinceDAC _stateProvinceComponent = new StateProvinceDAC();
      IDataReader reader = _stateProvinceComponent.GetByIDStateProvince(_stateProvinceId);
      StateProvince _stateProvince = null;
      while(reader.Read())
      {
          _stateProvince = new StateProvince();
          if(reader["StateProvinceId"] != DBNull.Value)
              _stateProvince.StateProvinceId = Convert.ToInt32(reader["StateProvinceId"]);
          if(reader["StateProvinceCode"] != DBNull.Value)
              _stateProvince.StateProvinceCode = Convert.ToString(reader["StateProvinceCode"]);
          if(reader["CountryRegionCode"] != DBNull.Value)
              _stateProvince.CountryRegionCode = Convert.ToString(reader["CountryRegionCode"]);
          if(reader["IsOnlyStateProvince"] != DBNull.Value)
              _stateProvince.IsOnlyStateProvince = Convert.ToBoolean(reader["IsOnlyStateProvince"]);
          if(reader["Name"] != DBNull.Value)
              _stateProvince.Name = Convert.ToString(reader["Name"]);
          if(reader["RowGuid"] != DBNull.Value)
              _stateProvince.RowGuid = new Guid(reader["RowGuid"].ToString());
          if(reader["ModifiedDate"] != DBNull.Value)
              _stateProvince.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
      _stateProvince.NewRecord = false;             }             reader.Close();
      return _stateProvince;
 }
示例#3
0
 public bool Insert(StateProvince stateprovince)
 {
     int autonumber = 0;
     StateProvinceDAC stateprovinceComponent = new StateProvinceDAC();
     bool endedSuccessfuly = stateprovinceComponent.InsertNewStateProvince( ref autonumber,  stateprovince.StateProvinceCode,  stateprovince.CountryRegionCode,  stateprovince.IsOnlyStateProvince,  stateprovince.Name,  stateprovince.RowGuid,  stateprovince.ModifiedDate);
     if(endedSuccessfuly)
     {
         stateprovince.StateProvinceId = autonumber;
     }
     return endedSuccessfuly;
 }
示例#4
0
 public bool Update(StateProvince stateprovince ,int old_stateProvinceId)
 {
     StateProvinceDAC stateprovinceComponent = new StateProvinceDAC();
     return stateprovinceComponent.UpdateStateProvince( stateprovince.StateProvinceCode,  stateprovince.CountryRegionCode,  stateprovince.IsOnlyStateProvince,  stateprovince.Name,  stateprovince.RowGuid,  stateprovince.ModifiedDate,  old_stateProvinceId);
 }