Ejemplo n.º 1
0
        private void openNewSale(SaleTypes type)
        {
            var s = SalesFactoryService.CreateSale(type);

            if (s == null)
            {
                return;            // operation canceled
            }
            if (DBService.GetService().InsertGroup(new SalesGroupM(Wrapper.User, DateTime.Now, true, s)) != -1)
            {
                MessageBox.Show("המבצע נוצר בהצלחה!");
            }
            else
            {
                MessageBox.Show("אירעה שגיאה בזמן יצירת המבצע אנא פנה אל מרכז התמיכה");
            }
        }
Ejemplo n.º 2
0
        public void editFunction(SaleGroupViewModel sgvm)
        {
            ActivityLogService.Logger.LogFunctionCall(sgvm.GroupID);
            try
            {
                var group = DBService.GetService().LoadGroup(sgvm.GroupID);
                if (group.Sales.Count == 1)
                {
                    var sale = SalesFactoryService.EditSale(group.Sales[0]);
                    if (sale == null)
                    {
                        MessageBox.Show("אירעה שגיאה, אנא נסה שוב במועד מאוחר יותר.");
                    }

                    else if (DBService.GetService().EditSale(sale))
                    {
                        MessageBox.Show("המבצע עודכן בהצלחה!");
                        refreshGroups();
                    }
                    else
                    {
                        MessageBox.Show("אירעה שגיאה בזמן עריכת המבצע.\nלא בוצעו שינויים במבצע הקיים.");
                    }
                }
                else
                {
                    //### TODO: EditGroup form
                    //  re-arrange sales order
                    //  add ability to edit each sale
                    //  "delete" sale - change "isDeleted" to true
                    MessageBox.Show("כרגע, לא ניתן לערוך קבוצת מבצעים.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                ActivityLogService.Logger.LogError(ex);
            }
        }