AMF-Perl

 view release on metacpan or  search on metacpan

doc/examples/petmarket/petmarket/api/cartservice.pm  view on Meta::CPAN

    return $id;
}

sub newCart
{
    my ($self) = @_;
    my ($id, $count);
    do
    {
        $id = "cart" . time() . "." . (int(rand 1000000) + 1);
        my $ary_ref = $self->dbh->selectall_arrayref("SELECT count(*) FROM cart_details WHERE cartid = '$id'");
        $count = $ary_ref->[0]->[0];
    }
    while ($count > 0);

    $self->dbh->do("INSERT INTO cart_details SET cartid='$id'");

    return $id;
}

#TODO - where does the item quantity come from?
sub getCartItems
{
    my ($self, $cartid) = @_;
    my @result;
    my $ary_ref = $self->dbh->selectall_arrayref("SELECT d.quantity, a.productid, a.itemid, unitcost, b.descn, attr1, c.name,e.catid FROM item a, item_details b, product_details c, cart_details d, product e WHERE a.itemid=b.itemid AND a.productid= c....
    foreach my $rowRef (@$ary_ref)
    {
        my ($cartQuantity, $productid, $itemid, $unitcost, $descn, $attr, $productname, $catid) = @$rowRef;
        my @row;
        push @row, $itemid;
        push @row, 999;
        push @row, $itemid;
        push @row, $attr;
        push @row, $cartQuantity;
        push @row, $productid;

doc/examples/petmarket/petmarket/api/cartservice.pm  view on Meta::CPAN

    my @columnNames = ("ITEMOID", "ITEMQUANTITY", "ITEMID", "ITEMNAME", "QUANTITY", "PRODUCTOID", "LISTPRICE", "DESCRIPTION", "NAME", "CATEGORYOID", "COLOR");

    return AMF::Perl::Util::Object->pseudo_query(\@columnNames, \@result);
}

sub getCartTotal
{
    my ($self, $cartid) = @_;
    my ($count, $total);

    my $ary_ref = $self->dbh->selectall_arrayref("SELECT unitcost, quantity FROM cart_details a, item_details b WHERE a.itemid=b.itemid AND a.cartid='$cartid'");
    foreach my $rowRef (@$ary_ref)
    {
        my ($unitcost, $quantity) = @$rowRef;
        $total += $quantity * $unitcost;
        $count += $quantity;
    }

    my $result = new AMF::Perl::Util::Object;
    $result->{total} = $total;
    $result->{count} = $count;

doc/examples/petmarket/petmarket/api/catalogservice.pm  view on Meta::CPAN

	    "returns" => "AMFObject"
        },
    };
    
}

sub getCategories
{
    my ($self) = @_;
    my @result;
    my $ary_ref = $self->dbh->selectall_arrayref("SELECT catid, name FROM category_details");
    foreach my $rowRef (@$ary_ref)
    {
        my ($catid, $name) = @$rowRef;
        my @row;
        push @row, $catid;
        push @row, $name;
        push @row, lc $name;
        push @row, "888888";
        push @result, \@row;
    }

doc/examples/petmarket/petmarket/api/catalogservice.pm  view on Meta::CPAN

    my @columnNames = ("CATEGORYOID", "CATEGORYDISPLAYNAME", "CATEGORYNAME", "COLOR");

    return Flash::FLAP::Util::Object->pseudo_query(\@columnNames, \@result);
}


sub getProducts
{
    my ($self, $catid) = @_;
    my @result;
    my $ary_ref = $self->dbh->selectall_arrayref("SELECT catid, a.productid, name, image, descn FROM product a, product_details b WHERE a.productid=b.productid AND catid='$catid'");
    foreach my $rowRef (@$ary_ref)
    {
        my ($catid, $productid, $name, $image, $descn) = @$rowRef;
        my @row;
        push @row, $catid;
        push @row, $productid;
        push @row, $productid;
        push @row, $name;
        push @row, $image;
        push @row, $descn;

doc/examples/petmarket/petmarket/api/catalogservice.pm  view on Meta::CPAN

    my @columnNames = ("CATEGORYOID", "PRODUCTOID", "PRODUCTID", "NAME", "IMAGE", "DESCRIPTION");

    return Flash::FLAP::Util::Object->pseudo_query(\@columnNames, \@result);
}


sub getItems
{
    my ($self, $productid) = @_;
    my @result;
    my $ary_ref = $self->dbh->selectall_arrayref("SELECT a.productid, a.itemid, unitcost, b.descn, attr1, c.name FROM item a, item_details b, product_details c WHERE a.itemid=b.itemid AND a.productid=c.productid AND c.productid='$productid'");
    foreach my $rowRef (@$ary_ref)
    {
        my ($productid, $itemid, $unitcost, $descn, $attr, $productname) = @$rowRef;
        my @row;
        push @row, $itemid;
        push @row, $itemid;
        push @row, $attr;
        push @row, 999;
        push @row, $productid;
        push @row, $unitcost;

doc/examples/petmarket/petmarket/api/catalogservice.pm  view on Meta::CPAN


    return Flash::FLAP::Util::Object->pseudo_query(\@columnNames, \@result);
}

sub searchProducts
{
    my ($self, $query) = @_;
    my @result;

    my @catids;
    my $ary_ref = $self->dbh->selectall_arrayref("SELECT a.catid  FROM category a, category_details b WHERE a.catid=b.catid AND b.name like '%$query%'");
    foreach my $rowRef (@$ary_ref)
    {
        my ($catid) = @$rowRef;
        push @catids, $catid;
    }

    @catids = map {"'$_'"} @catids;
    my $catIdList = join ",", @catids;

    my $productQuery = "SELECT DISTINCT a.productid, b.name, a.catid, c.name FROM product a, product_details b, category_details c WHERE a.productid=b.productid AND a.catid=c.catid AND (b.name like '%$query%'";
    $productQuery .= " OR a.catid IN ($catIdList)" if $catIdList;
	$productQuery .= ")";

    $ary_ref = $self->dbh->selectall_arrayref($productQuery);
    foreach my $rowRef (@$ary_ref)
    {
        my ($productid, $productName, $catid, $catName) = @$rowRef;
        my @row;
        push @row, $productid;
        push @row, $productName;
        push @row, $catid;
        push @row, "8888";
        push @row, lc $catName;
        push @row, $catName;

doc/examples/petmarket/petmarket/api/stringresourcesservice.pm  view on Meta::CPAN

        $strings{"BILLING_FLDS_HINT_str"}="Please enter your billing address.";
        $strings{"SHIPPING_FLDS_HINT_str"}="Please enter your shipping address.";
        $strings{"USE_THIS_FOR_SHIPPING_CH_LBL_str"}="Use this address for shipping";
        $strings{"USE_BILLING_FOR_SHIPPING_CH_LBL_str"}="Use billing address for shipping";
        $strings{"EDIT_LBL_str"}="Edit";
        $strings{"CHECKOUT_USER_HD_str"}="1) Welcome";
        $strings{"CHECKOUT_BILLING_HD_str"}="2) Customer Details / Billing Address";
        $strings{"CHECKOUT_SHIPPING_HD_str"}="3) Shipping Address";
        $strings{"CHECKOUT_SHIPPING_METHOD_HD_str"}="4) Shipping Options & Promotions";
        $strings{"CHECKOUT_PAYMENT_HD_str"}="5) Payment Method & Confirmation";
        $strings{"SHIPPING_METHODS_FLDS_HINT_str"}="Please select your preferred shipping method.  If you were provided a promotional code, enter it here.";
        $strings{"SHIPPING_METHOD_LBL_str"}="Shipping Method:";
        $strings{"PROMOTION_CODE_LBL_str"}="Promotion Code:";
        $strings{"EST_DELIVERY_DATE_LBL_str"}="Estimated delivery date:";
        $strings{"CHECKOUT_SUBMIT_BTN_LBL_str"}="Place Order";
        $strings{"PAYMENT_METHOD_LBL_str"}="Credit Card Type:";
        $strings{"PAYMENT_METHODS_HINT_str"}="Please review the billing and shipping information you entered above.  Make changes by clicking the Edit button.\n\nComplete your purchase by clicking the Place Order button.";
        $strings{"CHECKOUT_EXIT_BTN_LBL_str"}="Exit Checkout";
        $strings{"ADD_TO_CART_BTN_LBL_str"}="Add To Cart";
        $strings{"HISTORY_WIDGET_LBL_str"}="history";
        $strings{"SEARCH_WIDGET_LBL_str"}="search";

doc/examples/petmarket/petmarket/api/stringresourcesservice.pm  view on Meta::CPAN

        $strings{"CART_CHECKOUT_BTN_LBL_str"}="Checkout";
        $strings{"CART_CONTINUE_BTN_LBL_str"}="Shop More";
        $strings{"STATE_CB_NON_US_LBL_str"}="State / Provence:";
        $strings{"STATE_CB_US_LBL_str"}="State:";
        $strings{"COUNTRY_CB_LBL_str"}="Country:";
        $strings{"FULL_NAME_LBL_str"}="Full name:";
        $strings{"FIRST_NAME_LBL_str"}="First name:";
        $strings{"LAST_NAME_LBL_str"}="Last name:";
        $strings{"CHECKOUT_GROUP_HD_str"}="Checkout";
        $strings{"CHARGE_SUMMARY_HD_str"}="Charge Summary";
        $strings{"CHARGE_SUMMARY_HINT_str"}="Please review all charges listed below before completing your purchase.\n\nMake sure that you have selected your preferred shipping method and entered any promotional codes that may entitle you to a discou...
        $strings{"CHARGE_SUMMARY_SUBTOTAL_LBL_str"}="Cart Subtotal:";
        $strings{"CHARGE_SUMMARY_PROMOTIONS_LBL_str"}="Promotions:";
        $strings{"CHARGE_SUMMARY_SHIPPING_LBL_str"}="Shipping Charges:";
        $strings{"CHARGE_SUMMARY_TAX_LBL_str"}="Taxes:";
        $strings{"CHARGE_SUMMARY_GRAND_TOTAL_LBL_str"}="Total Charges:";
        $strings{"VALIDATE_EMAIL_ERR_TITLE_str"}="E-mail not valid";
        $strings{"VALIDATE_EMAIL_ERR_MSG_str"}="E-mail entered is not valid.\nPlease try again.";
        $strings{"VALIDATE_PASS_ERR_TITLE_str"}="Password invalid";
        $strings{"VALIDATE_PASS_MISMATCH_ERR_MSG_str"}="Passwords do not match.\nPlease try again.";
        $strings{"VALIDATE_PASS_INVALID_ERR_MSG_str"}="Invalid password.\nPlease try again.";

doc/examples/petmarket/petmarket/api/stringresourcesservice.pm  view on Meta::CPAN

        $strings{"VALIDATE_LAST_NAME_ERROR_MSG_STR"}="Please type in your last name.";
        $strings{"VALIDATE_LAST_NAME_ERROR_TITLE_STR"}="Invalid last name";
        $strings{"VALIDATE_ADDRESS_ERROR_MSG_str"}="Please type in an address.";
        $strings{"VALIDATE_ADDRESS_ERROR_TITLE_str"}="Invalid address";
        $strings{"VALIDATE_CITY_ERROR_MSG_str"}="Please type in a city.";
        $strings{"VALIDATE_CITY_ERROR_TITLE_str"}="Invalid city";
        $strings{"VALIDATE_ZIPCODE_ERROR_MSG_str"}="Please enter a valid 5 digit Zip code.";
        $strings{"VALIDATE_ZIPCODE_ERROR_TITLE_str"}="Invalid Zip code";
        $strings{"VALIDATE_PHONE_ERROR_MSG_str"}="Please enter a valid 10 digit telephone number.";
        $strings{"VALIDATE_PHONE_ERROR_TITLE_str"}="Invalid phone number";
        $strings{"VALIDATE_SELECT_CC_TYPE_ERROR_MSG_str"}="Please select a credit card from the list.";
        $strings{"VALIDATE_SELECT_CC_MO_ERROR_MSG_str"}="Please select a credit card expiry month from the list.";
        $strings{"VALIDATE_SELECT_CC_YR_ERROR_MSG_str"}="Please select a credit card expiry year from the list.";
        $strings{"VALIDATE_CC_EXPIRED_ERROR_MSG_str"}="Please select a credit card expiry date that is not in the past.";
        $strings{"VALIDATE_INVALID_CC_ERROR_MSG_str"}="Invalid credit card number.  Please enter valid credit card number.";
        $strings{"VALIDATE_PAYMENT_ERROR_TITLE_str"}="Payment Method Error";
        $strings{"CREATE_USER_PROGRESS_TITLE_str"}="Creating account";
        $strings{"CREATE_USER_PROGRESS_MSG_str"}="Account creation in progress, please wait.";
        $strings{"LOGIN_USER_PROGRESS_TITLE_str"}="Logging in";
        $strings{"LOGIN_USER_PROGRESS_MSG_str"}="Login in progress, please wait.";
        $strings{"SUBMITTING_ORDER_PROGRESS_TITLE_str"}="Submitting order";
        $strings{"SUBMITTING_USER_PROGRESS_MSG_str"}="Order submission in progress: sending user data.\n\nPlease wait.";
        $strings{"SUBMITTING_ORDER_PROGRESS_MSG_str"}="Order submission in progress: sending order info.\n\nPlease wait.";
        $strings{"CONFIRM_ORDER_TITLE_str"}="Thank You";

doc/examples/petmarket/petmarket/api/userservice.pm  view on Meta::CPAN


my @userFields = ("firstname", "lastname", "homestreet1", "homestreet2", "homecity", "homestate", "homecountry", "homezip", "homephone", "creditcardnumber", "creditcardtype", "creditcardexpiry");

my @shippingFields = ("shippingstreet1", "shippingstreet2", "shippingcity", "shippingcountry", "shippingzip", "shippingphone"); 

my @fields = ("email", "password", @userFields, @shippingFields);

sub authenticate
{
    my ($self, $email, $password) = @_;
    my $ary_ref = $self->dbh->selectall_arrayref("SELECT count(*) FROM user_details where email='$email' AND password='$password'");

    return $ary_ref->[0]->[0] > 0;
}

sub addUser
{
    my ($self, $email, $password) = @_;
	
    $self->dbh->do("INSERT INTO user_details set email='$email', password='$password'");

doc/examples/petmarket/petmarket/api/userservice.pm  view on Meta::CPAN



sub getUser
{
  my ($self, $email, $password) = @_;

    return 0 unless $self->authenticate($email, $password);

    my $result = new AMF::Perl::Util::Object;

    my $hash_ref = $self->dbh->selectall_hashref("SELECT * FROM user_details WHERE email='$email'", "email");

    my $rowRef = $hash_ref->{$email};

    foreach my $field (@fields)
    {
        $result->{$field} = $rowRef->{$field};
    }
    $result->{useroid} = $email;
    return $result;
}

doc/examples/sql/parkservices/ParkService.pm  view on Meta::CPAN


sub getParkTypes()
{
    my ($self) = @_;
    return $self->recordset->query("SELECT Distinct(parktype) FROM tblparks WHERE parktype is not NULL order by parktype");
}

sub getParksList
{
    my ($self, $parkType) = @_;
	my $select = "SELECT parkName,city,state,parktype FROM tblparks ";
	$select .=  " WHERE parktype='$parkType' " if $parkType;
	$select .= "ORDER BY parkname";
    return  $self->recordset->query($select);
}

sub getParkDetails
{
    my ($self, $thisParkName) = @_;
    return  $self->recordset->query("SELECT * FROM tblparks WHERE parkname='".$thisParkName."'");
}


1;



( run in 0.525 second using v1.01-cache-2.11-cpan-49f99fa48dc )