Exemplo n.º 1
0
    public static CartLocation GetCartLocationByLocationID(int location_id)
    {
        CartDB db = new CartDB();
        DataSet ds = db.GetLocationFromLocationId(location_id);

        if (ds != null)
        {
            using (DataTableReader data = ds.CreateDataReader())
            {
                if (data.Read())
                {
                    int locationid = data.GetInt32(data.GetOrdinal("LocationId"));
                    int cartid = data.GetInt32(data.GetOrdinal("CartId"));
                    int locationtype = data.GetInt32(data.GetOrdinal("LocationType"));
                    string businessname = Helper.IsString(data.GetValue(data.GetOrdinal("BusinessName")), "");
                    string fullname = Helper.IsString(data.GetValue(data.GetOrdinal("FullName")), "");
                    string address1 = Helper.IsString(data.GetValue(data.GetOrdinal("Address1")), "");
                    string address2 = Helper.IsString(data.GetValue(data.GetOrdinal("Address2")), "");
                    string city = Helper.IsString(data.GetValue(data.GetOrdinal("City")), "");
                    string statecode = Helper.IsString(data.GetValue(data.GetOrdinal("StateCode")), "");
                    string postalcode = Helper.IsString(data.GetValue(data.GetOrdinal("PostalCode")), "");
                    string countrycode = Helper.IsString(data.GetValue(data.GetOrdinal("CountryCode")), "");
                    string phone = Helper.IsString(data.GetValue(data.GetOrdinal("Phone")), "");
                    string email = Helper.IsString(data.GetValue(data.GetOrdinal("Email")), "");
                    DateTime datecreated = data.GetDateTime(data.GetOrdinal("DateCreated"));
                    DateTime lastupdated = data.GetDateTime(data.GetOrdinal("LastUpdated"));
                    string Title = "";// CompletedCart.BillingLocation.UTitle;
                    string AreaCode =""; //CompletedCart.BillingLocation.AreaCode;
                    string PhoneExt = "";//CompletedCart.BillingLocation.PhoneExt;
                    string Fax = "";//CompletedCart.BillingLocation.Fax;

                    return new CartLocation(locationid, cartid, locationtype, businessname, fullname, address1, address2, city, statecode, postalcode, countrycode, phone,
                        email, datecreated, lastupdated, Title, AreaCode, PhoneExt, Fax);
                }
            }
        }

        return null;
    }