Beispiel #1
0
        private void canceSelectedElement_Click(object sender, EventArgs e)
        {
            int index = elementsListGridView.CurrentCell.RowIndex;

            entities.OrderElement orderElement = elementsProvider[index];

            orderElement.SetCancelAt(DateTime.Now.ToLongDateString());
            orders.CancelElement(orderElement);

            if (Properties.Settings.Default.fiscal)
            {
                fiscal.SetCashier(cashierName);
                fiscal.Annulate(orderElement);
            }

            elementsListGridView.Update();
            elementsListGridView.Focus();
        }
Beispiel #2
0
        private string SendResponse(HttpListenerRequest request)
        {
            if (request.RawUrl == "/dvizh/cashier/api/1.0/")
            {
                System.IO.Stream       body   = request.InputStream;
                System.IO.StreamReader reader = new System.IO.StreamReader(body, request.ContentEncoding);
                string json = reader.ReadToEnd();
                services.actions.RequestAction requestAction = JsonConvert.DeserializeObject <services.actions.RequestAction> (json);
                switch (requestAction.method)
                {
                case "purchase":
                    services.actions.PurchaseAction product = JsonConvert.DeserializeObject <services.actions.PurchaseAction>(json);
                    fiscal.TopIndent();
                    product.purchase();
                    break;

                case "annulate":
                    services.actions.AnnulateAction annulate = JsonConvert.DeserializeObject <services.actions.AnnulateAction>(json);
                    foreach (var ann in annulate._params.elements)
                    {
                        ann.SetCancelAt(DateTime.Now.ToShortDateString());
                        fiscal.Annulate(ann);
                    }
                    break;

                case "storning":
                    services.actions.AnnulateAction storno = JsonConvert.DeserializeObject <services.actions.AnnulateAction>(json);
                    foreach (var st in storno._params.elements)
                    {
                        st.SetCancelAt(DateTime.Now.ToShortDateString());
                        fiscal.Storning(st);
                    }
                    break;

                case "session_start":
                    fiscal.OpenSession();
                    break;

                case "session_stop":
                    Console.WriteLine("stop");
                    fiscal.CloseSession();
                    break;

                case "set cashier":
                    services.actions.SetCashierAction setCashier = JsonConvert.DeserializeObject <services.actions.SetCashierAction>(json);
                    fiscal.SetCashier(setCashier._params.name);
                    break;

                case "settings":
                    FprnM1C.IFprnM45 cmd = new FprnM1C.FprnM45();
                    cmd.ShowProperties();
                    break;

                case "test":
                    fiscal.TestPrint();
                    break;

                default:
                    break;
                }
            }
            return("DvizhSeller");
        }