示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,TeamNotificationName")] TeamNotification teamNotification)
        {
            if (id != teamNotification.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(teamNotification);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TeamNotificationExists(teamNotification.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(teamNotification));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Id,TeamNotificationName")] TeamNotification teamNotification)
        {
            if (ModelState.IsValid)
            {
                _context.Add(teamNotification);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(teamNotification));
        }
        public TeamNotificationDTM TeamNotificationToTeamNotificationDtmMap(TeamNotification tNotification)
        {
            TeamNotificationDTM tNotificationDTM = new TeamNotificationDTM();

            tNotificationDTM.EmployeeId       = tNotification.EmployeeId;
            tNotificationDTM.AfterBooked      = tNotification.AfterBooked;
            tNotificationDTM.AfterRescheduled = tNotification.AfterRescheduled;
            tNotificationDTM.Collegue         = tNotification.Collegue;
            tNotificationDTM.CollegueAndOwner = tNotification.CollegueAndOwner;
            tNotificationDTM.Owner            = tNotification.Owner;
            return(tNotificationDTM);
        }
示例#4
0
        public async Task <int> Create(EmployeeDTM item)
        {
            try
            {
                Employee employee = new Employee();
                employee.Business = await Database.Businesses.Get(item.Business.Id);

                employee.BusinessId = item.Business.Id;
                employee.User       = await Database.Users.Get(item.User.Id);

                employee.UserId  = item.User.Id;
                employee.IsOwner = item.IsOwner;

                await Database.Employees.Create(employee);

                if (employee.IsOwner == false)
                {
                    WorkingHour wHourDtm = new WorkingHour();
                    wHourDtm.Employee   = employee;
                    wHourDtm.EmployeeId = employee.Id;
                    await Database.WorkingHours.Create(wHourDtm);

                    Permission perm = new Permission();
                    perm.Employee   = employee;
                    perm.EmployeeId = employee.Id;
                    await Database.Permissions.Create(perm);

                    CalendarSetting cSetting = new CalendarSetting();
                    cSetting.Employee   = employee;
                    cSetting.EmployeeId = employee.Id;
                    await Database.CalendarSettings.Create(cSetting);

                    CustomerNotification cNotif = new CustomerNotification();
                    cNotif.Employee   = employee;
                    cNotif.EmployeeId = employee.Id;
                    await Database.CustomerNotifications.Create(cNotif);

                    TeamNotification tNotif = new TeamNotification();
                    tNotif.Employee   = employee;
                    tNotif.EmployeeId = employee.Id;
                    await Database.TeamNotifications.Create(tNotif);
                }

                return(employee.Id);
            }
            catch { return(0); }
        }
示例#5
0
        public static TeamNotification changeFromDTM(TeamNotificationDTM tNoticeDtm)
        {
            TeamNotification tNotification = new TeamNotification();

            tNotification.EmployeeId       = tNoticeDtm.EmployeeId;
            tNotification.AfterBooked      = tNoticeDtm.AfterBooked;
            tNotification.AfterRescheduled = tNoticeDtm.AfterRescheduled;
            tNotification.Collegue         = tNoticeDtm.Collegue;
            tNotification.CollegueAndOwner = tNoticeDtm.CollegueAndOwner;
            tNotification.Owner            = tNoticeDtm.Owner;

            if (tNoticeDtm.Employee != null)
            {
                tNotification.Employee = changeFromDTM(tNoticeDtm.Employee);
            }
            return(tNotification);
        }
        public async Task <bool> Update(TeamNotificationDTM tNotificationDtm)
        {
            try
            {
                TeamNotification tNotification = new TeamNotification();
                tNotification.EmployeeId       = tNotificationDtm.EmployeeId;
                tNotification.AfterBooked      = tNotificationDtm.AfterBooked;
                tNotification.AfterRescheduled = tNotificationDtm.AfterRescheduled;
                tNotification.Collegue         = tNotificationDtm.Collegue;
                tNotification.CollegueAndOwner = tNotificationDtm.CollegueAndOwner;
                tNotification.Owner            = tNotificationDtm.Owner;

                tNotification.Employee = await Database.Employees.Get(tNotificationDtm.Employee.Id);

                return(await Database.TeamNotifications.Update(tNotification) ? true : false);
            }
            catch (Exception ex) { Console.Out.WriteLine(ex.Message); return(false); }
        }
示例#7
0
        public static Employee changeFromDTM(EmployeeDTM employeeDtm)
        {
            Employee employee = new Employee();

            employee.Id         = employeeDtm.Id;
            employee.Business   = changeFromDTM(employeeDtm.Business);
            employee.BusinessId = employeeDtm.Business.Id;
            employee.User       = changeFromDTM(employeeDtm.User);
            employee.UserId     = employeeDtm.User.Id;
            employee.IsOwner    = employeeDtm.IsOwner;

            if (employeeDtm.CalendarSetting != null)
            {
                CalendarSetting cset = new CalendarSetting();
                cset = changeFromDTM(employeeDtm.CalendarSetting);
                employee.CalendarSetting = cset;
            }
            if (employeeDtm.CustomerNotification != null)
            {
                CustomerNotification cNotice = new CustomerNotification();
                cNotice = changeFromDTM(employeeDtm.CustomerNotification);
                employee.CustomerNotification = cNotice;
            }
            if (employeeDtm.TeamNotification != null)
            {
                TeamNotification tNotice = new TeamNotification();
                tNotice = changeFromDTM(employeeDtm.TeamNotification);
                employee.TeamNotification = tNotice;
            }
            if (employeeDtm.Permission != null)
            {
                Permission permission = new Permission();
                permission          = changeFromDTM(employeeDtm.Permission);
                employee.Permission = permission;
            }
            if (employeeDtm.WorkingHour != null)
            {
                WorkingHour wHour = new WorkingHour();
                wHour = changeFromDTM(employeeDtm.WorkingHour);
                employee.WorkingHour = wHour;
            }

            return(employee);
        }
        public async Task <int> Create(TeamNotificationDTM tNotificationDtm)
        {
            try
            {
                TeamNotification tNotification = new TeamNotification();
                tNotification.AfterBooked      = tNotificationDtm.AfterBooked;
                tNotification.AfterRescheduled = tNotificationDtm.AfterRescheduled;
                tNotification.Collegue         = tNotificationDtm.Collegue;
                tNotification.CollegueAndOwner = tNotificationDtm.CollegueAndOwner;
                tNotification.Owner            = tNotificationDtm.Owner;
                if (tNotificationDtm.Employee != null)
                {
                    tNotification.Employee = ModelFactory.changeFromDTM(tNotificationDtm.Employee);
                }
                await Database.TeamNotifications.Create(tNotification);

                return(tNotification.EmployeeId);
            }
            catch { return(0); }
        }
示例#9
0
    protected void HandleTeamNotification(MessageWrapper message)
    {
        bool             treasuryTax = false, treasuryRob = false, bankUpdateDep = false, bankUpdateWith = false, districtUpdate = false, tradepostUpdate = false;
        TeamNotification tn = JsonUtility.FromJson <TeamNotification>(message.message);
        ServerTeam       st = CurrentGame.Instance.PlayerTeam;

        st.TotalPlayerMoney = tn.totalPlayerMoney;
        st.visitedTadeposts = tn.VisitedTradeposts;        //todo validate

        if (st.bankAccount < (tn.bankAccount - 0.0001))
        {
            st.bankAccount = tn.bankAccount;
            bankUpdateDep  = true;
        }
        else if (st.bankAccount > (tn.bankAccount + 0.0001))
        {
            st.bankAccount = tn.bankAccount;
            bankUpdateWith = true;
        }


        if (st.treasury > (tn.treasury + 0.0001))
        {
            st.treasury = tn.treasury;
            treasuryRob = true;
        }
        else if (st.treasury < (tn.treasury - 0.0001))
        {
            st.treasury = tn.treasury;
            treasuryTax = true;
        }

        //todo check for differences
        st.districts = new List <AreaLocation>();
        foreach (AreaLocation areaLocation in tn.districts)
        {
            st.districts.Add(areaLocation);
        }

        //todo check for differences
        st.tradePosts = tn.tradeposts;


        if (treasuryTax)
        {
            InGameUIManager.s_Singleton.LogUI.AddToLog("Er zijn belastingen binnen gekomen", new object[] { });
        }

        if (treasuryRob)
        {
            InGameUIManager.s_Singleton.LogUI.AddToLog("Er is geld uit je schatkist genomen", new object[] { });
        }
        if (bankUpdateDep)
        {
            InGameUIManager.s_Singleton.LogUI.AddToLog("Er is geld op de bank gezet", new object[] { });
        }
        if (bankUpdateWith)
        {
            InGameUIManager.s_Singleton.LogUI.AddToLog("Er is geld van de bank afgehaald", new object[] { });
        }
        if (districtUpdate)
        {
            InGameUIManager.s_Singleton.LogUI.AddToLog("WIJK UPDATE", new object[] { });
        }
        if (tradepostUpdate)
        {
            InGameUIManager.s_Singleton.LogUI.AddToLog("HANDELSPOST UPDATE", new object[] { });
        }
    }
        public async Task <int> Create(BusinessDTM businessDtm)
        {
            try
            {
                Business business = new Business();
                business.Name = businessDtm.Name;
                if (businessDtm.Country != null)
                {
                    business.Phone              = businessDtm.Phone;
                    business.Logo               = businessDtm.Logo;
                    business.Webpage            = businessDtm.Webpage;
                    business.Address            = businessDtm.Address;
                    business.City               = businessDtm.City;
                    business.State              = businessDtm.State;
                    business.ZipCode            = businessDtm.ZipCode;
                    business.RegistrationNumber = businessDtm.RegistrationNumber;
                    business.Country            = await Database.Countries.Get(businessDtm.Country.Id);

                    business.Currency = await Database.Currencies.Get(businessDtm.Currency.Id);

                    business.Time_zone = await Database.Time_zones.Get(businessDtm.Time_zone.Id);

                    business.Booking = businessDtm.Booking == null ? null : await Database.Bookings.Get(businessDtm.Booking.BusinessId);

                    business.Services  = null;
                    business.Clients   = null;
                    business.Employees = null;
                }
                await Database.Businesses.Create(business);

                User user = await Database.BllServices.GetUser(businessDtm.UserId);

                Booking booking = new Booking();
                booking.BusinessId = business.Id;
                await Database.Bookings.Create(booking);

                Employee employeeBoss = new Employee();
                employeeBoss.IsOwner  = true;
                employeeBoss.Business = business;
                employeeBoss.User     = user;
                await Database.Employees.Create(employeeBoss);

                WorkingHour wHourDtm = new WorkingHour();
                wHourDtm.Employee   = employeeBoss;
                wHourDtm.EmployeeId = employeeBoss.Id;
                await Database.WorkingHours.Create(wHourDtm);

                Permission perm = new Permission();
                perm.Employee   = employeeBoss;
                perm.EmployeeId = employeeBoss.Id;
                await Database.Permissions.Create(perm);

                CalendarSetting cSetting = new CalendarSetting();
                cSetting.Employee   = employeeBoss;
                cSetting.EmployeeId = employeeBoss.Id;
                await Database.CalendarSettings.Create(cSetting);

                CustomerNotification cNotif = new CustomerNotification();
                cNotif.Employee   = employeeBoss;
                cNotif.EmployeeId = employeeBoss.Id;
                await Database.CustomerNotifications.Create(cNotif);

                TeamNotification tNotif = new TeamNotification();
                tNotif.Employee   = employeeBoss;
                tNotif.EmployeeId = employeeBoss.Id;
                await Database.TeamNotifications.Create(tNotif);

                return(business.Id);
            }
            catch { return(0); }
        }