예제 #1
0
파일: SearchForm.cs 프로젝트: yorg76/test
        private bool addOrderBox(int order_id, string code)
        {
            string url          = ArchiDox.Properties.Resources.addOrderBoxURL;
            string postData     = "order_id=" + order_id + "&box_id=" + code;
            string addBoxResult = this.SendData("POST", url, postData);

            try
            {
                JsonResponseAddOrderBox responseObj = JsonConvert.DeserializeObject <JsonResponseAddOrderBox>(addBoxResult);

                if (responseObj.status == "OK")
                {
                    Box nb = new Box();

                    nb.id           = responseObj.content.id;
                    nb.date_from    = responseObj.content.date_from;
                    nb.status       = responseObj.content.status;
                    nb.warehouse_id = responseObj.content.warehouse_id;
                    nb.display_name = responseObj.content.display_name;

                    orderDetailsList.DataSource    = null;
                    orderDetailsList.DisplayMember = "display_name";
                    orderDetailsList.ValueMember   = "id";
                    orderDetailsList.Items.Add(nb);
                    orderDetailsList.Refresh();
                    this.code.Text = "";
                    return(true);
                }
                else if (responseObj.status == "DONE")
                {
                    DialogResult dresult = MessageBox.Show("To zamówienie zostało skompletowane", "Zamówienie skompletowane", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);

                    if (dresult == DialogResult.OK)
                    {
                        refreshOrderList();
                    }

                    Console.Error.WriteLine("Zamówienie {0} zostało skompletowane", this.order_id);
                    Console.Error.Flush();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
                Console.Error.WriteLine(ex.StackTrace);
                Console.Error.Flush();
                return(false);
            }
        }
예제 #2
0
        private bool addOrderBox(int order_id, string code)
        {
            string url          = ArchiDox.Properties.Resources.addOrderBoxURL;
            string postData     = "order_id=" + order_id + "&box_id=" + code;
            string addBoxResult = Global.SendData("POST", url, postData);

            try
            {
                JsonResponseAddOrderBox responseObj = JsonConvert.DeserializeObject <JsonResponseAddOrderBox>(addBoxResult);

                if (responseObj.status == "OK")
                {
                    Box nb = new Box();

                    nb.id           = responseObj.content.id;
                    nb.date_from    = responseObj.content.date_from;
                    nb.status       = responseObj.content.status;
                    nb.warehouse_id = responseObj.content.warehouse_id;
                    nb.display_name = responseObj.content.display_name;

                    orderDetailsList.DataSource    = null;
                    orderDetailsList.DisplayMember = "display_name";
                    orderDetailsList.ValueMember   = "id";
                    orderDetailsList.Items.Add(nb);
                    orderDetailsList.Refresh();
                    this.code.Text = "";
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
                Console.Error.WriteLine(ex.StackTrace);
                Console.Error.Flush();
                return(false);
            }
        }