Beispiel #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();
            }
        }
Beispiel #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();
            }
        }
Beispiel #3
0
        public static List <Stocky.Data.Interfaces.ITransaction> GetPurchases()
        {
            Proxies.AppDataClient DataClient = new Proxies.AppDataClient();

            List <Stocky.Data.Interfaces.ITransaction> templist = new List <Stocky.Data.Interfaces.ITransaction>();

            try
            {
                DataClient.Open();

                foreach (var item in DataClient.GetTransactionList(new SearchFilterObject {
                    ExtraSearchObject1 = Stocky.Data.TransactionType.Purchase
                }).TransactionList)
                {
                    templist.Add(item);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                DataClient.Close();
            }

            return(templist);
        }
Beispiel #4
0
        public void AddNew(skAddresses AddressObject)
        {
            Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                if (IsObjectValid)
                {
                    if (AddressObject.IsObjectValid)
                    {
                        DataClient.Open();
                        DataClient.AddNewPerson(this, AddressObject);

                        OnPersonCreated();
                    }
                    else
                    {
                        throw new Stocky.Exceptions.InvalidObjectException(AddressObject.PropertyList);
                    }
                }
                else
                {
                    throw new Stocky.Exceptions.InvalidObjectException(this.PropertyList);
                }
            }
            finally
            {
                DataClient.Close();
            }
        }
Beispiel #5
0
        public static List <skCategory> CategoryList(skCategory FilterObject)
        {
            Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            DataClient.Open();
            List <skCategory> returnlist = DataClient.GetCategoryList(FilterObject).CategoryList;

            DataClient.Close();
            return(returnlist);
        }
Beispiel #6
0
 public void PopulateSaleObj()
 {
     Stocky.Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
     try
     {
         SaleObject = DataClient.GetSalesObjectByStockID(Convert.ToInt32(Stockid)).SalesObject;
     }
     finally
     {
         DataClient.Close();
     }
 }
Beispiel #7
0
        public void RemoveFromSale(int UserID)
        {
            Stocky.Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                DataClient.Open();

                DataClient.RemoveStockFromSale(Convert.ToInt32(this.Stockid), UserID);
            }
            finally
            {
                DataClient.Close();
            }
        }
Beispiel #8
0
        public void LinktoTransaction(ITransaction TransactionObject, int UserID)
        {
            Stocky.Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                DataClient.Open();

                DataClient.LinkTranToStock(TransactionObject, this, UserID);
            }
            finally
            {
                DataClient.Close();
            }
        }
Beispiel #9
0
        public void PopulatePurchaseObj()
        {
            Stocky.Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                DataClient.Open();

                PurchaseObject = DataClient.GetPurchaseObjectByStockID(Convert.ToInt32(Stockid)).PurchaseObject;
            }
            finally
            {
                DataClient.Close();
            }
        }
Beispiel #10
0
 public void UpdateUser(bool IsPasswordReset)
 {
     Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
     try
     {
         DataClient.Open();
         DataClient.UpdateUser(this, IsPasswordReset);
         OnUserUpdated();
     }
     finally
     {
         DataClient.Close();
     }
 }
Beispiel #11
0
        public static skPerson GetPersonObject(int PersonID)
        {
            Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                DataClient.Open();

                return(DataClient.GetPersonObject(PersonID).PersonObject);
            }
            finally
            {
                DataClient.Close();
            }
        }
        public List <ITransaction> GetTransactionList()
        {
            Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                DataClient.Open();

                List <ITransaction> returnlist = DataClient.GetTransactionList(this.SearchFilter).TransactionList;
                return(returnlist);
            }
            finally
            {
                DataClient.Close();
            }
        }
Beispiel #13
0
        public static List <skAddresses> GetAddressList()
        {
            Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                DataClient.Open();

                List <skAddresses> ReturnList = DataClient.GetAddressesList().AddressList;

                return(ReturnList);
            }
            finally
            {
                DataClient.Close();
            }
        }
        public List <skStockHistory> GetStockHistory(long StockID)
        {
            Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                DataClient.Open();

                var Returnlist = DataClient.GetStockHistory(StockID).StockHistory;

                return(Returnlist);
            }
            finally
            {
                DataClient.Close();
            }
        }
Beispiel #15
0
        public static List <skPerson> GetPersonList()
        {
            Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                DataClient.Open();

                var returnlist = DataClient.GetPersonList().PersonList;

                return(returnlist);
            }
            finally
            {
                DataClient.Close();
            }
        }
Beispiel #16
0
        public List <skStock> LinkedStockList()
        {
            Stocky.Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                DataClient.Open();

                List <skStock> returnList = DataClient.GetStockListByTransaction(this).StockList;

                return(returnList);
            }
            finally
            {
                DataClient.Close();
            }
        }
Beispiel #17
0
        public bool Add()
        {
            if (IsObjectValid)
            {
                Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
                DataClient.Open();
                DataClient.AddNewVendor(this);
                DataClient.Close();

                OnVendorCreated();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #18
0
        internal bool IsDirtyObject()
        {
            Proxies.AppDataClient DataClient = new Proxies.AppDataClient();

            bool Result;

            try
            {
                DataClient.Open();
                Result = DataClient.IsRecordDirty(ValiationObject);
                return(Result);
            }
            finally
            {
                DataClient.Close();
            }
        }
Beispiel #19
0
 public void AddNew()
 {
     Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
     try
     {
         if (IsObjectValid)
         {
             DataClient.Open();
             DataClient.AddNewCategory(this);
             OnCategoryCreated();
         }
     }
     finally
     {
         DataClient.Close();
     }
 }
Beispiel #20
0
        public void AddnewRefund(int UserID)
        {
            Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                if (IsObjectValid)
                {
                    DataClient.Open();
                    DataClient.AddNewRefund(this, UserID);

                    OnRefundCreated();
                }
            }
            finally
            {
                DataClient.Close();
            }
        }
Beispiel #21
0
 public void Update()
 {
     Stocky.Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
     try
     {
         Validate();
         if (IsObjectValid)
         {
             OnPurchaseUpdated();
         }
         else
         {
             throw new InvalidObjectException(PropertyList);
         }
     }
     finally
     {
         DataClient.Close();
     }
 }
Beispiel #22
0
 public static skUser LoadUser(int UserID)
 {
     Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
     try
     {
         var Object = DataClient.GetUserObject(UserID).UserObject;
         if (Object != null)
         {
             return(Object);
         }
         else
         {
             throw new Exception("No user exists with this ID");
         }
     }
     finally
     {
         DataClient.Close();
     }
 }
Beispiel #23
0
 public void Delete()
 {
     Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
     try
     {
         if (IsObjectValid)
         {
             DataClient.Open();
             //DataClient.update(this);
         }
         else
         {
             throw new Stocky.Exceptions.InvalidObjectException(this.PropertyList);
         }
     }
     finally
     {
         DataClient.Close();
     }
 }
Beispiel #24
0
 public bool Update()
 {
     Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
     try
     {
         if (IsObjectValid)
         {
             DataClient.Open();
             DataClient.UpdateVendor(this);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     finally
     {
         DataClient.Close();
     }
 }
Beispiel #25
0
        public void LinkAddress(int AddressID)
        {
            Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                DataClient.Open();

                if (this.pID != 0)
                {
                    DataClient.LinkAddressToPerson(this.pID, AddressID);
                }
                else
                {
                    throw new Stocky.Exceptions.InvalidObjectException(this.PropertyList);
                }
            }
            finally
            {
                DataClient.Close();
            }
        }
Beispiel #26
0
 public void adduser()
 {
     Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
     try
     {
         if (Password == ConfirmPassword)
         {
             DataClient.Open();
             DataClient.AddNewUser(this);
             OnUserCreated();
         }
         else
         {
             throw new Exception("Password's Do not match!");
         }
     }
     finally
     {
         DataClient.Close();
     }
 }
Beispiel #27
0
 public void Add(int ObjectID, Type ObjectType)
 {
     Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
     try
     {
         if (IsObjectValid)
         {
             DataClient.Open();
             DataClient.AddNewAddress(this, ObjectID, ObjectType);
             OnAddressCreated();
         }
         else
         {
             throw new Stocky.Exceptions.InvalidObjectException(this.PropertyList);
         }
     }
     finally
     {
         DataClient.Close();
     }
 }
Beispiel #28
0
        public List <skAddresses> GetAddressses()
        {
            Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                DataClient.Open();

                List <skAddresses> returnlist = DataClient.GetAddressesList().AddressList;
                if (returnlist.Count != 0)
                {
                    return(returnlist);
                }
                else
                {
                    throw new Exception("No Records Found");
                }
            }
            finally
            {
                DataClient.Close();
            }
        }
Beispiel #29
0
        public static List <skvendors> VendorList()
        {
            Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                DataClient.Open();
                List <skvendors> returnlist = DataClient.GetVendorList().VendorList;

                if (returnlist.Count != 0)
                {
                    return(returnlist);
                }
                else
                {
                    throw new Exception("No Records Found");
                }
            }
            finally
            {
                DataClient.Close();
            }
        }
Beispiel #30
0
        public void UpdateLinkedAddresses()
        {
            Proxies.AppDataClient DataClient = new Proxies.AppDataClient();
            try
            {
                DataClient.Open();

                if (LinkedAddresses.Count != 0)
                {
                    LinkedAddresses.Clear();

                    foreach (var item in DataClient.GetAddressesListByPerson(this.pID).AddressList)
                    {
                        LinkedAddresses.Add(item);
                    }
                }
            }
            finally
            {
                DataClient.Close();
            }
        }