public async Task <IActionResult> Edit(int id, [Bind("ID,Customer,Gender,Address,Phone,Email,Job,WorkPlace,Cmnd,Day,Place,Money,Purpose,Requires,Price,Details,DType,Cash,NCH1,NCH2,NCH3,NMS,NSHH,NSH,HKTT,sale,password,Contract, Priority, Confirm")] Appoinment appoinment) { if (id != appoinment.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(appoinment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AppoinmentExists(appoinment.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(appoinment)); }
public async Task <bool> AddAppoinmentAsync(MakeAnAppoinmentDto makeAnAppoinmentDto, int pacientId) { var time = TimeSpan.FromMinutes((int)makeAnAppoinmentDto.FromTimeSpan).ToString(). Substring(0, TimeSpan.FromMinutes((int)makeAnAppoinmentDto.FromTimeSpan).ToString().Length - 3) + "-" + TimeSpan.FromMinutes((int)makeAnAppoinmentDto.ToTimeSpan).ToString(). Substring(0, TimeSpan.FromMinutes((int)makeAnAppoinmentDto.ToTimeSpan).ToString().Length - 3); var dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc); //Add 3 hours in seconds to complete the diference between utc0 and utc3 (Romania time) dtDateTime = dtDateTime.AddSeconds(makeAnAppoinmentDto.DayUnixTime + 10800); var dateId = (dtDateTime.Year * 100 + dtDateTime.Month) * 100 + dtDateTime.Day; var newAppoinment = new Appoinment { AppoinmentDate = dtDateTime.ToString("dd/MM/yyyy"), AppoinmentHour = time, AppoinmentStartSpan = makeAnAppoinmentDto.FromTimeSpan, AppoinmentEndSpan = makeAnAppoinmentDto.ToTimeSpan, Reason = makeAnAppoinmentDto.Reason, DateId = dateId, PacientId = pacientId, DoctorId = makeAnAppoinmentDto.DoctorId, IsConsultationAdded = false, StatusId = (int)AppoinmentStatuses.Pending, }; _context.Appoinments.Add(newAppoinment); return(await _context.SaveChangesAsync() > 0); }
public async Task <IActionResult> AddDOB([Bind("Id", "Customer", "DOB")] Appoinment a) { var curUser = await _userManager.GetUserAsync(User); var authorized = await IsAuthorized(curUser, "Contracts", "Update"); if (!authorized) { return(View("AccessDenied")); } var app = await _context.appoinment.FindAsync(a.Id); if (app != null) { app.DOB = a.DOB; _context.Update(app); await _context.SaveChangesAsync(); TempData["StatusMessage"] = "Cập nhật thành công!"; return(View()); } else { TempData["StatusMessage"] = "Không thể cập nhật!"; } return(View()); }
public async Task <IActionResult> Views(Guid?id) { if (id == null) { return(NotFound()); } var curUser = await _userManager.GetUserAsync(User); var authorized = await IsAuthorized(curUser, "Contracts", "Read"); if (!authorized) { return(View("AccessDenied")); } Appoinment a = await _context.appoinment .FirstOrDefaultAsync(b => b.Id == id); //PasswordHasher<Sale> hasher = new PasswordHasher<Sale>(); //PasswordVerificationResult result = hasher.VerifyHashedPassword(curUser, curUser.PasswordHash, a.password); //if (a.password != curUser.PasswordHash) // return NotFound(); if (a == null) { return(NotFound()); } var sale = await _userManager.GetUserAsync(User); TempData["name"] = sale.Name; return(RedirectToAction("Views", "Appoinments", new { id })); }
public List <Appoinment> GetAppoinmentsByRequestDA(Guid requestId) { DataSet ds = new DataSet(); List <Appoinment> listA = new List <Appoinment>(); string query = "exec spS_AppoinmentByRequest @RequestID='" + requestId + "'"; ds = con.ObtenerConsulta(query); foreach (DataRow DR in ds.Tables[0].Rows) { Appoinment ap = new Appoinment(); ap.AppoinmentId = Guid.Parse(DR["AppoinmentId"].ToString()); ap.Date = Convert.ToDateTime(DR["Date"].ToString()); ap.Delegationid = Convert.ToInt32(DR["DelegationId"].ToString()); ap.IsAttended = Convert.ToBoolean(DR["IsAttended"].ToString()); ap.IsCancelled = Convert.ToBoolean(DR["IsCancelled"].ToString()); ap.RequestId = Guid.Parse(DR["RequestId"].ToString()); ap.Time = TimeSpan.Parse(DR["Capacity"].ToString()); listA.Add(ap); } return(listA); }
static void addappointment() { using (var context = new Context()) { Appoinment dp = new Appoinment(); Console.WriteLine("Enter Drug Name"); dp.PatientId = Convert.ToInt32(Console.ReadLine()); var check = context.Appoinments.SingleOrDefault(t => t.PatientId == dp.PatientId && t.DoctorId == dp.DoctorId && t.Time == dp.Time); if (check == null) { try { context.Appoinments.Add(dp); context.SaveChanges(); Console.WriteLine("Appointment Successfully done"); } catch (Exception e) { Console.WriteLine(e); } } else { Console.WriteLine("Appointment is already Booked"); } } }
public async Task <IActionResult> Edit(string id, [Bind("AppoinmentId,StudentId,TeacherId,AppoinmentDate,AppoinmentTime,AppoinmentCoz")] Appoinment appoinment) { if (id != appoinment.AppoinmentId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(appoinment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AppoinmentExists(appoinment.AppoinmentId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["StudentId"] = new SelectList(_context.Student, "StudentId", "StudentId", appoinment.StudentId); ViewData["TeacherId"] = new SelectList(_context.Teacher, "TeacherId", "TeacherId", appoinment.TeacherId); return(View(appoinment)); }
private void button2_Click_1(object sender, EventArgs e) { String cusName = textBox1.Text; String cusPhn = textBox2.Text; String email = textBox3.Text; String vehicle = textBox4.Text; // String dtaTime = dateTimePicker1.Value.ToString("yyyy-MM-dd"); Guid UniqueID = Guid.NewGuid(); String id; id = UniqueID.ToString(); if ((cusName != "") && (cusPhn != "") && (email != "") && (vehicle != "")) { Appoinment appoinment = new Appoinment(id, cusName, cusPhn, email, vehicle, dateTimePicker1.Value.ToString()); DatabaseConnection db = new DatabaseConnection(); db.addAppoinment(appoinment); } else { err er = new err(); er.Show(); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; } }
public Appoinment GetMyUpcomingAppoinments(long id) { Appoinment appoinment = new Appoinment(); SqlHelper sqlHelper = new SqlHelper(System.Configuration.ConfigurationManager.ConnectionStrings["AppoinmentsConnection"].ToString()); SqlParameter[] AppoinmentParameters = { new SqlParameter("@Auid", id) }; using (DataTable tbl = sqlHelper.tbl("GetMyUpcomingAppoinment", AppoinmentParameters)) { if (tbl.Rows.Count > 0) { Function objFuction = new Function(); foreach (DataRow row in tbl.Rows) { appoinment.Atitle = Convert.ToString(objFuction.MakeStrDBSafe(row["Atitle"].ToString())); appoinment.Adate = Convert.ToDateTime(objFuction.MakeDateDBSafe(row["Adate"].ToString())); appoinment.Astatus = Convert.ToString(objFuction.MakeStrDBSafe(row["Astatus"].ToString())); appoinment.Auser = Convert.ToString(objFuction.MakeStrDBSafe(row["Auser"].ToString())); appoinment.Abusiness = Convert.ToString(objFuction.MakeStrDBSafe(row["Abusiness"].ToString())); appoinment.Atime = TimeSpan.Parse(objFuction.MakeTimeDBSafe(row["Atime"].ToString()).ToString()); appoinment.Uemailid = Convert.ToString(objFuction.MakeStrDBSafe(row["Uemail"].ToString())); appoinment.Uphonenumber = Convert.ToInt64(objFuction.MakeStrDBSafe(row["Uphone"].ToString())); } } return(appoinment); } }
public HttpResponseMessage ModifyMyAppoinment([FromBody] Appoinment objAppoinment) { HttpResponseMessage outResponse = null; SqlHelper sqlHelper = new SqlHelper(System.Configuration.ConfigurationManager.ConnectionStrings["AppoinmentsConnection"].ToString()); try { SqlParameter[] para = { new SqlParameter("@Aid", objAppoinment.Aid), new SqlParameter("@Atitle", objAppoinment.Atitle), new SqlParameter("@Adate", objAppoinment.Adate), new SqlParameter("@Astatus", objAppoinment.Astatus), new SqlParameter("@Auser", objAppoinment.Auser), new SqlParameter("@Abusiness", objAppoinment.Abusiness), new SqlParameter("@Atime", objAppoinment.Atime) }; int strMessage = sqlHelper.ExecuteNonQueryInt("ModifyMyAppoinment", CommandType.StoredProcedure, para); outResponse = Request.CreateResponse(HttpStatusCode.Created, objAppoinment); } catch (Exception exc) { outResponse = Request.CreateErrorResponse(HttpStatusCode.BadRequest, exc); } return(outResponse); }
public async Task <IActionResult> Confirmed(Appoinment a) { if (a.Contract == null) { return(NotFound()); } Appoinment tmp = await _context.appoinment.FirstOrDefaultAsync(m => m.Contract == a.Contract); tmp.dTime = a.dTime; tmp.Price = a.Price; tmp.Confirm = true; DateTime first = DateTime.ParseExact(tmp.cTime, "ddMMyyyy HH:mm:ss.FFFFFFF", System.Globalization.CultureInfo.InvariantCulture); DateTime second = DateTime.ParseExact(tmp.dTime, "ddMMyyyy HH:mm:ss.FFFFFFF", System.Globalization.CultureInfo.InvariantCulture); TimeSpan span = second.Subtract(first); if (span.TotalHours <= 1) { //ok } else { tmp.Contract = _context.appoinment.Max(c => c.Contract) + 1; tmp.Priority = _context.appoinment.Max(c => c.Priority) + 1; } //string[] new_day = Convert.ToString(day).Split(" ")[0].Split("/"); //string new_time = Convert.ToString(hh) + Convert.ToString(MM) + Convert.ToString(ss) + Convert.ToString(FF); await _context.SaveChangesAsync(); AdminModal modal = await GetModal(administrator); return(View("Home", modal)); }
//create a appoinment public Boolean createAppointments(Appoinment appoinment) { //lista.Add(appoinment); APPLICATIONS newAPPLICATIONS = new APPLICATIONS(); //newAPPLICATIONS.doctor_id= appoinment. LinqToSQL.insert2applications(newAPPLICATIONS); return true; }
public IHttpActionResult create(Appoinment appoinment) { try { var result = repository.createAppointments(appoinment); return(Ok(result)); } catch (Exception e) { return(BadRequest()); } }
static void removeappointment() { using (var context = new Context()) { Appoinment hp = new Appoinment(); Console.WriteLine("Enter Appoinment Id"); hp.AppoinmentId = Convert.ToInt32(Console.ReadLine()); context.Appoinments.Remove(hp); context.SaveChanges(); } }
static void appointmentList() { using (var context = new Context()) { Appoinment hp = new Appoinment(); //Console.WriteLine("Enter Hospital Id"); foreach (var item in context.Appoinments.ToList()) { Console.WriteLine($"ID {item.AppoinmentId} - Time {item.Time}-patientId{item.AppoinmentId}-DoctorId{item.DoctorId} "); } } }
/// <summary>to trigger add apoinment method in apoinment service</summary> public void AddAppoinments() { var lstNotAssignedCustomers = _unitOfWork.CustomerService.GetAllNotAssignedCustomers(); Appoinment appoinment = new Appoinment(); foreach (var notAssignedCustomer in lstNotAssignedCustomers) { var lstEmployeeServiceByServiceID = _unitOfWork.employeeService.GetEmployeeServiceByServiceId(notAssignedCustomer.FkServiceId); List <Temp> temps = new List <Temp>(); foreach (var employee in lstEmployeeServiceByServiceID) { var lstAppoinments = _unitOfWork.appoinmentRepository.GetAppoinmentsByEmployeeIdOrCustomerId(employee.FkEmployeeId, notAssignedCustomer.FkCustomerId); Temp tp = new Temp(); tp.FkEmployeeId = employee.FkEmployeeId; tp.Count = lstAppoinments.Count; tp.ServiceSlotId = lstAppoinments.Max(x => x.FkServiceSlotId) ?? 0; temps.Add(tp); } var minQueue = temps.OrderBy(x => x.Count).FirstOrDefault(); appoinment.FkCustomerServiceId = notAssignedCustomer.Id; appoinment.FkCustomerId = notAssignedCustomer.FkCustomerId; appoinment.FkEmployeeId = minQueue.FkEmployeeId; if (minQueue.ServiceSlotId != 0) { if (minQueue.ServiceSlotId != 1) { for (int x = 1; x < minQueue.ServiceSlotId; x++) { if (!_unitOfWork.appoinmentRepository.IsExistAppoinmentByCustomerIdAndServiceSlotId(notAssignedCustomer.FkCustomerId, x)) { minQueue.ServiceSlotId = x - 1; break; } } } } appoinment.FkServiceSlotId = minQueue.ServiceSlotId + 1; while (_unitOfWork.appoinmentRepository.IsExistAppoinmentByEmployeeAndServiceSlot(appoinment.FkEmployeeId, appoinment.FkServiceSlotId)) { appoinment.FkServiceSlotId = appoinment.FkServiceSlotId + 1; } _unitOfWork.appoinmentRepository.addAppoinment(appoinment); _unitOfWork.CustomerService.UpdateAssignedCustomerServices(appoinment.FkCustomerServiceId); _unitOfWork.CommitChanges(); } }
public async Task <IActionResult> Create([Bind("AppoinmentId,StudentId,TeacherId,AppoinmentDate,AppoinmentTime,AppoinmentCoz")] Appoinment appoinment) { if (ModelState.IsValid) { _context.Add(appoinment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["StudentId"] = new SelectList(_context.Student, "StudentId", "StudentId", appoinment.StudentId); ViewData["TeacherId"] = new SelectList(_context.Teacher, "TeacherId", "TeacherId", appoinment.TeacherId); return(View(appoinment)); }
public async Task <HttpResponseMessage> SaveAppointment(Appoinment appoinment) { return(await ValidateAndHandleOperationExecutionAsync(async() => { var result = await _calendarDomainService.SaveAppointment(appoinment); var request = await _requestDomainService.GetRequestByRequestId(appoinment.RequestId); var entitle = await _entitleDomainService.GetEntitleByCurp(request.EntitleId.ToString()); var res = await _requestDomainService.SaveStatusRequestByEntitle(request, true, 202, entitle.CURP); // 340 => Cita agendada return Request.CreateResponse(HttpStatusCode.OK, result); })); }
public int AddAppointment(Appoinment appoinment) { IDbCommand cmd = _unitOfWork.CreateCommand(); cmd.CommandText = "INSERT INTO Appointment VALUES(@doctor,@patient,@unit,@polyclinic,@date,@preemptor,0,0)"; cmd.Parameters.Add(new SqlParameter("@doctor", appoinment.Doctor)); cmd.Parameters.Add(new SqlParameter("@patient", appoinment.Patient)); cmd.Parameters.Add(new SqlParameter("@unit", appoinment.Unit)); cmd.Parameters.Add(new SqlParameter("@polyclinic", appoinment.Polyclinic)); cmd.Parameters.Add(new SqlParameter("@date", appoinment.AppointmentDate)); cmd.Parameters.Add(new SqlParameter("@preemptor", appoinment.Preemptor)); int data = cmd.ExecuteNonQuery(); return(data); }
public int SaveAppoinmentsDA(Appoinment appointment) { DataSet ds = new DataSet(); string query = "exec spI_Appoinments @RequestId '= " + appointment.RequestId + "' , @DelegationId = " + appointment.Delegationid + ", @Date = '" + appointment.Date + "', @Time='" + appointment.Time + "', @IsAttended= " + appointment.IsAttended + " , @IsCancelled = " + appointment.IsCancelled; ds = con.ObtenerConsulta(query); return(Convert.ToInt32(ds.Tables[0].Rows[0].ItemArray[0].ToString())); }
public async Task <int> SaveAppointment(Appoinment appoinment) { try { foreach (var app in _context.Appoinments.Where(r => r.RequestId == appoinment.RequestId)) { app.IsCancelled = true; } _context.Appoinments.AddOrUpdate(appoinment); return(await _context.SaveChangesAsync()); } catch (Exception exception) { throw exception; } }
private void button2_Click(object sender, EventArgs e) { String cusName = textBox1.Text; String cusPhn = textBox2.Text; String email = textBox3.Text; String vehicle = textBox4.Text; // String dtaTime = dateTimePicker1.Value.ToString("yyyy-MM-dd"); Guid UniqueID = Guid.NewGuid(); String id; id = UniqueID.ToString(); Appoinment appoinment = new Appoinment(id, cusName, cusPhn, email, vehicle, dateTimePicker1.Value.ToString()); DatabaseConnection db = new DatabaseConnection(); db.addAppoinment(appoinment); }
private async void Save(object sender, EventArgs e) { var date = datepicker.Date; var time = timepicker.Time; var treatment_plan = treatmentplan.Text; var treatment_done = treatmentdone.Text; var appointment = new Appoinment() { TreatmentId = treatmentId, Date = date, Time = time, TreatmentPlan = treatment_plan, TreatmentDone = treatment_done }; await connection.InsertAsync(appointment); var mainPage = Application.Current.MainPage as MasterDetailPage; await mainPage.Detail.Navigation.PopModalAsync(); }
public async Task <IActionResult> AppDetails(int?id) { if (id == null) { return(NotFound()); } Appoinment a = await _context.appoinment .FirstOrDefaultAsync(b => b.Contract == id); if (a == null) { return(NotFound()); } foreach (Sale sale in sales) { if (sale.email == a.sale) { TempData["name"] = sale.name; } } return(RedirectToAction("Views", "Appoinments", new { id })); }
public Appoinment GetAppoinmentsByIdAD(int appoinmentId) { DataSet ds = new DataSet(); Appoinment ap = new Appoinment(); string query = "exec spS_AppoinmentByID @appoinmentId=" + appoinmentId; ds = con.ObtenerConsulta(query); foreach (DataRow DR in ds.Tables[0].Rows) { ap.AppoinmentId = Guid.Parse(DR["AppoinmentId"].ToString()); ap.Date = Convert.ToDateTime(DR["Date"].ToString()); ap.Delegationid = Convert.ToInt32(DR["DelegationId"].ToString()); ap.IsAttended = Convert.ToBoolean(DR["IsAttended"].ToString()); ap.IsCancelled = Convert.ToBoolean(DR["IsCancelled"].ToString()); ap.RequestId = Guid.Parse(DR["RequestId"].ToString()); ap.Time = TimeSpan.Parse(DR["Capacity"].ToString()); } return(ap); }
private async void UpdateAppointment(object sender, EventArgs e) { var appointment = (sender as Button).BindingContext as Appoinment; var isSheduleNextAppointment = appointment.IsSheduleNextVisit; appointment.IsSheduleNextVisit = false; await connection.UpdateAsync(appointment); if (isSheduleNextAppointment) { var date = appointment.NextAppointmentDate; var time = appointment.NextAppointmentTime; var newAppointment = new Appoinment() { TreatmentId = treatmentId, Date = date, Time = time }; await connection.InsertAsync(newAppointment); } }
public async Task <IActionResult> Confirm(int?id) { if (id == null) { return(NotFound()); } Appoinment a = await _context.appoinment .FirstOrDefaultAsync(b => b.Contract == id); if (a == null) { return(NotFound()); } foreach (Sale sale in sales) { if (sale.email == a.sale) { TempData["name"] = sale.name; break; } } return(View(a)); }
public async Task <IActionResult> PassportInfo(Guid id, [Bind("Id, Cmnd, Day, Place, HKTT, Address")] Appoinment app) { var appoinment = await _context.appoinment.FirstOrDefaultAsync(e => e.Id == id); if (appoinment == null) { return(NotFound()); } appoinment.Cmnd = app.Cmnd; appoinment.Day = app.Day; appoinment.Place = app.Place; appoinment.HKTT = app.HKTT; appoinment.Address = app.Address; _context.Update(appoinment); try { await _context.SaveChangesAsync(); } catch (System.Exception) { return(NotFound()); } return(RedirectToAction(nameof(Dashboard))); }
public IHttpActionResult Add(Appoinment appData) { DataService.Service.AppointmentService.Insert(appData); return(Ok()); }
private void btAddAppointment_Click(object sender, EventArgs e) { Appoinment appoinment = new Appoinment(); appoinment.Date = mcThisMonth.SelectionRange.Start.Date; //DateTime.Now; //new DateTime(2017, 4, 5);//mcThisMonth.SelectionRange.Start.Date; appoinment.Patient = _currentUser; appoinment.Doctor = _doctor; string time = "0"; if (rb1000.Checked == true) { time = "10:00"; } if (rb1020.Checked == true) { time = "10:20"; } if (rb1040.Checked == true) { time = "10:40"; } if (rb1100.Checked == true) { time = "11:00"; } if (rb1200.Checked == true) { time = "12:00"; } using (var client = new HaServiceClient()) { var rooms = client.GetRooms(); List <int> roomNum = rooms.Select(room => room.RoomNumber).ToList(); if (time != "0") { foreach ( var item in client.GetAppoinmentsByDate(mcThisMonth.SelectionRange.Start) .Where(t => t.Time.Equals(time))) { foreach (var room in rooms) { if (room.RoomNumber == item.Room.RoomNumber) { roomNum.Remove(room.RoomNumber); } } } } else { return; } if (roomNum.Count != 0) { appoinment.Room = client.GetRoomByNumber(roomNum.First()); var room = client.GetRoomByNumber(roomNum.First()); appoinment.RecordNumber = 1; appoinment.Time = time; //client.AddAppointment(appoinment); client.AddAppointmentOnContext(_doctor.DoctorId, _currentUser.PatientId, room.RoomId, appoinment); Refresh(); } else { return; } } //appoinment.Room }