AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 10.03.2012, 04:25   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
Rahul Sharma: Dynamics AX for Retail POS Development - Code Samples
Источник: http://feedproxy.google.com/~r/Rahul...opment_17.html
==============

In this post, I am just sharing some .Net POS code samples to get you going with coding.


Sample POS C# code:

1) How to fetch POS data?

Though you can use any .Net data access technology but POS provides helper classes to make things simpler.

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data;using System.Data.SqlClient;using LSRetailPosis.DataAccess;using LSRetailPosis.DataAccess.DataUtil; namespace Rahul.Dynamics.Retail.DataAccess{ public class PosIsButtonGrid : DataLayer { public PosIsButtonGrid(SqlConnection connection, string DATAAREAID) : base(connection, DATAAREAID) { } public DataTable GetPosIsButtonGridById(string BUTTONGRIDID) { SqlSelect sqlUtilSelect = new SqlSelect("POSISBUTTONGRID"); sqlUtilSelect.Select("BUTTONGRIDID"); sqlUtilSelect.Select("NAME"); sqlUtilSelect.Where("DATAAREAID", base.dataAreaId, true); sqlUtilSelect.Where("BUTTONGRIDID", BUTTONGRIDID, false); return base.dbUtil.GetTable(sqlUtilSelect); } public DataTable GetPosIsButtonGridButtonsByGridId(string BUTTONGRIDID) { SqlSelect sqlUtilSelect = new SqlSelect("POSISBUTTONGRIDBUTTONS"); sqlUtilSelect.Select("DISPLAYTEXT"); sqlUtilSelect.Select("ACTIONPROPERTY"); sqlUtilSelect.Where("DATAAREAID", base.dataAreaId, true); sqlUtilSelect.Where("BUTTONGRIDID", BUTTONGRIDID, false); sqlUtilSelect.OrderBy("ROWNUMBER", true); return base.dbUtil.GetTable(sqlUtilSelect); } }}

2) How to show a dialog box?

using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage("Rahul", MessageBoxButtons.OK, MessageBoxIcon.Error)){ LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog);}

3) Add an item to the current sales transaction.

//Sale item. Add it to retail transaction public static void ItemSale(ref PosTransaction posTransaction, string itemID, decimal quantity) { // If the transaction object is not of the type RetailTransaction, it has to be converted to one before an item can be added if (posTransaction.GetType() != typeof(RetailTransaction)) { posTransaction = new RetailTransaction(LSRetailPosis.Settings.ApplicationSettings.Terminal.StoreId, LSRetailPosis.Settings.ApplicationSettings.Terminal.StoreCurrency, LSRetailPosis.Settings.ApplicationSettings.Terminal.TaxIncludedInPrice, LSRetailPosis.ApplicationServices.IRounding); TransactionSystem transSystem = new TransactionSystem(posTransaction); transSystem.LoadTransactionStatus(); } try { string selectedItemId = itemID; //if (ApplicationServices.IItem.ItemSearch(ref selectedItemId, 500)) { ItemSystem system = new ItemSystem((RetailTransaction)posTransaction); string selectedBarcodeId = ""; DataTable barcodesForItem = system.GetBarcodesForItem(selectedItemId); if (barcodesForItem == null) { selectedBarcodeId = ""; } else if (barcodesForItem.Rows.Count == 0) { selectedBarcodeId = ""; } else if (barcodesForItem.Rows.Count == 1) { selectedBarcodeId = barcodesForItem.Rows[0][0].ToString(); } if (selectedBarcodeId.Length != 0) { OperationInfo o = new OperationInfo(); o.NumpadQuantity = 1; o.NumpadValue = selectedBarcodeId; o.ReturnItems = false; new ItemSale { OperationID = PosisOperations.ItemSale, OperationInfo = o, Barcode = selectedBarcodeId, POSTransaction = posTransaction }.RunOperation(); } else { OperationInfo o = new OperationInfo(); o.NumpadQuantity = 1; o.NumpadValue = selectedItemId; o.ReturnItems = false; new ItemSale { OperationID = PosisOperations.ItemSale, OperationInfo = o, Barcode = selectedItemId, POSTransaction = posTransaction }.RunOperation(); } } } catch (PosisException exception) { using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage(exception.Message, MessageBoxButtons.OK, MessageBoxIcon.Error)) { LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog); } ApplicationExceptionHandler.HandleException("BlankOperation.ItemSale", exception); throw; } catch (Exception exception2) { using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage(exception2.Message, MessageBoxButtons.OK, MessageBoxIcon.Error)) { LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog); } ApplicationExceptionHandler.HandleException("BlankOperation.ItemSale", exception2); throw; } }


References:
Dynamics AX for Retail POS Development


Join me on facebook and feel free to post your comments / feedback / queries.

Join me on facebook | twitter | linkedin !!!






Источник: http://feedproxy.google.com/~r/Rahul...opment_17.html
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
Rahul Sharma: Dynamics AX for Retail POS Development Blog bot DAX Blogs 2 19.09.2011 15:30
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
Rahul Sharma: MS Dynamics Ax 2009 EP Development - Part 2 Blog bot DAX Blogs 0 12.10.2010 15:05
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 17:05.