Example #1
0
        public PersonDetailsViewModel()
        {
            try
            {
                if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
                {
                    return;
                }

                PersonObject = ObjectMessenger.FindObject("PersonObject");

                LinkedAddresses = new ObservableCollection <skAddresses>(PersonObject.LinkedAddresses);

                _SubmitChangesCommand     = new Command(PersonObject.Update);
                _RemoveAddressCommand     = new Command(() => { PersonObject.RemoveLinkedAddress(SelectedObject.AddressID); });
                _LinkAddressCommand       = new Command(LinkAddressMethod);
                _SubmitAddressLinkCommand = new Command(SubmitAddressLinkMethod);
                _AddNewAddressCommand     = new Command(AddNewAddressMethod);
                ObjectSourceList          = new ObservableCollection <skAddresses>(skAddresses.GetAddressList());
            }
            catch (Exception e)
            {
                ExepionLogger.Logger.LogException(e);
                ExepionLogger.Logger.Show(e);
            }
        }
        public StockDetailsViewModel()
        {
            if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
            {
                return;
            }
            try
            {
                ImgImp = new ImageImporter();
                if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
                {
                    return;
                }

                StockObj = ObjectMessenger.FindObject("SelectedStockItem");

                StockObj.UpdateCurrentObject();
                StockHistory            = new ObservableCollection <skStockHistory>(StockObj.StockHistory.GetStockHistory(StockObj.Stockid));
                ImageLIst               = new ObservableCollection <string>();
                _UpdateStock            = new Command(BasicStockUpdate);
                _UploadPhotos           = new Command(PhotoUpload);
                _OpenTransactionDetails = new Command(OpenTransactionObject);
                _Loaded = new AsynchronousCommand(Load);
                _SubmitPurchaseLinkCommand = new Command(SubmitPurchaseLinkMethod);
                ObjectSourceList           = new ObservableCollection <Data.Interfaces.ITransaction>(skPurchase.GetPurchases());
                _LinkPurchaseCommand       = new Command(LinkPurchaseMethod);
                FillComboBoxes();
            }
            catch (Exception E)
            {
                ExepionLogger.Logger.LogException(E);
                ExepionLogger.Logger.Show(E);
            }
        }
Example #3
0
        public static void Load(this skPurchase Object)
        {
            ObjectMessenger OM = new ObjectMessenger();

            OM.Send("TRANOBJ", Object);
            UI.Enviroment.LoadNewTab("PurchaseDetailsView", Object.Title);
        }
Example #4
0
        public static void CreateRefund(this skStock Object)
        {
            ObjectMessenger OM = new ObjectMessenger();

            OM.Send("STOCKITEM", Object);
            Stocky.UI.Enviroment.LoadNewTab("RefundView|");
        }
Example #5
0
        public static void Load(this skStock Object)
        {
            ObjectMessenger OM = new ObjectMessenger();

            OM.Send("SelectedStockItem", Object);
            UI.Enviroment.LoadNewTab("StockDetailsView", Object.Name);
        }
Example #6
0
        public static void Load(this skCategory Object)
        {
            ObjectMessenger OM = new ObjectMessenger();

            OM.Send("CATEGORYOBJ", Object);
            UI.Enviroment.LoadNewTab("CategoryDetailsView", Object.Name);
        }
Example #7
0
        public static void Load(this skPerson Object)
        {
            ObjectMessenger OM = new ObjectMessenger();

            OM.Send("PersonObject", Object);
            UI.Enviroment.LoadNewTab("PersonDetailsView", Object.FullName);
        }
        public static void LoadTransaction(ITransaction TransactionObject)
        {
            ObjectMessenger om = new ObjectMessenger();

            switch (TransactionObject.TransactionType)
            {
            case TransactionType.Purchase:
                if (!string.IsNullOrEmpty(TransactionObject.Title))
                {
                    om.Send("TRANOBJ", (skPurchase)TransactionObject);
                    UI.Enviroment.LoadNewTab("PurchaseDetailsView|Purchase Details");
                }
                else
                {
                    throw new Exception("No Purchase with this ID can be found.");
                }
                break;

            case TransactionType.Sale:
                if (!string.IsNullOrEmpty(TransactionObject.Title))
                {
                    om.Send("TRANOBJ", (skSales)TransactionObject);
                    UI.Enviroment.LoadNewTab("SalesDetailsView|Sale Details");
                }
                else
                {
                    throw new Exception("No Sale with this ID can be found.");
                }
                break;
            }
        }
Example #9
0
        public NewMultiSaleViewModel()
        {
            if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
            {
                return;
            }
            try
            {
                _SelectedStock              = new skStock();
                _SubmitSale                 = new Command(SubmitNewSaleMethod);
                _AddStocktoSale             = new Command(AddStockToSaleMethod, false);
                _RemoveStockFromSale        = new Command(RemoveStockFromSaleMethod, false);
                _ClearStockFromSale         = new Command(ClearStockFromSaleMethod);
                _AddNewPersonCommand        = new Command(AddNewPersonMethod);
                TransactionDetails          = new skSales();
                TransactionDetails.SaleDate = DateTime.Now;
                TransactionDetails.Amount   = 0;
                PersonList    = new ObservableCollection <skPerson>(skPerson.GetPersonList());
                StockList     = new ObservableCollection <skStock>(_SelectedStock.GetOrphanedStockList(TransactionType.Sale));
                StockSaleList = new ObservableCollection <skStock>();

                var InitialStockOBJ = ObjectMessenger.FindObject("STOCKOBJ") as skStock;
                TransactionDetails.Amount += InitialStockOBJ.SaleValue;
                StockSaleList.Add(InitialStockOBJ);
                StockList.Remove(InitialStockOBJ);

                TransactionDetails.Title       = "Sale of " + InitialStockOBJ.Name;
                TransactionDetails.Description = InitialStockOBJ.Description;
            }
            catch (Exception E)
            {
                ExepionLogger.Logger.LogException(E);
                ExepionLogger.Logger.Show(E);
            }
        }
Example #10
0
        public CategoryDetailsViewModel()
        {
            if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
            {
                return;
            }

            CategoryOBJ = ObjectMessenger.FindObject("CATEGORYOBJ");

            _SaveChanges = new Command(Submit);
        }
Example #11
0
 private void AddNewAddressMethod()
 {
     try
     {
         ObjectMessenger.Send("ADDRESSLINKOBJECT", PersonObject);
         Enviroment.LoadTab(new NewAddressViewModel());
     }
     catch (Exception e)
     {
         ExepionLogger.Logger.LogException(e);
         ExepionLogger.Logger.Show(e);
     }
 }
 private void EditVendor()
 {
     try
     {
         ObjectMessenger.Send("VENDOROBJ", SelectedVendorOBJ);
         UI.Enviroment.LoadNewTab("VendorDetailsView| " + SelectedVendorOBJ.VendorsName);
     }
     catch (Exception e)
     {
         ExepionLogger.Logger.LogException(e);
         ExepionLogger.Logger.Show(e);
     }
 }
Example #13
0
        public ReportsViewerViewModel()
        {
            MVVM_Framework.ObjectMessenger om = new ObjectMessenger();
            var server = om.FindObject("SSRS") as string;

            ReportBaseURISTring = server?.ToString();

            _Navi      = new WebBrowserNavigation(new Uri(ReportBaseURISTring));
            _Navigate  = new Command(Navigator);
            ReportList = new ObservableCollection <Stocky.Data.skReport>();

            FillTreeView();
        }
Example #14
0
        public static void OpenPurchaseTab(skPurchase PurchaseObj)
        {
            ObjectMessenger om = new ObjectMessenger();

            if (PurchaseObj != null)
            {
                om.Send("TRANOBJ", PurchaseObj);
                UI.Enviroment.LoadNewTab("PurchaseDetailsView");
            }
            else
            {
                throw new Exception("No Purchase with this ID can be found.");
            }
        }
Example #15
0
        public static void OpenRefundTab(skRefund RefundOBJ)
        {
            ObjectMessenger om = new ObjectMessenger();


            if (RefundOBJ != null)
            {
                om.Send("TRANOBJ", RefundOBJ);
                UI.Enviroment.LoadNewTab("SalesDetailsView");
            }
            else
            {
                throw new Exception("No Sale with this ID can be found.");
            }
        }
Example #16
0
 public PopUpnotificationViewModel()
 {
     if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
     {
         return;
     }
     try
     {
         _NotificationOBJ = ObjectMessenger.FindObject("NEWNOTIFICATION") as INotification;
         _OpenObject      = new Command(Open);
     }
     catch (Exception E)
     {
         ExepionLogger.Logger.LogException(E);
         ExepionLogger.Logger.Show(E);
     }
 }
        public PopUpnotificationViewModel()
        {
            ObjectMessenger om = new ObjectMessenger();

            if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
            {
                return;
            }
            try
            {
                _NotificationOBJ = om.FindObject("NEWNOTIFICATION") as INotification;
                _OpenObject      = new Command(Open);
            }
            catch (Exception E)
            {
                throw;
            }
        }
        public VendorDetailsViewModel()
        {
            if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
            {
                return;
            }
            try
            {
                VendorObj = ObjectMessenger.FindObject("VENDOROBJ");

                _SaveChanges = new Command(Submit);

                AddressList = new ObservableCollection <skAddresses>(_VendorObj.GetAddressses());
            }
            catch (Exception e)
            {
                ExepionLogger.Logger.LogException(e);
                ExepionLogger.Logger.Show(e);
            }
        }
Example #19
0
        public RefundViewModel()
        {
            if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
            {
                return;
            }
            try
            {
                _RefundObject           = new skRefund();
                _RefundObject.StockItem = ObjectMessenger.FindObject("STOCKITEM");

                _SubmitRefund = new Command(submitRefund);
                Notification  = new Notification();
                RefundObject.RefundCreated += Notification.OnNotificationReceived;
            }
            catch (Exception E)
            {
                ExepionLogger.Logger.LogException(E);
                ExepionLogger.Logger.Show(E);
            }
        }
Example #20
0
        protected void LoadStockTransactionLinkMethod(object TransactionObject)
        {
            ObjectMessenger Messanger = new ObjectMessenger();

            if (TransactionObject != null)
            {
                var Transaction = (ITransaction)TransactionObject;

                try
                {
                    Messanger.Send("LEDGEROBJ", Transaction);
                    StockLingView SLV = new StockLingView();
                    SLV.ShowDialog();
                }
                catch (Exception E)
                {
                    ExepionLogger.Logger.LogException(E);
                    ExepionLogger.Logger.Show(E);
                }
            }
        }
Example #21
0
        public StockLingViewModel()
        {
            if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
            {
                return;
            }
            try
            {
                _StockObj = new skStock();

                TransactionOBJ = ObjectMessenger.FindObject("TRANLEDGEROBJ") as ITransaction;
                StockList      = new ObservableCollection <skStock>(_StockObj.GetOrphanedStockList(TransactionOBJ.TransactionType));

                _Submit = new Command(CreateLink);
            }
            catch (Exception E)
            {
                ExepionLogger.Logger.LogException(E);
                ExepionLogger.Logger.Show(E);
            }
        }
Example #22
0
 public TransactionDetailsViewModel()
 {
     if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
     {
         return;
     }
     try
     {
         _TransactionObject = ObjectMessenger.FindObject("TRANOBJ");
         PopulateBasedOnType();
         _Link    = new Command(LinkExtraStock);
         _Refresh = new Command(PopulateBasedOnType);
         _RemoveStockFromTransaction = new Command(RemoveFromTransaction);
         _AddExtraStockCommand       = new Command(AddExtraStockMethod);
     }
     catch (Exception E)
     {
         ExepionLogger.Logger.LogException(E);
         ExepionLogger.Logger.Show(E);
     }
 }
        public NewAddressViewModel()
        {
            _SubmitNewAddressCommand = new Command(SubmitNewAddressMethod);
            _AddressObject           = new skAddresses();

            object LinkObject = ObjectMessenger.FindObject("ADDRESSLINKOBJECT");

            if (LinkObject != null)
            {
                Type ObjectType = LinkObject.GetType();

                switch (ObjectType.Name)
                {
                case "skPerson":
                    PersonObject = LinkObject as skPerson;
                    break;

                case "skvendors":
                    VendorObject = LinkObject as skvendors;
                    break;
                }
            }
        }
Example #24
0
 public Notification()
 {
     NotificationAttachments = new List <string>();
     OM = new ObjectMessenger();
 }