public bool isAppointedByManager(User user, int store_id) { Logger.logEvent(this, System.Reflection.MethodBase.GetCurrentMethod()); string owner; if (!Store_Managment.TryGetValue(store_id, out owner)) { return(false); } return(owner.Equals(user.getUserName())); }
//Add a user to be store Manager public Tuple <bool, string> addStoreManagment(Store store, string appointer) { Logger.logEvent(this, System.Reflection.MethodBase.GetCurrentMethod()); if (isguest()) { return(new Tuple <bool, string>(false, "Guest user cannot be store Manager\n")); } if (Store_Managment.ContainsKey(store.Id)) { return(new Tuple <bool, string>(false, getUserName() + " is already store Owner\n")); } Store_Managment.Add(store.GetStoreId(), appointer); return(new Tuple <bool, string>(true, "")); }
//Check if the user is Currently Store Manager public bool isStorManager(int store) { Logger.logEvent(this, System.Reflection.MethodBase.GetCurrentMethod()); return(Store_Managment.ContainsKey(store)); }
//Add appointment from user to store //owner appointed current to be store manager\owner //If this apppointment exist do not add. //public void addManagerAppointment(User owner, int id) //{ // Logger.logEvent(this, System.Reflection.MethodBase.GetCurrentMethod()); // if (!isAppointedByManager(owner, id)) // AppointedByManager.Add(id, owner); //} //public void addOwnerAppointment(User owner, int id) //{ // Logger.logEvent(this, System.Reflection.MethodBase.GetCurrentMethod()); // if (!isAppointedByOwner(owner., id)) // AppointedByOwner.Add(id, owner); //} //Remove Manager public bool RemoveStoreManagment(int store_id) { Logger.logEvent(this, System.Reflection.MethodBase.GetCurrentMethod()); return(Store_Managment.Remove(store_id)); }