Example #1
0
 /// <summary>
 /// Filling up the address details info
 /// </summary>
 /// <param name="inReader"></param>
 /// <param name="p_slAddressInfo"></param>
 private void FillFlatInfo(IDataReader p_inReader, SortedList p_slAddressInfo,string p_houseNumber)
 {
     string flatNumber = String.Empty;
     string[] flatArray=new string[0];
     string flatInfo = Convert.ToString(p_inReader["SBN"]);
     flatArray = flatInfo.Split(';');
     for (int arrayIndex = 0; arrayIndex < flatArray.Length; arrayIndex++)
     {
             clsCustomerInfo objCustInfo = new clsCustomerInfo();
             objCustInfo.ApartmentNumber = Convert.ToString(flatArray[arrayIndex]);
             objCustInfo.StreenName = Convert.ToString(p_inReader["STR"]);
             objCustInfo.HouseNumber = p_houseNumber;
             objCustInfo.Town = Convert.ToString(p_inReader["TWN"]);
             objCustInfo.buildingName = Convert.ToString(p_inReader["BNA"]);
             string key=objCustInfo.ApartmentNumber.Replace(" ", "").ToUpper() + objCustInfo.HouseNumber.Replace(" ", "").ToUpper();
             if (!p_slAddressInfo.Contains(key))
             {
                 p_slAddressInfo.Add(key, objCustInfo);
             }
     }
 }
Example #2
0
 SortedList ICustomerInfoDAO.GetCustomerAddresses(string p_houseNumber, string p_postCode)
 {
     SortedList slCustomerAddress = new SortedList();
     string sqlCommand = String.Empty;
     CCustomerInfo tempCustomerInfo = new CCustomerInfo();
     string[] houseNumberArray = new string[0];
     try
     {
         this.OpenConnection();
         if (p_houseNumber == String.Empty || p_houseNumber == null)
         {
             sqlCommand = String.Format(SqlQueries.GetQuery(Query.GetCustomerAddressWithoutHouseNumber), p_postCode.Replace(" ",""));
         }
         else
         {
             sqlCommand = String.Format(SqlQueries.GetQuery(Query.GetCustomerAddressDetails), p_houseNumber, p_postCode.Replace(" ", ""));
         }
         IDataReader oReader = this.ExecuteReader(sqlCommand);
          string key ="";
         if (oReader != null)
         {
             while (oReader.Read())
             {
                         clsCustomerInfo objCustInfo = new clsCustomerInfo();
                         objCustInfo.ApartmentNumber = Convert.ToString(oReader["SBN"]);
                         objCustInfo.StreenName = Convert.ToString(oReader["STR"]);
                         objCustInfo.HouseNumber = Convert.ToString(oReader["NUM"]);
                         objCustInfo.Town = Convert.ToString(oReader["TWN"]);
                         objCustInfo.buildingName = Convert.ToString(oReader["BNA"]);
                         objCustInfo.PostalCode = p_postCode;
                         key = p_postCode.Replace(" ", "").ToUpper() + "-" + objCustInfo.ApartmentNumber.Replace(" ", "").ToUpper() + "-" + objCustInfo.HouseNumber.Replace(" ", "").ToUpper();
                         if (!slCustomerAddress.Contains(key))
                         {
                             slCustomerAddress.Add(key, objCustInfo);
                         }
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Write("Exception : " + ex + " in CustomerInfoGetByCustomerID()", LogLevel.Error, "Database");
         if (ex.GetType().Equals(typeof(SqlException)))
         {
             SqlException oSQLEx = ex as SqlException;
             if (oSQLEx.Number != 7619)
                 throw new Exception("Exception occured at CustomerInfoGetByCustomerID()", ex);
         }
         else
         {
             throw new Exception("Exception occure at CustomerInfoGetByCustomerID()", ex);
         }
     }
     finally
     {
         this.CloseConnection();
     }
     return slCustomerAddress;
 }