Ejemplo n.º 1
0
        public static bool UseMeal(MealType type)
        {
            if (LoadedCardUser == null)
            {
                MUtility.ShowWarrning("Korisnik nije ucitan");
                return(false);
            }

            try
            {
                ObrokNaplataDto o = new ObrokNaplataDto();
                o.BrojObroka             = 1;
                o.IdKorisnika            = MainController.LoadedCardUser.UserID;
                o.IdLokacijeIskoriscenja = MSettings.CurrentMensa.MensaID;
                o.IdTipa = (int)type;

                Api.UseMeal(o);
                return(true);
            }
            catch (Exception e)
            {
                MUtility.ShowException(e);
                return(false);
            }
        }
Ejemplo n.º 2
0
        public static void AddUserMeal(User s, MealType type, int count)
        {
            if (count < 0)
            {
                MUtility.ShowWarrning("Broj obroka je negativan broj!");
                return;
            }
            if (count == 0)
            {
                return;
            }
            if (s.AccountType != User.UserAccountType.Student)
            {
                MUtility.ShowWarrning("Nalog nije studentski");
                return;
            }
            ObrokUplataDto o = new ObrokUplataDto()
            {
                BrojObroka       = count,
                IdLokacijeUplate = MSettings.CurrentMensa.MensaID,
                IdKorisnika      = s.UserID,
                IdTipa           = (int)type
            };

            try
            {
                Api.AddMeal(o);
            }
            catch (Exception e)
            {
                MUtility.ShowException(e);
            }
        }
Ejemplo n.º 3
0
        public static void AddUserMeals(User s, int breakfast, int lunch, int dinner)
        {
            if (s.AccountType != User.UserAccountType.Student)
            {
                MUtility.ShowWarrning("Nalog nije studentski");
                return;
            }

            AddUserMeal(s, MealType.Dorucak, breakfast);
            AddUserMeal(s, MealType.Rucak, lunch);
            AddUserMeal(s, MealType.Vecera, dinner);
        }