protected override void OnRequest()
        {
            base.OnRequest();

            string productName = getParameter("product_name");
            string marketName  = getParameter("market_name");

            try
            {
                MerchantListModel merchantList = null;
                using (Controller.Merchant controllerMerchant = new Controller.Merchant())
                {
                    if (MemberValid == true)
                    {
                        merchantList = controllerMerchant.GetMerchantList(productName, marketName);
                    }
                    else
                    {
                        merchantList = controllerMerchant.GetMerchantList(productName, marketName, 2);
                    }
                }
                WriteSuccess <MerchantListModel>(merchantList);
            }
            catch (UnfulfilException ex)
            {
                WriteUnfulfil(ex.DisplayMessage);
            }catch (Exception ex)
            {
                WriteException(ex);
            }

            WriteEnd();
        }
Ejemplo n.º 2
0
        protected override void OnRequest()
        {
            base.OnRequest();
            string merchantName        = getParameter("merchant_name");
            string merchantContact     = getParameter("merchant_contact");
            string merchantDescription = getParameter("merchant_description");
            string productName         = getParameter("product_name");
            string marketName          = getParameter("market_name");

            try
            {
                MerchantListModel merchantList = null;
                using (Controller.Merchant controllerMerchant = new Controller.Merchant())
                {
                    merchantList = controllerMerchant.GetMerchantList(merchantName, merchantContact, merchantDescription, marketName, productName, null);
                }

                DatagridModel <ViewMerchantListModel> data = new DatagridModel <ViewMerchantListModel>();
                data.total = (uint)merchantList.Count();
                data.rows  = merchantList;

                WriteJson(data);
            }
            catch (UnfulfilException ex)
            {
                WriteUnfulfil(ex.DisplayMessage);
            }
            catch (Exception ex)
            {
                WriteException(ex);
            }

            WriteEnd();
        }