Exemple #1
0
        public void Add(Customer key, ProductCategory value)
        {
            if (ContainsKey(key))
            {
                this[key] = value;
                return;
            }

            Array.Resize(ref collection, Count + 1);
            collection[Count - 1] = new CustomerProducts(key, value);
        }
   public static AddPair(Product product, Customer customer)
   {
        if (!CustomerProducts.Contains(customer))
           CustomerProducts.Add(customer, new List<Product>);
 
        CustomerProducts[customer].Add(product);
 
        if (!ProductCustomers.Contains(product))
           ProductCustomers.Add(product, new List<Customers>);
 
        CustomerProducts[product].Add(customer);
    }
        public MainWindow()
        {
            InitializeComponent();

            //Uhrzeit, aktuallisiere die uhrzeit jede Sekunde
            DispatcherTimer timer = new DispatcherTimer(new TimeSpan(0, 0, 1),
                                                        DispatcherPriority.Normal,
                                                        delegate {
                TimeText.FontWeight = FontWeights.Bold;
                TimeText.Text       = DateTime.Now.ToString("dd/MMMM/yyyy | HH:mm:ss");
            },
                                                        this.Dispatcher);

            //Initialisiere die SeitenContexte
            loginpage              = new Loginpage(this);
            hauptmenue             = new Hauptmenue(this);
            registration           = new Registration(this);
            home                   = new Home(this);
            totalInventory         = new totalinventory(this);
            leastWas               = new leastwas(this);
            AddCustomer            = new addCustomer(this);
            ShowCustomer           = new showCustomer(this);
            AddDeliverer           = new addDeliverer(this);
            GoodsReceipt           = new goodsReceipt(this);
            GoodsIssue             = new goodsIssue(this);
            AddnewGoods            = new addnewGoods(this);
            DeleteCustomer         = new deleteCustomer(this);
            DeleteDeliverer        = new deleteDeliverer(this);
            DeleteProducts         = new deleteProducts(this);
            ShowDeliverer          = new showDeliverer(this);
            CustomizeDeliverer     = new customizeDeliverer(this);
            CustomizeCustomer      = new customizeCustomer(this);
            CustomizeProducts      = new customizeProducts(this);
            uebersichtBestellungen = new uebersichtBestellungen(this);
            customerProducts       = new CustomerProducts(this);
            delivererProducts      = new DelivererProducts(this);
            //Hauptmenü anzeigen
            mainframe.Content = hauptmenue;
        }
        public long Add(CustomerProducts obj)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@Customer_Code", obj.Customer_Code),
                    new SqlParameter("@BasicProductCode", obj.Basic_Product_ID),
                    new SqlParameter("@DiscountType", obj.Discount_Type),
                    new SqlParameter("@PrincePerQuantity", obj.Price_Per_Quantity),
                    new SqlParameter("@DiscountPerQuantity", obj.Discount_Per_Quantity),
                    new SqlParameter("@outParam", SqlDbType.Int, 120)
                    {
                        Direction = ParameterDirection.Output
                    }
                };

                return(Execute.RunSP_RowsEffected(Connection, "SPADD_CustomerProducts", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemple #5
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            if (txt_tpye.Text.Trim().ToString() == "")
            {
                MessageBox.Show("Please fill Price/Discount Per Item to continue...!", "Fill Details", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_tpye.Text = "";
                return;
            }

            if (!IsNum(txt_tpye.Text.Trim().ToString()))
            {
                MessageBox.Show("Please fill Price/Discount Per Item as number to continue...!", "Numbers Only", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_tpye.Text = "";
                return;
            }

            if (cmb_products.Text.ToString().Trim() == "")
            {
                MessageBox.Show("Please select a product to continue...!", "No Products", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            int   type                  = 0;
            float amount                = float.Parse(txt_tpye.Text.ToString());
            float Price_Per_Quantity    = amount;
            float Discount_Per_Quantity = 0;

            if (cmb_discountType.SelectedIndex == 1)
            {
                type = 1;
                Price_Per_Quantity    = 0;
                Discount_Per_Quantity = amount;
            }

            string code = cmb_products.Text.ToString().Split('-')[0];

            if (cus.IsAddedProduct(ter.GetCustomersIDByName(cmb_customer.Text.ToString(), this.SalesMethod), code) > 0)
            {
                MessageBox.Show("Product is already added...!", "Assign Products", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            CustomerProducts obj = new CustomerProducts();

            obj.Customer_Code         = ter.GetCustomersIDByName(cmb_customer.Text.ToString(), this.SalesMethod);
            obj.Basic_Product_ID      = code;
            obj.Discount_Type         = type;
            obj.Price_Per_Quantity    = Price_Per_Quantity;
            obj.Discount_Per_Quantity = Discount_Per_Quantity;

            long rows = cus.Add(obj);

            if (rows > 0)
            {
                MessageBox.Show("Product is Added...!", "Assign Product", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txt_tpye.Text = "";
                grid_itemsPerPrice.DataSource    = cus.GetPricePerItem();
                grid_itemsPerDiscount.DataSource = cus.GetDiscountPerItem();
                return;
            }
            else
            {
                MessageBox.Show("Recode is not added. Please try again...!", "Assign Product", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
 public ProductHistoryIndexVM()
 {
     SearchString     = string.Empty;
     CustomerProducts = new CustomerProducts();
 }