private bool buildAndSendOrder() { bool successful = true; try { WebmateClientInterface webMate = WebmateClientInterface.Instance; string orderHandle = webMate.OpenOrder(); setWebOrderHeaderSection(orderHandle); setWebOrderFromSection(orderHandle); setWebOrderAccountSection(orderHandle); commitWebOrder(orderHandle); orderHandle_ = orderHandle; MessageBox.Show(orderHandle); } catch (Exception exc) { successful = false; MessageBox.Show(exc.Message); } return(successful); }
/// <summary> /// /// </summary> /// <returns></returns> private bool buildAndSendGetStatus(out WebOrderStatus outCommittedOrderStatus) { bool successful = true; try { WebmateClientInterface webMate = WebmateClientInterface.Instance; webMate.GetCommittedOrderStatus( SiteNameBox.Text, StoreNameTextBox.Text, orderHandle_, out outCommittedOrderStatus); } catch (Exception exc) { successful = false; outCommittedOrderStatus = WebOrderStatus.Unknown; MessageBox.Show(exc.Message); } return(successful); }
/// <summary> /// /// </summary> protected void buildAndSendOrder( string inWebSiteName, string inStoreName) { try { WebmateClientInterface webMate = WebmateClientInterface.Instance; string orderHandle = webMate.OpenOrder(); setWebOrderHeaderSection(orderHandle); setWebOrderFromSection(orderHandle); setWebOrderAccountSection(orderHandle); commitWebOrder(orderHandle); getAndShowWebOrderStatus( orderHandle, inWebSiteName, inStoreName); //MessageBox.Show(orderHandle); } catch (Exception exc) { MessageBox.Show(exc.Message); } resetEditingItem(); }
/// <summary> /// /// </summary> /// <returns></returns> private List <DTO_WebOrderItemSide> createItemSides(TreeNode inItemNode) { List <DTO_WebOrderItemSide> result = new List <DTO_WebOrderItemSide>(); WebmateClientInterface webMate = WebmateClientInterface.Instance; //...................................... TreeNode sideNode = inItemNode.FirstNode; while (sideNode != null) { ItemAttr sideAttr = (ItemAttr)sideNode.Tag; DTO_WebOrderItemSide webOrderItemSide; webOrderItemSide = webMate.CreateAccountOrderItemSide(1, // Discount ID sideAttr.TPC, Convert.ToSingle(sideAttr.Qty), Convert.ToDecimal(sideAttr.Price)); result.Add(webOrderItemSide); sideNode = sideNode.NextNode; } //...................................... return(result); }
/// <summary> /// /// </summary> /// <returns></returns> private List <DTO_WebOrderItem> createItems() { List <DTO_WebOrderItem> result = new List <DTO_WebOrderItem>(); //...................................... TreeNode itemNode = tvItems.TopNode.FirstNode; WebmateClientInterface webMate = WebmateClientInterface.Instance; DTO_WebOrderItem webOrderItem; while (itemNode != null) { ItemAttr itemAttr = (ItemAttr)itemNode.Tag; webOrderItem = webMate.CreateAccountOrderItem(1, // Discount ID itemAttr.TPC, Convert.ToSingle(itemAttr.Qty), Convert.ToDecimal(itemAttr.Price), new List <DTO_WebOrderItemOption>(), createItemSides(itemNode)); result.Add(webOrderItem); itemNode = itemNode.NextNode; } //...................................... return(result); }
/// <summary> /// /// </summary> /// <param name="outOrderHandle"></param> /// <returns></returns> private void setWebOrderAccountSection(string outOrderHandle) { WebmateClientInterface webMate = WebmateClientInterface.Instance; DTO_WebOrderDelivery delivery = webMate.CreateAccountDelivery(RecipientTextBox.Text, StreetNumberTextBox.Text, StreetNameTextBox.Text, SuburbTextBox.Text, CityTextBox.Text, CountryTextBox.Text, PhoneNumberTextBox.Text); DTO_WebOrderPayments payments = webMate.CreateAccountPayments(PaymentRequiredCheckBox.Checked); webMate.SaveAccountSection(outOrderHandle, Convert.ToUInt32(CoversNumeric.Value), MemberNumberTextBox.Text, CustomerNameTextBox.Text, createComments(), delivery, payments, createItems()); }
/// <summary> /// /// </summary> /// <param name="outOrderHandle"></param> /// <returns></returns> private void setWebOrderAccountSection(string outOrderHandle) { WebmateClientInterface webMate = WebmateClientInterface.Instance; DTO_WebOrderDelivery delivery = webMate.CreateAccountDelivery(tbRecipient.Text, tbStreetNo.Text, tbStreetName.Text, tbSuburb.Text, tbCity.Text, tbCountry.Text, tbPhoneNo.Text, tbNote.Text); DTO_WebOrderPayments payments = webMate.CreateAccountPayments(cbPaymentRequired.Checked); webMate.SaveAccountSection(outOrderHandle, Convert.ToUInt32(numCovers.Value), tbMemberNumber.Text, tbCustomerName.Text, createComments(), delivery, payments, createItems()); }
/// <summary> /// /// </summary> /// <returns></returns> private List <DTO_WebOrderItemSide> createItemSides(Item inItem) { List <DTO_WebOrderItemSide> result = new List <DTO_WebOrderItemSide>(); WebmateClientInterface webMate = WebmateClientInterface.Instance; //...................................... for (int i = 0; i < inItem.GetSideItemsCount(); i++) { SideItem sideItem = inItem.GetSideItemAtIndex(i); DTO_WebOrderItemSide webOrderItemSide; webOrderItemSide = webMate.CreateAccountOrderItemSide(sideItem.DiscountID, sideItem.ThirdPartyCode, sideItem.Qty, sideItem.Price); result.Add(webOrderItemSide); } //...................................... return(result); }
/// <summary> /// /// </summary> /// <returns></returns> private List <DTO_WebOrderItem> createItems() { List <DTO_WebOrderItem> result = new List <DTO_WebOrderItem>(); //...................................... for (int i = 0; i < itemsForm.GetItemsCount(); i++) { Item item = itemsForm.GetItemAtIndex(i); WebmateClientInterface webMate = WebmateClientInterface.Instance; DTO_WebOrderItem webOrderItem; webOrderItem = webMate.CreateAccountOrderItem(item.DiscountID, item.ThirdPartyCode, item.Qty, item.Price, new List <DTO_WebOrderItemOption>(), createItemSides(item)); result.Add(webOrderItem); } //...................................... return(result); }