private void MainForm_Shown(object sender, EventArgs e) { if (setDBConnectionAndLoad()) { var count = Attendant.MaxAttendantsPerDay(_db); for (int x = 1; x <= count; x++) { var style = new ColumnStyle(SizeType.Absolute, 125); scheduleTable.ColumnStyles.Add(style); scheduleTable.ColumnCount++; } if (Properties.Settings.Default.MainFormHeight != 0) { Height = Properties.Settings.Default.MainFormHeight; Width = Properties.Settings.Default.MainFormWidth; Left = Properties.Settings.Default.MainFormX; Top = Properties.Settings.Default.MainFormY; } if (Properties.Settings.Default.StartDate == DateTime.MinValue) { selectToolStripMenuItem_Click(null, EventArgs.Empty); } else { loadByRange(); } } }
private void ConfirmButtonClick(object sender, EventArgs e) { Task.Factory.StartNew(() => { ToggleLayout(); if (_myAttendant == null) { _myAttendant = new Attendant { EventId = _eventId, UserId = _myApplication.CurrentUser.Id }; } _myAttendant.Attending = _myAttendantState; _myAttendant.Reason = _reasonEditText.Text; DaoManager.Get().AttendantDao.Save(_myAttendant); ToggleLayout(); }).ContinueWith(task => { Load(); }, TaskScheduler.FromCurrentSynchronizationContext()); }
public IList <Attendant> GetEmployeeDepartments(string urlWebhook, int departmentID) { //string response = GetToAPI("https://luxassessoria.bitrix24.com.br/rest/6432/izu90pf0b1l3gjpr/user.get.json?UF_DEPARTMENT=" + departmentID.ToString()); urlWebhook = string.Format("{0}{1}{2}", urlWebhook, "user.get.json?UF_DEPARTMENT=", departmentID.ToString()); string response = GetToAPI(urlWebhook); var parsed = JObject.Parse(response); int rows = parsed["result"].Count(); List <Attendant> lstAttendat = new List <Attendant>(); for (int i = 0; i < rows; i++) { Attendant user = new Attendant(); user.AttendantId = parsed.SelectToken("result[" + i + "].ID").Value <int>(); user.Name = parsed.SelectToken("result[" + i + "].NAME").Value <string>(); user.LastName = parsed.SelectToken("result[" + i + "].LAST_NAME").Value <string>(); user.Email = parsed.SelectToken("result[" + i + "].EMAIL").Value <string>(); user.Active = parsed.SelectToken("result[" + i + "].ACTIVE").Value <bool>(); int rowsDep = parsed.SelectToken("result[" + i + "].UF_DEPARTMENT").Count(); //user.UF_DEPARTMENT = new List<int>(); user.DepartmentId = departmentID; lstAttendat.Add(user); //for (int j = 0; j < rowsDep; j++) //{ // //user.DepartmentId = parsed.SelectToken("result[" + i + "].UF_DEPARTMENT[" + j + "]").Value<int>(); //} } return(lstAttendat); }
public int Update(Attendant model) { var ret = _context.Attendants.Attach(model); _context.Entry(model).State = EntityState.Modified; _context.SaveChanges(); return((int)ret.State); }
public async Task <List <Attendant> > Get() { var userId = GetClaimValue("sub"); var attendant = new Attendant { UserId = userId }; return(await _attendantQuery.GetAttendatiesAsync(attendant)); }
public void DeleteAttendant(Group group, Attendant attendant) { if (group == null || !group.Id.Equals(attendant.GroupId)) { return; } _context.Set <Attendant>().Remove(attendant); _context.SaveChanges(); }
private void btnOk_Click(object sender, EventArgs e) { if (_selectedIndex < 0) { MessageBox.Show("Chưa có người được chọn", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } var personId = Int32.Parse(gridView.Rows[_selectedIndex].Cells["Id"].Value.ToString()); if (_forAttendant) { if (_attendants.Where(m => m.EmployeeId.Equals(personId)).Any()) { MessageBox.Show("Nhân viên đã có trong đoàn", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!_service.CanEmployeeBeAdded(personId, _from, _to)) { MessageBox.Show("Nhân viên đã tham gia đoàn khác", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else { if (_groupDets.Where(m => m.CustomerId.Equals(personId)).Any()) { MessageBox.Show("Khách hàng đã có trong đoàn", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!_service.CanCustomerBeAdded(personId, _from, _to)) { MessageBox.Show("Khách hàng đã tham gia đoàn khác", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } var check = MessageBox.Show(confirmMsg, "Xác nhận", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (check.Equals(DialogResult.Cancel)) { return; } if (_forAttendant) { var jobId = (int)comboJob.SelectedValue; var temp = new Attendant(0, personId, jobId); temp.Id = _nextId + 1; _attendants.Add(temp); _attendantsModified.Add(temp); } else { var temp = new GroupDetail(0, personId); temp.Id = _nextId + 1; _groupDets.Add(temp); _groupDetsModified.Add(temp); } this.DialogResult = DialogResult.OK; this.Close(); }
public static void GeneratePDFViewBag(int id, dynamic ViewBag) { Event @event = db.Events.Find(id); if (@event.EventType == "Performance Review" && @event.Attendants != null && @event.Attendants.Count > 0) { #region PrepareViewBag Attendant at = @event.Attendants.FirstOrDefault(); Employee employee = db.Employees.Find(at.EmployeeID); string profilePicUrl = ""; //getting the picture ready Common.CreateSkillTemplates(employee); if (employee.File != null) { profilePicUrl = Utils.Common.SaveImgLocally(db, employee.File.FileID.ToString()); ViewBag.profilePicUrl = profilePicUrl; } else { ViewBag.profilePicUrl = System.Web.HttpContext.Current.Server.MapPath("~/Content/Pictures/"); } //getting the projects for this employee List <Task> tasks = db.Tasks.Include(x => x.Sprint).Where(x => x.EmployeeID == employee.EmployeeID).ToList(); List <Project> projects = (from t in db.Tasks join s in db.Sprints on t.SprintID equals s.SprintID join p in db.Projects on s.ProjectID equals p.ProjectID where t.EmployeeID == employee.EmployeeID select p).Distinct().ToList(); foreach (Project p in projects) { //selecting the correct tasks for each project List <Task> projectTasks = tasks.Where(x => x.Sprint != null && x.Sprint.ProjectID == p.ProjectID).ToList(); foreach (Task t in projectTasks) { if (t.Estimation.HasValue) { p.ManHoursEffort += t.Estimation.Value; } } } ViewBag.projects = projects; ViewBag.headertext = "CV: " + employee.FirstName + " " + employee.LastName; //initializing CV employee.SkillLevelsList = employee.SkillLevels.ToList(); ViewBag.SkillCategories = db.SkillCategories.OrderByDescending(x => x.Skills.Count).ToList(); #endregion } }
public int Add(Attendant model) { if (model != null) { var ret = _context.Attendants.Add(model); _context.SaveChanges(); return((int)ret.State); } return(0); }
public ActionResult EditAttendant(Attendant attendant) { if (NotAllowedHere()) { return(RedirectAway()); } _attendantRepo.Save(attendant); return(RedirectToAction("EventAttendants", new { id = attendant.EventID })); }
public Attendant AddAttendant(Group group, Attendant attendant) { if (group != null && group.Id.Equals(attendant.GroupId)) { var tracked = _context.Set <Attendant>().Add(attendant); _context.SaveChanges(); return(tracked.Entity); } return(null); }
private bool loadByRange(DateTime startDate, DateTime endDate) { startDateLabel.Text = startDate.ToShortDateString(); endDateLabel.Text = endDate.ToShortDateString(); var days = _db.Services.Include("AttendantSchedules.Attendant").Where(s => s.Date >= startDate && s.Date <= endDate) .OrderBy(s => s.Date).ThenBy(s => s.AMPM).ToList(); if (!days.Any()) { return(false); } else { scheduleTable.SuspendLayout(); scheduleTable.Controls.Clear(); scheduleTable.RowCount = 1; int row = 0; var font = new Font(scheduleTable.Font, FontStyle.Bold); var additionalDays = _db.AdditionalServices.ToList(); foreach (var day in days) { var newRowStyle = new RowStyle(SizeType.Absolute, 20); scheduleTable.RowStyles.Add(newRowStyle); Color?fontColor = null; if (additionalDays.Any(s => s.Date.Date == day.Date.Date && s.AMPM == day.AMPM)) { fontColor = Color.Blue; } addLabel(day.Date.ToString("MMM d"), 0, row, font, fontColor); addLabel(day.AMPM, 1, row, font, fontColor); for (int x = 1; x <= Attendant.MaxAttendantsPerDay(_db); x++) { var schedule = day.AttendantSchedules.FirstOrDefault(s => s.Position == x); if (schedule != null) { addPerson(schedule, x + 1, row); } else { addLabel("", x + 1, row); } } row++; scheduleTable.RowCount++; } setCellColors(null, false); scheduleTable.ResumeLayout(); distributionDisplay.DisplayCounts(startDate, endDate); return(true); } }
public ActionResult EditAttendant(int id) { if (NotAllowedHere()) { return(RedirectAway()); } Attendant attendant = _attendantRepo.FindByID(id); return(View(attendant)); }
public ActionResult Add(CareGiverViewModel model) { try { if (ModelState.IsValid) { model.Email = model.Email.Trim(); var checkAttendent = _dbContext.tbl_Attendants.Where(w => w.Email == model.Email).FirstOrDefault(); if (checkAttendent == null) { checkAttendent = _dbContext.tbl_Attendants.Where(w => w.EmployeeNo == model.EmployeeNo).FirstOrDefault(); if (checkAttendent == null) { Attendant attendant = new Attendant() { FirstName = model.FirstName, MiddleName = model.MiddleName, LastName = model.LastName, EmployeeNo = model.EmployeeNo, Email = model.Email, CreatedDate = DateTime.Now, CreatedBy = UserId, HrGroupId = model.HrGroupId }; _dbContext.tbl_Attendants.Add(attendant); _dbContext.SaveChanges(); ViewBag.SuccessMessage = "Care Giver added successfully"; } else { ViewBag.ErrorMessage = "Employee no is already exists"; } } else { ViewBag.ErrorMessage = "Email is already exists"; } } } catch (Exception ex) { } model.HrGroupList = _dbContext.tbl_HrGroups.Where(w => w.IsActive == true) .Select(s => new HrGroupViewModel { Id = s.Id, Name = s.Name }).ToList(); return(View(model)); }
public void GivenIHaveAnAttendant_WhenTheAttendatCreateAnOrder_ThenIShouldHaveAnOrderWichConsistsOfDishes() { //arrange var attendant = new Attendant(); //act _order = attendant.CreateOrder(_choices, _table); //assert Assert.IsNotNull(_order.CustomerChoices); }
public void GivenIHaveAnAttendant_WhenTheAttendantCreateAnOrder_ThenIShouldHaveAnOrderWithNumberOrder() { //arrange var attendant = new Attendant(); //act _order = attendant.CreateOrder(_choices, _table); //assert Assert.IsNotNull(_order.OrderNumber); }
public async Task <Unit> Handle(CreateAttendantCommand request, CancellationToken cancellationToken) { var attendant = new Attendant(request.FullName, request.Email, request.PhoneNumber, IdentityRole.Attendant) { }; Context.Attendants.Add(attendant); await Context.SaveChangesAsync(); return(Unit.Value); }
public void GivenIHaveAnAttendant_WhenTheAttendantCreateAnOrder_ThenIShouldHaveAnOrderWithOptionsChosen() { //arrange var attendant = new Attendant(); //act _order = attendant.CreateOrder(_choices, _table); var optionDishe = _order.CustomerChoices.Where(_ => _.Id > 0).Select(_ => _.OptionDishesType).FirstOrDefault(); //assert Assert.IsNotNull(optionDishe); }
public async Task GoOnlineAsync(Attendant attendant) { AttendantData = attendant; var tasks = AttendantData.BotsInformation.SelectMany( bot => bot.Value.Select(async queue => { var queueGrain = GrainFactory.GetGrain <IQueueGrain>($"{bot.Key}-{queue}"); await queueGrain.RegisterAttendantAsync(attendant.AttendantName, attendant.MaxSlots, attendant.CurrentTickets.Count()); })); await Task.WhenAll(tasks); }
public async Task <Unit> Handle(CreateAttendantCommand request, CancellationToken cancellationToken) { var attendant = new Attendant { FullName = request.FullName, Email = request.Email, PhoneNumber = request.PhoneNumber }; Context.Attendants.Add(attendant); await Context.SaveChangesAsync(cancellationToken); return(Unit.Value); }
/// <summary> /// Gives the guest a free coupon book. /// </summary> /// <returns>Returns a coupon book.</returns> public CouponBook GiveFreeCouponBook() { Item item = null; try { item = Attendant.FindItem(this.Items, typeof(CouponBook)); } catch (Exception) { throw new MissingItemException("Couponbook not found."); } return(item as CouponBook); }
/// <summary> /// Gives the guest a free coupon book. /// </summary> /// <returns>Returns a map.</returns> public Map GiveFreeMap() { Item item = null; try { item = Attendant.FindItem(this.Items, typeof(Map)); } catch (Exception) { throw new MissingItemException("Map not found."); } return(item as Map); }
private List <Attendant> ReadTables(DataTable dataTable) { List <Attendant> attendants = new List <Attendant>(); foreach (DataRow dr in dataTable.Rows) { Attendant attendant = new Attendant() { Id = (int)dr["docentnummer"], voornaam = (String)dr["voornaam"].ToString(), achternaam = (String)dr["achternaam"].ToString() }; attendants.Add(attendant); } return(attendants); }
public void GivenIHaveAnAttendant_WhenTheAttendantCreateAnOrder_ThenIShouldHaveAnOrderWithDishesOptionChosenByCustomerForEachDish() { //arrange var attendant = new Attendant(); //act _order = attendant.CreateOrder(_choices, _table); var expected = _order.CustomerChoices.Where(_ => _.Id > 0).Select(_ => _.OptionDishesType); //assert Assert.IsNotNull(expected); Assert.IsNotEmpty(expected); Assert.AreEqual(_order.CustomerChoices, _choices); Assert.IsTrue(_customer.OrderDishIsCalled); }
private void LoadAttendants() { _attendants = DaoManager.Get().AttendantDao.Find("Event_Id", _eventId.ToString()); //Setup new attendants if 0 are found if (_attendants.Count == 0) { var users = DaoManager.Get().TeamUserDao.FindByTeamId(_myApplication.CurrentTeam.Id); foreach (var teamUser in users) { var newAttendant = new Attendant { Attending = AttendingState.Maybe, EventId = _eventId, Reason = "", UserId = teamUser.UserId }; var datatabasAttendant = DaoManager.Get().AttendantDao.Save(newAttendant); _attendants.Add(datatabasAttendant); } } foreach (var attendant in _attendants) { if (attendant.UserId == _myApplication.CurrentUser.Id) { _myAttendant = attendant; break; } } _attendantsListItems = new List <AttendantListItem>(); foreach (var attendant in _attendants) { var user = DaoManager.Get().UserDao.Find(attendant.UserId); var newItem = new AttendantListItem { User = user[0], AttendState = attendant.Attending, Reason = attendant.Reason }; _attendantsListItems.Add(newItem); } }
public async Task <Attendant> GetByLocationAndDate(string location, DateTime date) { try { var userId = GetClaimValue("sub"); var attendant = new Attendant { UserId = userId, Location = location, Date = date }; return(await _attendantQuery.GetAttendateAsync(attendant)); } catch (Exception) { return(null); } }
private string ValidateAttendantWithService(Attendant attendant, Service service) { if (service.AMPM == "AM" && !attendant.DoesAM) { return($"{ attendant.FullName } does not do AM services."); } else if (service.AMPM == "PM" && !attendant.DoesPM) { return($"{ attendant.FullName } does not do PM services."); } else if (attendant.ExclusionEnd.HasValue && attendant.ExclusionStart.HasValue && service.Date >= attendant.ExclusionStart.Value && service.Date <= attendant.ExclusionEnd.Value) { return($"{ attendant.FullName } does not do services between { attendant.ExclusionStart.Value.ToShortDateString() } and { attendant.ExclusionEnd.Value.ToShortDateString() }"); } else { return(null); } }
private void addLabel(string text, int column, int row, Attendant attendant = null, Font font = null) { var label = new Label(); label.Text = text; label.Dock = DockStyle.Fill; label.Margin = new Padding(0); label.Padding = new Padding(0); label.TextAlign = ContentAlignment.MiddleLeft; if (font != null) { label.Font = font; } if (attendant != null) { label.MouseUp += Label_Click; label.Tag = attendant.ID; } distributionTable.Controls.Add(label, column, row); }
/// <summary> /// Sells the guest a water bottle. /// </summary> /// <param name="payment">The payment for the water bottle.</param> /// <returns>Returns a water bottle.</returns> public WaterBottle SellWaterBottle(decimal payment) { Item item = null; try { if (payment == this.WaterBottlePrice) { item = Attendant.FindItem(this.Items, typeof(WaterBottle)); if (item != null) { this.AddMoney(payment); } } } catch (Exception) { throw new MissingItemException("Waterbottle not found."); } return(item as WaterBottle); }
public List <Attendant> GetNonAttendants() { try { List <Attendant> nonAttendants = attendant_db.Db_Get_All_Non_Attendants(); return(nonAttendants); } catch (Exception) { // something went wrong connecting to the database, so we will add a fake student to the list to make sure the rest of the application continues working! List <Attendant> nonAttendants = new List <Attendant>(); Attendant a = new Attendant(); a.Id = 24; a.voornaam = "Jacintha"; a.achternaam = "Dreischor"; nonAttendants.Add(a); return(nonAttendants); //throw new Exception("Someren couldn't connect to the database"); } }