Пример #1
0
 public GroceryItem(string connString, int itemID)
 {
     _ConnString = connString;
     _CreatedBy = new User(connString);
     _LastModifiedBy = new User(connString);
     LoadItem(itemID);
 }
Пример #2
0
 public GroceryItem(string connString, int itemID, int updateUserID)
 {
     _ConnString = connString;
     _CreatedBy = new User(connString);
     _LastModifiedBy = new User(connString);
     _LastModifiedBy.LoadUserDetails(updateUserID);
     LoadItem(itemID);
 }
Пример #3
0
 public InventoryModel()
 {
     AllItems = GroceryItem.GetAllItemsAsList(ConnString);
     CurrentUser = new User(ConnString);
     NewItem = new GroceryItem(ConnString);
     ItemGrid = new Grid<GroceryItem>(AllItems);
     CurrentOrder = new Order(ConnString);
     OrderGrid = new Grid<IOrderableItem>(CurrentOrder.OrderItems);
     OrderHistoryGrid = new Grid<Order>(Order.GetOrderHistory(ConnString));
 }
Пример #4
0
 public GroceryItem(string sku, string brand, string description, int qty, int orderThreshold, int maxQty, double unitCost, double retailPrice, int createdBy, int lastModifiedBy, string connString)
 {
     _SKU = sku;
     _Brand = brand;
     _Description = description;
     _CurrentQty = qty;
     _OrderThreshold = orderThreshold;
     _MaxQty = maxQty;
     _UnitCost = unitCost;
     _RetailPrice = retailPrice;
     _ConnString = connString;
     _CreatedBy = new User(connString);
     _LastModifiedBy = new User(connString);
     _CreatedBy.LoadUserDetails(createdBy);
     _LastModifiedBy.LoadUserDetails(lastModifiedBy);
 }
Пример #5
0
 public GroceryItem(string connString)
 {
     _ConnString = connString;
     _CreatedBy = new User(connString);
     _LastModifiedBy = new User(connString);
 }
Пример #6
0
        public bool LoadItem(int itemID)
        {
            try
            {
                string sql = "SELECT * FROM GroceryItems WHERE ItemID = @itemid";
                SqlParameter[] p = new SqlParameter[] {
                    new SqlParameter("@itemid", itemID)
                };

                DataRow dr = SqlHelper.ExecuteDataset(_ConnString, CommandType.Text, sql, p).Tables[0].Rows[0];

                _ItemID = (int)dr["ItemID"];
                _SKU = dr["SKU"].ToString();
                _Brand = dr["Brand"].ToString();
                _Description = dr["Description"].ToString();
                _CurrentQty = (int)dr["CurrentQty"];
                _OnOrderQty = (int)dr["OnOrderQty"];
                _MaxQty = (int)dr["MaxQty"];
                _OrderThreshold = (int)dr["OrderThreshold"];
                _DateLastReceived = (DateTime)dr["DateLastReceived"];
                _QtyLastReceived = (int)dr["QtyLastReceived"];
                _UnitCost = (double)dr["UnitCost"];
                _RetailPrice = (double)dr["RetailPrice"];
                _DateCreated = (DateTime)dr["DateLastCreated"];
                User createdBy = new User(_ConnString);
                User lastModifiedBy = new User(_ConnString);
                createdBy.LoadUserDetails((int)dr["CreatedBy"]);
                lastModifiedBy.LoadUserDetails((int)dr["LastModifiedBy"]);
                _CreatedBy = createdBy;
                _LastModifiedBy = lastModifiedBy;
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
Пример #7
0
 public UserModel(User user)
 {
     CurrentUser = user;
 }
Пример #8
0
 public UserModel()
 {
     NewUser = new User(ConnString);
     ConfirmPassword = String.Empty;
 }
Пример #9
0
 public BaseModel()
 {
     CurrentUser = new User(ConnString);
 }