Exemplo n.º 1
0
        private void registerLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            AddOrderForm f = new AddOrderForm();

            if (f.ShowDialog() == DialogResult.OK)
            {
                orderList.Add(GlobalVariables.Order.Clone());
                addContractViewBindingSource.DataSource = AddContractView.GetViewList(orderList);
                dataGridView1.Refresh();
            }
        }
Exemplo n.º 2
0
        public static List <AddContractView> GetViewList(List <Order> listOrder)
        {
            List <AddContractView> list = new List <AddContractView>();
            string url = string.Empty;

            foreach (Order item in listOrder)
            {
                AddContractView view = new AddContractView();

                Product product = new CustomManager.Product();
                string  answer  = MyGlobalClass.DBManager.LoadProductbyID(item.product_id, ref product);
                if (!answer.Equals(KEY_VALUES.OK))
                {
                    MessageBox.Show(answer, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    view.Product    = product.Product_Name_RU;
                    view.product_id = item.product_id;
                }

                Region region_sending = new Region();
                answer = MyGlobalClass.DBManager.LoadRegionbyID(item.region_sending_id, ref region_sending);
                if (!answer.Equals(KEY_VALUES.OK))
                {
                    MessageBox.Show(answer, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    view.Region_Sending = region_sending.Region_Name;
                }


                Region region_origin = new Region();
                answer = MyGlobalClass.DBManager.LoadRegionbyID(item.region_origin_id, ref region_origin);
                if (!answer.Equals(KEY_VALUES.OK))
                {
                    MessageBox.Show(answer, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    view.Region_Origin = region_origin.Region_Name;
                }

                view.Order_Count = item.Order_Count;

                Location location = new CustomManager.Location();
                answer = MyGlobalClass.DBManager.LoadLocationbyID(item.location_id, ref location);
                if (!answer.Equals(KEY_VALUES.OK))
                {
                    //MessageBox.Show(answer, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    view.Location    = string.Format("Lat={0}; Lon={1}", location.Latitude, location.Longitude);
                    view.location_id = item.location_id;
                }

                list.Add(view);
            }

            return(list);
        }