Exemplo n.º 1
0
 public VisibleStockItem(ISposDb db, SaveableStockItem item) : base(item.Number, item.Quantity)
 {
     SimplePOS.Article.RegularArticle article = db.GetArticleByNumber(item.Number);
     if (article != null)
     {
         this.name = article.Name;
         this.text = article.Text;
     }
 }
Exemplo n.º 2
0
 public VisibleStockItem(ISposDb db,SaveableStockItem item) : base(item.Number, item.Quantity)
 {
     SimplePOS.Article.RegularArticle article = db.GetArticleByNumber(item.Number);
     if (article != null)
     {
         this.name = article.Name;
         this.text = article.Text;
     }
 }
Exemplo n.º 3
0
 public StockArticle(ISposDb db,SaveableStockItem item)
     : this(db)
 {
     textBox1.Text = item.Number;
     textBox2.Text = item.Quantity.ToString();
     curr_quantity = item.Quantity;
     button2.Visibility = Visibility.Hidden;
     singleShow = true;
     textBox1.IsEnabled=false;
 }
Exemplo n.º 4
0
        public static List<VisibleStockItem> createFromList(ISposDb db)
        {
            List<VisibleStockItem> retval = new List<VisibleStockItem>();
            List<SaveableStockItem> items = db.GetStock();
            foreach (SaveableStockItem item in items){
                retval.Add(new VisibleStockItem(db,item));
            }

            return retval;
        }
Exemplo n.º 5
0
 public StockArticle(ISposDb db, SaveableStockItem item)
     : this(db)
 {
     textBox1.Text      = item.Number;
     textBox2.Text      = item.Quantity.ToString();
     curr_quantity      = item.Quantity;
     button2.Visibility = Visibility.Hidden;
     singleShow         = true;
     textBox1.IsEnabled = false;
 }
Exemplo n.º 6
0
        public ArticleView(ISposDb db)
        {
            this.db = db;
            InitializeComponent();

            tax1Item.Content    = Preferences.PreferenceManager.TAX_1.ToString() + "%";
            tax2Item.Content    = Preferences.PreferenceManager.TAX_2.ToString() + "%";
            comboBox1.IsEnabled = Preferences.PreferenceManager.SHOW_TAX;

            textBox1.Focus();
        }
Exemplo n.º 7
0
        public static List <VisibleStockItem> createFromList(ISposDb db)
        {
            List <VisibleStockItem>  retval = new List <VisibleStockItem>();
            List <SaveableStockItem> items  = db.GetStock();

            foreach (SaveableStockItem item in items)
            {
                retval.Add(new VisibleStockItem(db, item));
            }

            return(retval);
        }
Exemplo n.º 8
0
        // TAG analayse oder datenbankabfrage
        public static AbstractArticle preprocessArtikel(Window parent, ISposDb db, string number)
        {
            AbstractArticle article = null;

            switch (convertToType(number))
            {
            case AbstractArticle.ArticleType.ARTICLE:
                article = db.GetArticleByNumber(number);
                if (article == null)
                {
                    // Artikel ist nicht vorhanden --> neu anlegen
                    ArticleView window = new ArticleView(db, new RegularArticle(number));
                    window.Owner = parent;
                    window.ShowDialog();
                    article = db.GetArticleByNumber(number);
                    // wenn nichts gültiges eingegeben wird --> beenden
                    if (article == null)
                    {
                        return(null);
                    }
                }

                break;

            case AbstractArticle.ArticleType.DISCOUNT:
                int discountInCent = Discount.getAmountOfTag(number);
                if (discountInCent < 0)
                {
                    // Wenn der Tag keinen Wertenthält muss eine Nutzereingabe erfolgen
                    DiscountInputBox widow = new DiscountInputBox();
                    widow.Owner = parent;
                    int userValue = widow.ShowWithResult();
                    if (userValue > 0)
                    {
                        discountInCent = userValue;
                    }
                    else
                    {
                        // Wenn keine korrekte Eingabe erfolgt -> Ende.
                        return(null);
                    }
                }
                article = new Discount(discountInCent);

                break;
            }


            return(article);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Imports article from csv file to db. If article with same number exists, it will be replaced.
        /// </summary>
        /// <param name="db"></param>
        /// <param name="file"></param>
        /// <returns></returns>
        public static bool ImportArticleFromCsv(ISposDb db, string file)
        {
            // read csv file
            DataTable data = ParseCSV(file);

            if (data == null)
            {
                return(false);
            }
            // convert data
            DataTableReader reader = new DataTableReader(data);

            if (reader.FieldCount != 5 && !reader.HasRows)
            {
                return(false);
            }
            List <SimplePOS.Article.RegularArticle> articleList = new List <SimplePOS.Article.RegularArticle>();

            reader.Read(); // read the header
            while (reader.Read())
            {
                object[] values = new object[5];
                int      result = reader.GetValues(values);
                if (result > 0)
                {
                    try
                    {
                        // Text may be empty wich results in a strange object
                        string text;
                        try { text = (string)values[2]; }
                        catch { text = ""; }
                        articleList.Add(new SimplePOS.Article.RegularArticle((string)values[0],
                                                                             (string)values[1], text,
                                                                             Double.Parse((string)values[3]),
                                                                             Double.Parse((string)values[4])));
                    }
                    catch { return(false); }
                }
            }

            // import to db
            db.SaveArticleList(articleList);

            return(true);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Imports article from csv file to db. If article with same number exists, it will be replaced.
        /// </summary>
        /// <param name="db"></param>
        /// <param name="file"></param>
        /// <returns></returns>
        public static bool ImportArticleFromCsv(ISposDb db, string file)
        {
            // read csv file
            DataTable data = ParseCSV(file);
            if (data == null)
            {
                return false;
            }
            // convert data
            DataTableReader reader = new DataTableReader(data);
            if (reader.FieldCount != 5 && !reader.HasRows)
            {
                return false;
            }
            List<SimplePOS.Article.RegularArticle> articleList = new List<SimplePOS.Article.RegularArticle>();
            reader.Read(); // read the header
            while (reader.Read())
            {
                object[] values = new object[5];
                int result = reader.GetValues(values);
                if (result > 0)
                {
                    try
                    {
                        // Text may be empty wich results in a strange object
                        string text;
                        try { text = (string)values[2]; }
                        catch { text = ""; }
                        articleList.Add(new SimplePOS.Article.RegularArticle((string)values[0],
                            (string)values[1], text,
                            Double.Parse((string)values[3]),
                            Double.Parse((string)values[4])));
                    }
                    catch { return false; }
                }
            }

            // import to db
            db.SaveArticleList(articleList);

            return true;
        }
Exemplo n.º 11
0
 public ArticleView(ISposDb db, RegularArticle article)
     : this(db)
 {
     textBox1.Text      = article.Number;
     textBox1.IsEnabled = false;
     textBox2.Text      = article.Name;
     if (article.Name.Length != 0 && article.Price != 0)
     {
         textBox3.Text = string.Format("{0:0.00}", article.Price);
     }
     textBox4.Text = article.Text;
     double tax = article.Tax;
     if (article.Tax == Preferences.PreferenceManager.TAX_1)
     {
         comboBox1.SelectedIndex = 0;
     }
     else if (article.Tax == Preferences.PreferenceManager.TAX_2)
     {
         comboBox1.SelectedIndex = 1;
     }
     //textBox5.Text = article.Tax.ToString(); translater klasse (enum?)
 }
Exemplo n.º 12
0
 public StockList(ISposDb db)
 {
     this.db = db;
     InitializeComponent();
     updateGrid();
 }
Exemplo n.º 13
0
 public StockArticle(ISposDb db)
 {
     this.db = db;
     InitializeComponent();
     clearForm();
 }
Exemplo n.º 14
0
 public ArticleManager(ISposDb db)
 {
     this.db = db;
     InitializeComponent();
     updateGrid();
 }
Exemplo n.º 15
0
 public StockArticle(ISposDb db)
 {
     this.db = db;
     InitializeComponent();
     clearForm();
 }