Пример #1
0
        public void AddWithPurchase(skPurchase Purchase, int UserID)
        {
            Stocky.Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                if (Validate())
                {
                    if (Purchase.Validate())
                    {
                        DataClient.Open();

                        DataClient.AddNewStock(this, Purchase, UserID);

                        OnStockCreated();
                    }
                    else
                    {
                        throw new InvalidObjectException(Purchase.PropertyList);
                    }
                }
                else
                {
                    throw new InvalidObjectException(base.PropertyList);
                }
            }
            finally
            {
                DataClient.Close();
            }
        }
Пример #2
0
        public void AddMultiWithPurchase(skPurchase Purchase, int UserID)
        {
            Stocky.Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                foreach (skStock s in StockList)
                {
                    if (!s.IsObjectValid)
                    {
                        throw new InvalidObjectException(s.PropertyList);
                    }
                }
                if (Purchase.IsObjectValid)
                {
                    DataClient.Open();

                    DataClient.AddNewStock(StockList, Purchase, UserID);

                    OnStockCreated();
                }
                else
                {
                    throw new InvalidObjectException(Purchase.PropertyList);
                }
            }
            finally
            {
                DataClient.Close();
            }
        }
Пример #3
0
        public void Add(int UserID)
        {
            Stocky.Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                if (IsObjectValid)
                {
                    DataClient.Open();

                    DataClient.AddNewStock(this, UserID);

                    OnStockCreated();
                }
                else
                {
                    throw new InvalidObjectException(base.PropertyList);
                }
            }
            finally
            {
                DataClient.Close();
            }
        }