/* public TimeOff getTimeOff() * { * return getTimeOffPopupByType(); * }*/ public TimeOff getTimeOffPopupByType(string TOtype) { //получение информации об отпуске pages.personalTimeOffPage.refreshPage(); pages.personalTimeOffPage.ensurePageLoaded(); pages.personalTimeOffPage.openTimeOffPopupByType(TOtype); //переход к первой записи pages.newTimeOffPopup.ensurePageLoaded(); TimeOff timeoff = new TimeOff(); timeoff.TOtype = pages.newTimeOffPopup.getTypeTO(); timeoff.TOstartDate = pages.newTimeOffPopup.getStartDate(); timeoff.TOendDate = pages.newTimeOffPopup.getEndDate(); timeoff.TODescription = pages.newTimeOffPopup.getDescription(); timeoff.TODependsOn = pages.newTimeOffPopup.getInterested(); if (timeoff.TOtype == "Больничный") { timeoff.TONumber = pages.newTimeOffPopup.getNumber(); timeoff.TOReason = pages.newTimeOffPopup.getReason(); } pages.newTimeOffPopup.closePopup(); return(timeoff); }
public void TakeTimeOff(TimeOff timeOff) { var employee = GetEmployee(timeOff.EmployeeId); employee.TakeVacation(timeOff.HoursTaken, timeOff.Date); _employeeRepository.Update(ToEmployeeEntity(employee)); }
public static TModel FromTimeOff <TModel>(TimeOff timeOff) where TModel : TimeOffApiModel, new() { var model = new TModel(); model.Id = timeOff.Id; return(model); }
public ActionResult DeleteConfirmed(int id) { TimeOff timeOff = db.TimeOffs.Find(id); db.TimeOffs.Remove(timeOff); db.SaveChanges(); return(RedirectToAction("Index")); }
// POST: api/TimeOff public void Post([FromBody] TimeOff timeOff) { if (!ModelState.IsValid) { return; } _employeeService.TakeTimeOff(timeOff); }
public void Email_Create_TimeOffs(TimeOff timeoff) { //клик по кнопке добавления app.userHelper.clickNewTimeOffsButton(); //создание отпуска app.timeoffHelper.createTimeOff(timeoff); //подключение к почтовому ящику и получение писем app.emailHeper.getEmail("*****@*****.**", "testmail"); //Проверка соответствия двух отпусков. Assert.IsTrue(app.emailHeper.TimeOffEmail()); }
public ActionResult Edit([Bind(Include = "TimeOffID,EmployeeID,FirstDay,LastDay")] TimeOff timeOff) { if (ModelState.IsValid) { db.Entry(timeOff).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EmployeeID = new SelectList(db.Employees, "EmployeeID", "firstName", timeOff.EmployeeID); return(View(timeOff)); }
public ActionResult DeleteConfirmed(int id) { TimeOff timeOff = db.TimeOff.Find(id); Employee emp = db.Employee.Find(Session["ID"]); emp.VacationDays += (timeOff.EndDate - timeOff.StartDate).Days; db.Entry(emp).State = EntityState.Modified; db.TimeOff.Remove(timeOff); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,EmployeeID,StartDate,EndDate,Reason")] TimeOff timeOff) { if (ModelState.IsValid) { db.Entry(timeOff).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EmployeeID = new SelectList(db.Employee.Include("Name"), "ID", "Name.FirstName"); return(View(timeOff)); }
public async Task <IActionResult> Index(TimeOff model) { if (ModelState.IsValid) { await timeOffRepository.Create(model); return(RedirectToAction("myrequests", "timeoff")); } return(View(model)); }
public string SetTimeOff(CustomTimeOff dataObj) { try { DateTime starttime = DateTime.Parse(dataObj.StartTime, CultureInfo.CurrentCulture); dataObj.StartTime = starttime.ToString("HH:mm"); DateTime endtime = DateTime.Parse(dataObj.EndTime, CultureInfo.CurrentCulture); dataObj.EndTime = endtime.ToString("HH:mm"); DateTime startdate = DateTime.Parse(dataObj.StartDate, CultureInfo.CurrentCulture); dataObj.StartDate = startdate.ToString("yyyy-MM-dd"); DateTime enddate = DateTime.Parse(dataObj.EndDate, CultureInfo.CurrentCulture); dataObj.EndDate = enddate.ToString("yyyy-MM-dd"); TimeOff obj = new TimeOff(); obj.CompanyId = dataObj.CompanyId; obj.EmployeeId = dataObj.EmployeeId; obj.Start = dataObj.StartDate + "T" + dataObj.StartTime; obj.End = dataObj.EndDate + "T" + dataObj.EndTime; obj.IsOffAllDay = dataObj.IsOffAllDay; obj.CreationDate = dataObj.CreationDate; string apiUrl = ConfigurationManager.AppSettings["DomainUrl"].ToString() + "/api/staff/AddTimeOff"; string result = ""; var httpWebRequest = (HttpWebRequest)WebRequest.Create(apiUrl); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; httpWebRequest.ProtocolVersion = HttpVersion.Version10; httpWebRequest.Headers.Add("Token", Request.Headers["Token"]); using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { var jsonstring = new JavaScriptSerializer().Serialize(obj); streamWriter.Write(jsonstring); streamWriter.Flush(); streamWriter.Close(); } var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { result = streamReader.ReadToEnd(); } return(result); } catch (Exception exception) { return(exception.ToString()); } }
public IHttpActionResult GetTimeOff(int id) { TimeOff timeOff = db.TimeOffs.Find(id); if (timeOff == null) { return(NotFound()); } return(Ok(timeOff)); }
public void Create_TimeOffs(TimeOff timeoff) { //клик по кнопке добавления app.userHelper.clickNewTimeOffsButton(); //создание отпуска app.timeoffHelper.createTimeOff(timeoff); //создание тестового отпуска для сравнения TimeOff testTimeOff = app.timeoffHelper.getTimeOffPopupByType(timeoff.TOtype); //Проверка соответствия двух отпусков. Assert.IsTrue(app.timeoffHelper.CompareTimeOffs(timeoff, testTimeOff)); }
public bool CompareTimeOffs(TimeOff T1, TimeOff T2) { T1.WriteToConsole(); T2.WriteToConsole(); return(T1.TOtype == T2.TOtype && T1.TOstartDate == T2.TOstartDate && T1.TOendDate == T2.TOendDate && T1.TOReason == T2.TOReason && T1.TONumber == T2.TONumber && T1.TODependsOn == T2.TODependsOn && T1.TODescription == T2.TODescription); }
public async Task <IActionResult> Index() { var user = await userManager.GetUserAsync(HttpContext.User); string userID = user.Id; var model = new TimeOff { UserID = userID }; return(View(model)); }
public IHttpActionResult AddTimeOff(TimeOff timeOff) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } timeOff.ClinicID = 1; db.TimeOffs.Add(timeOff); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = timeOff.ID }, timeOff)); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (this.Postion >= 0) { if (App.DataAlarm[this.Postion].TimeOffs != null && App.DataAlarm[this.Postion].TimeOffs.Count > 0) { this.Time = App.DataAlarm[this.Postion].TimeOffs[0]; } else { App.DataAlarm[this.Postion].TimeOffs = new List <TimeOff>(); } } }
public IHttpActionResult DeleteTimeOff([FromBody] int id) { TimeOff timeOff = db.TimeOffs.Find(id); if (timeOff == null) { return(NotFound()); } db.TimeOffs.Remove(timeOff); db.SaveChanges(); return(Ok(timeOff)); }
// GET: TimeOffs/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TimeOff timeOff = db.TimeOffs.Find(id); if (timeOff == null) { return(HttpNotFound()); } return(View(timeOff)); }
// GET: TimeOffs/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TimeOff timeOff = db.TimeOffs.Find(id); if (timeOff == null) { return(HttpNotFound()); } ViewBag.EmployeeID = new SelectList(db.Employees, "EmployeeID", "firstName", timeOff.EmployeeID); return(View(timeOff)); }
public async Task <AddOrUpdateTimeOffResponse> Handle(AddOrUpdateTimeOffRequest request) { var entity = await _dataContext.TimeOffs .SingleOrDefaultAsync(x => x.Id == request.TimeOff.Id && x.IsDeleted == false); if (entity == null) { _dataContext.TimeOffs.Add(entity = new TimeOff()); } entity.Name = request.TimeOff.Name; await _dataContext.SaveChangesAsync(); return(new AddOrUpdateTimeOffResponse() { }); }
public ActionResult Create([Bind(Include = "ID,EmployeeID,StartDate,EndDate,Reason")] TimeOff timeOff) { if (ModelState.IsValid) { Employee emp = db.Employee.Find(Session["ID"]); emp.VacationDays -= (timeOff.EndDate - timeOff.StartDate).Days; timeOff.Approved = false; db.TimeOff.Add(timeOff); db.Entry(emp).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EmployeeID = new SelectList(db.Employee.Include("Name"), "ID", "Name.FirstName"); return(View(timeOff)); }
protected void Button1_Click(object sender, EventArgs e) { DateTime startDate = DateTime.Parse(StartText.Text); DateTime endDate = DateTime.Parse(EndDateText.Text); int paid = int.Parse(PaidText.Text.ToString()); string type = TypeDropDown.SelectedItem.Text; int check = TimeOff.create(employee.Id, startDate, endDate, paid, type); if (check == 1) { header1.success("Time-Off Created!"); } else { header1.showAlert("Something went wrong!"); } }
public void editTimeOff(TimeOff timeoff) { //заполнение полей создания отпуска selectType(timeoff.TOtype); pages.newTimeOffPopup.setStartDateField(timeoff.TOstartDate); pages.newTimeOffPopup.setEndDateField(timeoff.TOendDate); pages.newTimeOffPopup.setInterested(timeoff.TODependsOn); pages.newTimeOffPopup.setDescription(timeoff.TODescription); if (timeoff.TOtype == "Больничный") { pages.newTimeOffPopup.setReasonField(timeoff.TOReason); pages.newTimeOffPopup.setNumber(timeoff.TONumber); } pages.newTimeOffPopup.saveClick(); }
public ActionResult ApproveRequest(TimeOff timeOff) { if (ModelState.IsValid) { TimeOff newTimeOff = db.TimeOff.Find(timeOff.ID); Employee newReplacement = db.Employee.Find(timeOff.ReplacementID); newTimeOff.Replacement = newReplacement; newTimeOff.Approved = true; db.Entry(newTimeOff).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ManagerIndex")); } var curId = Guid.Parse(Session["ID"].ToString()); ViewBag.ReplacementID = new SelectList(db.Employee.Include("Name").Where(t => t.ID != curId).OrderByDescending(t => t.startDate), "ID", "Name.FirstName"); return(View(timeOff)); }
/// <summary> /// Create new navigation property to timesOff for groups /// <param name="body"></param> /// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param> /// </summary> public RequestInformation CreatePostRequestInformation(TimeOff body, Action <TimesOffRequestBuilderPostRequestConfiguration> requestConfiguration = default) { _ = body ?? throw new ArgumentNullException(nameof(body)); var requestInfo = new RequestInformation { HttpMethod = Method.POST, UrlTemplate = UrlTemplate, PathParameters = PathParameters, }; requestInfo.SetContentFromParsable(RequestAdapter, "application/json", body); if (requestConfiguration != null) { var requestConfig = new TimesOffRequestBuilderPostRequestConfiguration(); requestConfiguration.Invoke(requestConfig); requestInfo.AddRequestOptions(requestConfig.Options); requestInfo.AddHeaders(requestConfig.Headers); } return(requestInfo); }
// GET: TimeOffs/Approve/5 public ActionResult Approve(int?id) { if (Session["ID"] == null) { return(RedirectToAction("Index", "Home")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TimeOff timeOff = db.TimeOff.Find(id); if (timeOff == null) { return(HttpNotFound()); } ViewBag.ReplacementID = new SelectList(db.Employee.Include("Name").Where(t => t.ID != timeOff.EmployeeID).OrderByDescending(t => t.startDate), "ID", "Name.FirstName"); return(View(timeOff)); }
private void Label_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (this.UIBegin.isEmpty()) { MessageBox.Show("Thời gian bắt đầu không được để trống", "Thông báo"); return; } if (this.UIEnd.isEmpty()) { MessageBox.Show("Thời gian kết thúc không được để trống", "Thông báo"); return; } TimeSpan begin = TimeSpan.Parse(this.UIBegin.Text); TimeSpan End = TimeSpan.Parse(this.UIEnd.Text); if (begin >= End) { MessageBox.Show("Thời gian bắt đầu phải nhỏ hơn thời gian kết thúc", "Thông báo"); return; } if (this.Time == null) { TimeOff time = new TimeOff(); time.beginTime = DateTime.Now.setTime(begin); time.EndTime = DateTime.Now.setTime(End); if (this.SaveDataEvent != null) { this.SaveDataEvent(this, new Tuple <int, TimeOff>(this.Postion, time)); } } else { this.Time.beginTime = DateTime.Now.setTime(begin); this.Time.EndTime = DateTime.Now.setTime(End); if (this.SaveDataEvent != null) { this.SaveDataEvent(this, new Tuple <int, TimeOff>(this.Postion, this.Time)); } } }
public IHttpActionResult CancelAppointments([FromBody] int id) { TimeOff timeOff = db.TimeOffs.Find(id); if (timeOff == null) { return(NotFound()); } List <Appointment> appointments = db.Appointments.Where(a => a.DoctorID == timeOff.DoctorID && DbFunctions.TruncateTime(a.Date) >= timeOff.From.Date && DbFunctions.TruncateTime(a.Date) <= timeOff.To.Date).ToList(); foreach (var app in appointments) { app.Status = (int)AppointmentStatus.Canceled; } timeOff.Status = (int)TimeOffStatus.Confirmed; db.SaveChanges(); return(Ok()); }
// GET: TimeOffs/Edit/5 public ActionResult Edit(int?id) { if (Session["ID"] == null) { return(RedirectToAction("Index", "Home")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TimeOff timeOff = db.TimeOff.Find(id); if (timeOff == null) { return(HttpNotFound()); } var curId = Guid.Parse(Session["ID"].ToString()); var emp = db.Employee.Include("Name").Where(t => t.ID == curId); ViewBag.EmployeeID = new SelectList(emp, "ID", "Name.FirstName"); return(View(timeOff)); }