Ejemplo n.º 1
0
 private void btnTekstilWatch_Click(object sender, EventArgs e)
 {
     Tekstil t = new Tekstil(this);
     t.ShowDialog();
 }
Ejemplo n.º 2
0
        private void btnTextileAdd_Click(object sender, EventArgs e)
        {
            if (txtTextileName.Text != String.Empty && txtTextileSKU.Text != String.Empty && txtPrice.Text != String.Empty)
            {
                lblWarning1.Visible = false;
                lblWarning2.Visible = false;
                lblWarning3.Visible = false;

                if (cbSpecialProduct.Checked)
                {
                    switch (tool.SearchConfig(txtTextileSKU.Text))
                    {
                        case false:
                            tc.InsertItem(txtTextileName.Text, "", "", cbTextileGender.SelectedValue.ToString(), cbTextileFamilly.SelectedValue.ToString(), txtTextileSKU.Text, tool.CurrencyConvert(cbCurrency.SelectedIndex, txtPrice.Text), rbtDescription.Text, "configurable");
                            break;
                    }
                }

                if (cbChooseColor.Checked && cbChooseSize.Checked)
                {
                    List<string> colorLines = new List<string>(txtOwnColor.Lines);
                    List<string> sizeLines = new List<string>(txtOwnSize.Lines);
                    foreach (string line in colorLines)
                    {
                        foreach (string line2 in sizeLines)
                        {
                            if (!cbSpecialProduct.Checked)
                            {
                                tekstil_ContentTableAdapter.Insert(txtTextileName.Text, line, line2, cbTextileGender.SelectedValue.ToString(), cbTextileFamilly.SelectedValue.ToString(), txtTextileSKU.Text, tool.CurrencyConvert(cbCurrency.SelectedIndex, txtPrice.Text), rbtDescription.Text, "simple");
                            }
                            else
                            {
                                tekstil_ContentTableAdapter.Insert(txtTextileName.Text, line, line2, cbTextileGender.SelectedValue.ToString(), cbTextileFamilly.SelectedValue.ToString(), txtTextileSKU.Text, tool.CurrencyConvert(cbCurrency.SelectedIndex, txtPrice.Text), "", "simple");
                            }
                        }
                    }
                    Tekstil t = new Tekstil(this);
                    t.ShowDialog();
                }

                if (cbChooseColor.Checked && !cbChooseSize.Checked)
                {
                    List<string> colorLines = new List<string>(txtOwnColor.Lines);
                    foreach (string line in colorLines)
                    {
                        foreach (var item in lbTextileSize.SelectedItems)
                        {
                            if (!cbSpecialProduct.Checked)
                            {
                                tekstil_ContentTableAdapter.Insert(txtTextileName.Text, line, lbTextileSize.GetItemText(item), cbTextileGender.SelectedValue.ToString(), cbTextileFamilly.SelectedValue.ToString(), txtTextileSKU.Text, tool.CurrencyConvert(cbCurrency.SelectedIndex, txtPrice.Text), rbtDescription.Text, "simple");
                            }
                            else
                            {
                                tekstil_ContentTableAdapter.Insert(txtTextileName.Text, line, lbTextileSize.GetItemText(item), cbTextileGender.SelectedValue.ToString(), cbTextileFamilly.SelectedValue.ToString(), txtTextileSKU.Text, tool.CurrencyConvert(cbCurrency.SelectedIndex, txtPrice.Text), "", "simple");
                            }
                        }
                    }
                    Tekstil t = new Tekstil(this);
                    t.ShowDialog();
                }

                if (cbChooseSize.Checked && !cbChooseColor.Checked)
                {
                    List<string> sizeLines = new List<string>(txtOwnSize.Lines);
                    foreach (var item in lbTextileColor.SelectedItems)
                    {
                        foreach (string line in sizeLines)
                        {
                            if (!cbSpecialProduct.Checked)
                            {
                                tekstil_ContentTableAdapter.Insert(txtTextileName.Text, lbTextileColor.GetItemText(item), line, cbTextileGender.SelectedValue.ToString(), cbTextileFamilly.SelectedValue.ToString(), txtTextileSKU.Text, tool.CurrencyConvert(cbCurrency.SelectedIndex, txtPrice.Text), rbtDescription.Text, "simple");
                            }
                            else
                            {
                                tekstil_ContentTableAdapter.Insert(txtTextileName.Text, lbTextileColor.GetItemText(item), line, cbTextileGender.SelectedValue.ToString(), cbTextileFamilly.SelectedValue.ToString(), txtTextileSKU.Text, tool.CurrencyConvert(cbCurrency.SelectedIndex, txtPrice.Text), "", "simple");
                            }
                        }
                    }
                    Tekstil t = new Tekstil(this);
                    t.ShowDialog();
                }

                if (!cbChooseColor.Checked && !cbChooseSize.Checked)
                {
                    foreach (var item in lbTextileColor.SelectedItems)
                    {
                        foreach (var item2 in lbTextileSize.SelectedItems)
                        {
                            if (!cbSpecialProduct.Checked)
                            {
                                try
                                {
                                    tekstil_ContentTableAdapter.Insert(txtTextileName.Text, lbTextileColor.GetItemText(item), lbTextileSize.GetItemText(item2), cbTextileGender.SelectedValue.ToString(), cbTextileFamilly.SelectedValue.ToString(), txtTextileSKU.Text, tool.CurrencyConvert(cbCurrency.SelectedIndex, txtPrice.Text), rbtDescription.Text, "simple");
                                }
                                catch (Exception ex)
                                {
                                    throw ex;
                                }
                            }
                            else
                            {
                                try
                                {
                                    tekstil_ContentTableAdapter.Insert(txtTextileName.Text, lbTextileColor.GetItemText(item), lbTextileSize.GetItemText(item2), cbTextileGender.SelectedValue.ToString(), cbTextileFamilly.SelectedValue.ToString(), txtTextileSKU.Text, tool.CurrencyConvert(cbCurrency.SelectedIndex, txtPrice.Text), "", "simple");
                                }
                                catch (Exception ex)
                                {
                                    MessageBox.Show(ex.ToString());
                                }
                            }
                        }
                    }
                    Tekstil t = new Tekstil(this);
                    t.ShowDialog();
                }
            }
            else
            {
                if (txtTextileName.Text == String.Empty && txtTextileSKU.Text == String.Empty && txtPrice.Text == String.Empty)
                {
                    lblWarning1.Visible = true;
                    lblWarning2.Visible = true;
                    lblWarning3.Visible = true;
                }
                else
                {
                    if (txtTextileName.Text == String.Empty)
                    {
                        lblWarning1.Visible = true;
                    }
                    if (txtTextileSKU.Text == String.Empty)
                    {
                        lblWarning2.Visible = true;
                    }
                    if (txtPrice.Text == string.Empty)
                    {
                        lblWarning3.Visible = true;
                    }
                }
            }
        }