public static void appointmentPageViewer(int x) { app = new appointment(x); app.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; app.Show(); MainPage.isAppointmentOpen = true; }
public static string update_app_opd(appointment app) { string query = String.Format("select count(*) from schedule_work_doctor where emp_doc_id = '{0}' AND swd_timezone = '{1}' AND swd_day_work = '{2}' AND swd_date_work = '{3}'", app.emp_doc_id, app.swd_timezone, app.app_day, app.swd_date_work); try { conn.Open(); command.CommandText = query; int count_swd = (int)command.ExecuteScalar(); if (count_swd == 1) { query = String.Format("Update appointment set app_date = '{0}', app_time = '{1}',status_approve = 5 where app_id = {2}", app.app_date, app.app_time, app.app_id); // conn.Open(); command.CommandText = query; command.ExecuteNonQuery(); return("อัพเดตข้อมูลเรียบร้อย"); // return "อัพเดตเรียบร้อย"; } else { return("แพทย์ไม่ได้มาปฏิบัติงาน"); } } finally { conn.Close(); } }
public IHttpActionResult Postappointment(AppointmentViewModel newappointment) { appointment appointment = new appointment() { comments = newappointment.comments, start_time = newappointment.start_time, end_time = newappointment.end_time, first_name = newappointment.first_name, last_name = newappointment.last_name }; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var availability = CheckAvailability(appointment); if (availability != null) { return(availability); } db.appointments.Add(appointment); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = appointment.idappointment }, appointment)); }
// GET: Appointments/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } appointment appointment = db.appointment.Find(id); if (appointment == null) { return(HttpNotFound()); } DateTime today = DateTime.Now; DateTime appday = (DateTime)appointment.time; TimeSpan t = appday - today; int days = t.Days; //before the visit day if (days >= 1) { return(View(appointment)); } else { return(RedirectToAction("Index")); } }
protected void btnnext_Click(object sender, EventArgs e) { string name = "" + Session["staff_name"]; string remark = "" + Session["remark"]; appointment app = appointment.show_app_next_opd(name); if (app != null) { DateTime date = app.date_app; string date_app = date.ToString("yyyy-MM-dd"); int emp_doc_id = app.emp_doc_id; string time = app.app_time; double time_app = Convert.ToDouble(time); // ClientScript.RegisterStartupScript(GetType(), "hwa", "alert('" + time_app + "');", true); appointment_swd app1 = appointment_swd.show_swd_app_doctor_id(date_app, time); if (app1 != null) { int id = app1.emp_doc_id; appointment_swd app3 = new appointment_swd(id, remark, name); appointment_swd.confirm_app(app3); Response.Redirect("../page/appointment.aspx"); // ClientScript.RegisterStartupScript(GetType(), "hwa", "alert('" + id + "');", true); } } }
public static appointment show_app(int status_app, string opd_name) { string query = string.Format("select appointment.app_date,appointment.app_time,appointment.app_remark,employee_doctor.emp_doc_name,opd.opd_name,appointment.status_approve from ((appointment inner join opd On opd.opd_id= appointment.opd_id) inner join employee_doctor on employee_doctor.emp_doc_id = appointment.emp_doc_id) where appointment.status_app = {0} AND opd.opd_name = '{1}'", status_app, opd_name); try { conn.Open(); command.CommandText = query; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { DateTime app_date = reader.GetDateTime(0); string app_time = reader.GetString(1); string app_remark = reader.GetString(2); string employee_doctor = reader.GetString(3); string opd_name1 = reader.GetString(4); int status_approve1 = reader.GetInt32(5); appointment app = new appointment(app_date, app_time, app_remark, employee_doctor, opd_name1, status_approve1, status_app); return(app); } } finally { conn.Close(); } return(null); }
public ActionResult Edit([Bind(Include = "app_id,emp_id,app_date,app_time,app_reason,app_comment,app_child,app_child_first,app_child_last,app_child_dob,app_child_gender")] appointment appointment, FormCollection form) { try { if (ModelState.IsValid) { if (User.IsInRole("Admin") || User.IsInRole("Super Admin")) { appointment.patient_id = Convert.ToInt32(form["patient_id"]); } else { appointment.patient_id = Convert.ToInt32(Session["userId"]); } db.Entry(appointment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.user_name = GetPatientNamesUserIds(); ViewBag.emp_name = GetEmployeeNamesEmpIds(); ViewBag.emp_id = new SelectList(db.employees, "emp_id", "emp_id", appointment.emp_id); return(View(appointment)); } catch (DbUpdateConcurrencyException ex) { ViewBag.Error = ex.GetBaseException().Message; //appointment.patient_id = Convert.ToInt32(Session["userId"]); //ViewBag.emp_name = GetEmployeeNamesEmpIds(); ex.Entries.Single().Reload(); db.SaveChanges(); //return View(appointment); } return(View("Error")); }
public static string update_app_doctor_now(appointment app) { // string query = String.Format("select count(*) from schedule_work_doctor where emp_doc_id = '{0}' AND swd_timezone = '{1}' AND swd_day_work = '{2}' AND swd_date_work = '{3}'", app.emp_doc_id, app.swd_timezone, app.app_day,app.swd_date_work); try { // conn.Open(); // command.CommandText = query; //int count_swd = (int)command.ExecuteScalar(); // if (count_swd == 1) // { string query = String.Format("Update appointment set emp_doc_id = '{0}' , day = '{1}' , app_date = '{2}',app_time = '{3}',status_approve = 2,appointment.swd_id = '{4}' from appointment inner join opd On opd.opd_id = appointment.opd_id where appointment.app_remark = '{5}' AND opd.opd_name = '{6}'", app.emp_doc_id, app.app_day, app.app_date, app.app_time, app.swd_id, app.app_remark, app.opd_name); // conn.Open(); conn.Open(); command.CommandText = query; command.ExecuteNonQuery(); return("เลื่อนนัดหมายเรียบร้อยแล้ว"); // }else // { // return "แพทย์ไม่ได้มาปฏิบัติงาน"; // } } finally { conn.Close(); } }
public static ArrayList sent_app_doctor(int status_app) { ArrayList list = new ArrayList(); string query = string.Format("select appointment.app_date,appointment.app_time,appointment.app_remark,employee_doctor.emp_doc_name,opd.opd_name,appointment.status_approve from ((appointment inner join opd On opd.opd_id= appointment.opd_id) inner join employee_doctor on employee_doctor.emp_doc_id = appointment.emp_doc_id) where appointment.status_approve = '{0}'", status_app); try { conn.Open(); command.CommandText = query; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { string app_date = reader.GetString(0); string app_time = reader.GetString(1); string app_remark = reader.GetString(2); string employee_doctor = reader.GetString(3); string opd_name1 = reader.GetString(4); int status_approve1 = reader.GetInt32(5); appointment app1 = new appointment(app_date, app_time, app_remark, employee_doctor, opd_name1, status_approve1); list.Add(app1); } } finally { conn.Close(); } return(list); }
public static appointment show_app_next_opd(string opd_name) { string query = string.Format("select appointment.app_date,appointment.app_time,appointment.emp_doc_id from appointment inner join opd On opd.opd_id = appointment.opd_id where opd.opd_name = '{0}'", opd_name); try { conn.Open(); command.CommandText = query; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { DateTime date_app = reader.GetDateTime(0); string app_time = reader.GetString(1); int employee_doctor_id = reader.GetInt32(2); appointment app = new appointment(employee_doctor_id, date_app, app_time); return(app); } } finally { conn.Close(); } return(null); }
private void ValidateAppointment(appointment appointment) { if (String.IsNullOrWhiteSpace(appointment.title)) { throw new InvalidInputException("Name is required"); } if (String.IsNullOrWhiteSpace(appointment.description)) { throw new InvalidInputException("Description is required"); } if (String.IsNullOrWhiteSpace(appointment.location)) { throw new InvalidInputException("Location is required"); } if (String.IsNullOrWhiteSpace(appointment.url)) { throw new InvalidInputException("Url is required"); } if (customerService.FindOne(appointment.customerId) == null) { throw new InvalidInputException("A valid customer is required"); } if (String.IsNullOrWhiteSpace(appointment.contact)) { throw new InvalidInputException("Contact is required"); } if (appointment.start < DateTime.Now) { throw new InvalidInputException("Appointment must be a future time"); } if (appointment.end < appointment.start) { throw new InvalidInputException("End time must be greater than start time"); } }
public static void importAppointments(database dbConn, ProgressBar progressBar) { OpenFileDialog open = new OpenFileDialog(); open.Filter = "csv files (*.csv)|*.csv|All files (*.*)|*.*"; if (open.ShowDialog() == DialogResult.OK) { try { StreamReader sr = new StreamReader(open.FileName); setMinMaxPB(progressBar, 0, File.ReadLines(open.FileName).Count()); bool firstRow = true; while (sr.Peek() >= 0) { string line = sr.ReadLine(); if (firstRow != true) { string[] rows = line.Split(','); string title = rows[0]; DateTime schedule = Convert.ToDateTime(rows[1]); int appointmentTypeId = 3; string personId = rows[3]; string personName = rows[4]; string personSurname = rows[5]; string personTel = rows[6]; DateTime created = Convert.ToDateTime(rows[7]); string intermediary = rows[8]; string additionalPersonId = rows[9]; string additionalPersonName = rows[10]; string additionalPersonSurname = rows[11]; string additionalPersonTel = rows[12]; int done = Int32.Parse(rows[13]); int followUp = 0; string comment = rows[15]; appointment a = new appointment(title, schedule, appointmentTypeId, personId, personName, personSurname, personTel, created, intermediary, additionalPersonId, additionalPersonName, additionalPersonSurname, additionalPersonTel, done, followUp, -1); dbConn.SaveAppointment(a); if (comment != "") { dbConn.saveComment(comment, 5, -1); } } firstRow = false; increment(progressBar); } hidePB(progressBar); } catch (IOException e) { MessageBox.Show(e.Message); } } }
public ActionResult DeleteConfirmed(int id) { appointment appointment = db.appointment.Find(id); db.appointment.Remove(appointment); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <ActionResult> DeleteConfirmed(int id) { appointment appointment = await db.appointments.FindAsync(id); db.appointments.Remove(appointment); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public bool commitInsert(appointment newAppointment) { using (objAppointment) { objAppointment.appointments.InsertOnSubmit(newAppointment); objAppointment.SubmitChanges(); return(true); } }
protected void Button1_Click(object sender, EventArgs e) { try { string name = "" + Session["opd_name_app"]; string remark = "" + Session["remark_app"]; appointment app = appointment.show_app_next_opd(name); if (app != null) { DateTime date = app.date_app; string date_app = date.ToString("yyyy-MM-dd"); int emp_doc_id = app.emp_doc_id; string time = app.app_time; double time_app = Convert.ToDouble(time); appointment_swd app1 = appointment_swd.show_swd_app_doctor_id(date_app, time); if (app1 != null) { int id = app1.emp_doc_id; appointment_swd app3 = new appointment_swd(id, remark, name); appointment_swd.confirm_app(app3); Response.Redirect("../page/appointment_management_index.aspx"); } } } catch (Exception) { } /* appointment app = appointment.show_app_next_opd(name); * if (app != null) * { * DateTime date = app.date_app; * string date_app = date.ToString("yyyy-MM-dd"); * int emp_doc_id = app.emp_doc_id; * * string time = app.app_time; * double time_app = Convert.ToDouble(time); * * // ClientScript.RegisterStartupScript(GetType(), "hwa", "alert('" + time_app + "');", true); * appointment_swd app1 = appointment_swd.show_swd_app_doctor_id(date_app, time); * if (app1 != null) * { * int id = app1.emp_doc_id; * * appointment_swd app3 = new appointment_swd(id, remark, name); * appointment_swd.confirm_app(app3); * Response.Redirect("../page/appointment.aspx"); * * // ClientScript.RegisterStartupScript(GetType(), "hwa", "alert('" + id + "');", true); * } * * }*/ }
public ActionResult Appointment(appointment model) { dataaccess_class dac = new dataaccess_class(); int userid = int.Parse(Session["userid"].ToString()); int loginid = int.Parse(Session["loginid"].ToString()); dac.addappointment(model.UserName, model.Timings, model.Slot, model.Description, userid, loginid, int.Parse(Session["docid"].ToString())); return(View()); }
public void Update(appointment appointment) { ValidateAppointment(appointment); appointment.lastUpdate = CommonMethods.ConvertToUtc(DateTime.Now); appointment.lastUpdateBy = _authRepository.Username; appointment.start = CommonMethods.ConvertToUtc(appointment.start); appointment.end = CommonMethods.ConvertToUtc(appointment.end); _repository.Update(appointment, appointment.appointmentId); }
public ActionResult insertIntoDb(appointment appointment) { HttpResponseMessage responseMessage = new HttpResponseMessage(); StringContent content = new StringContent(JsonConvert.SerializeObject(appointment)); var apiCallService = new WebApiCallService <appointment>(); var inserted = apiCallService.ApiPostRequest("Appointments/SetUpAppointment", content, responseMessage).Result; return(RedirectToAction("Index")); }
public AppointmentModel GetById(int id) { appointment entity = this._repository.GetById(id); AppointmentModel model = this.ConvertEntityToModel(entity); model.EmployeeList = (List <EmployeeModelConcise>) this._appointmentEmployeeService.ConvertEntityListToEmployeeModelConciseList(entity.appointment_employee); model.HitchayvutList = (List <HitchayvutModel>) this._appointmentHitchayvutService.ConvertEntityListToHitchayvutModelList(entity.appointment_hitchayvut); model.AppointmentTestList = (List <AppointmentTestModel>) this._appointmentTestService.ConvertEntityListToModelList(entity.appointment_test); return(model); }
public ActionResult Edit([Bind(Include = "appointment_id,inst_id,inst_name,inst_availibility,course_complition_day,hours_per_trip")] appointment appointment) { if (ModelState.IsValid) { db.Entry(appointment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(appointment)); }
public ActionResult DeleteConfirmed(int id) { appointment app = db.appointment.Find(id); var v = db.visit.FirstOrDefault(o => o.date == app.time && o.doctor_id == app.doctor_id); v.number += 1; db.appointment.Remove(app); db.SaveChanges(); return(RedirectToAction("Index")); }
public AddAppointmentViewModel(appointment selectedAppointment) { actions = new AppointmentActions(); PatientSearch = "Insert Patient's Name"; DoctorSearch = "Insert Doctor's Name"; // SelectedDate = DateTime.Parse(selectedAppointment.dateAppointment.ToString()); SelectedDate = DateTime.Today.AddDays(-1); Duration = selectedAppointment.duration.ToString(); }
public void Update(appointment appointment, int id) { var existingAppointment = FindOne(id); if (existingAppointment == null) { return; } _db.Entry(existingAppointment).CurrentValues.SetValues(appointment); _db.SaveChanges(); }
private appointment AdjustTimeZone(appointment appointment) { //If the time hasn't been converted to local time already if (appointment.start.Kind == DateTimeKind.Unspecified || appointment.start.Kind == DateTimeKind.Utc) { appointment.start = TimeZoneInfo.ConvertTime(appointment.start, TimeZoneInfo.Utc, TimeZoneInfo.Local); appointment.end = TimeZoneInfo.ConvertTime(appointment.end, TimeZoneInfo.Utc, TimeZoneInfo.Local); } return(appointment); }
public ActionResult Create([Bind(Include = "appointment_id,inst_id,inst_name,inst_availibility,course_complition_day,hours_per_trip")] appointment appointment) { if (ModelState.IsValid) { db.appointments.Add(appointment); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(appointment)); }
public ActionResult SetEventView(appointment appointment) { //ViewBag.day = day; //ViewBag.month = month; //ViewBag.year = year; //ViewBag.date = day + "-" + month + "-" + year; appointment.userId = Session["loggedInUser"].ToString(); LoginController.context.appointments.Add(appointment); LoginController.context.SaveChanges(); return(View("calenderView")); }
public IHttpActionResult Getappointment(int id) { appointment appointment = db.appointments.Find(id); if (appointment == null) { return(NotFound()); } return(Ok(appointment)); }
public async Task <ActionResult> Edit([Bind(Include = "appointment_id,full_name,phone_number,appointment_date,detail")] appointment appointment) { if (ModelState.IsValid) { db.Entry(appointment).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(appointment)); }
public AddAppointment(appointment a = null, EditAppointment ea = null) { InitializeComponent(); dbConn = new database(); saved_label.Visible = false; error_label.Visible = false; addReminder_check.Checked = false; datePicker.MinDate = DateTime.Now; this.parentApp = a; this.ea = ea; }