Beispiel #1
0
        private void RefreshOrderItemList(List <singleItemOrder> theList)
        {
            try
            {
                if (localTshirtList == null)
                {
                    return;
                }
                lvOrderedProducts.Items.Clear();
                if (theList == null)
                {
                    return;
                }

                ListViewItem item;
                tshirt       currentTshirt;
                int          reserved_amount;
                foreach (singleItemOrder o_item in theList)
                {
                    currentTshirt = localTshirtList?.Find(t => t.id == o_item.tshirt_id);
                    if (currentTshirt == null)
                    {
                        currentTshirt = new tshirt();
                    }
                    decimal a = ((decimal)currentTshirt.default_loss_percentage / 100);
                    reserved_amount = (int)Math.Ceiling((decimal)(a * o_item.amount) + o_item.amount);
                    item            = new ListViewItem(currentTshirt.company.name);
                    item.Tag        = o_item;
                    item.SubItems.AddRange(new string[] { currentTshirt.style.name, currentTshirt.sex, currentTshirt.color.name, o_item.amount.ToString(), reserved_amount.ToString() });
                    item.ToolTipText = "Kliknij mnie dwukrotnie, by usunąć z listy";
                    lvOrderedProducts.Items.Add(item);
                }
            }
            catch { lvOrderedProducts.Items.Clear(); this.PushNotification("Nie udało się wyświetlić listy produktów", 2); }
        }
Beispiel #2
0
 private void btnAddNew_Click(object sender, EventArgs e)
 {
     treeViewProductBrowser.Visible         = false;
     CurrentlySelectedTshirt                = null;
     currentlyEditedTshirt                  = new tshirt();
     currentlyEditedTshirt.singleItemOrders = new List <singleItemOrder>();
     btnAddNew.Visible          = false;
     btnDelete.Visible          = false;
     gbTshirtProperties.Visible = true;
     //   getAllThsirts(this, this);
 }
        public static int getOrdered(this tshirt shirt)
        {
            int sum = 0;

            foreach (singleItemOrder order in shirt.singleItemOrders.ToList())
            {
                if (order == null || order.order == null)
                {
                    return(0);
                }

                if (order.order.status == 2)
                {
                    continue;
                }
                sum += order.amount;
            }
            return(sum);
        }
Beispiel #4
0
        private void DisplaySingleTshirt(tshirt t)
        {
            if (t == null)
            {
                //czyszczenie pól
                comboBoxCompany.SelectedItem = null;
                comboBoxColor.SelectedItem   = null;
                comboBoxSize.SelectedItem    = null;
                comboBoxCompany.SelectedItem = null;
                comboBoxModel.SelectedItem   = null;
                comboBoxSex.SelectedItem     = null;
                numericDefaultLoss.Value     = 10;
                numInStock.Value             = 0;
                numPrice.Value = 0;
                return;
            }

            foreach (var c in comboBoxCompany.Items)
            {
                if ((c as company).id == t.company.id)
                {
                    comboBoxCompany.SelectedItem = c;
                }
            }

            foreach (var c in comboBoxModel.Items)
            {
                if ((c as style).id == t.style.id)
                {
                    comboBoxModel.SelectedItem = c;
                }
            }

            foreach (var c in comboBoxSex.Items)
            {
                if (c.ToString() == t.sex)
                {
                    comboBoxSex.SelectedItem = c;
                }
            }

            foreach (var c in comboBoxSize.Items)
            {
                if (c.ToString() == t.size)
                {
                    comboBoxSize.SelectedItem = c;
                }
            }


            foreach (var c in comboBoxColor.Items)
            {
                if ((c as color).id == t.color.id)
                {
                    comboBoxColor.SelectedItem = c;
                }
            }


            tbId.Text = t.id.ToString();
            numericDefaultLoss.Value = t.default_loss_percentage;
            numInStock.Value         = t.in_stock;
            numPrice.Value           = t.price;
            try
            {
                tbAvailable.Text = t.getNotOrdered().ToString();
                tbReserved.Text  = t.getOrdered().ToString();
            }
            catch
            {
                tbAvailable.Text = "";
                tbReserved.Text  = "";
            }
        }
Beispiel #5
0
 private void TshirtEditorWindow_insertSingleTshirt(IErrorable arg1, ICommunicative arg3, tshirt arg2)
 {
     insertTshirt(arg1, arg3, arg2);
 }
Beispiel #6
0
 private void TshirtEditorWindow_removeTshirt(IErrorable arg1, ICommunicative arg3, tshirt arg2)
 {
     removeTshirt(arg1, arg3, arg2);
 }
 public static int getNotOrdered(this tshirt shirt)
 {
     return(shirt.in_stock - getOrdered(shirt));
 }