protected void Button1_Click(object sender, EventArgs e) { AppointmentDBEntities1 dbcon = new AppointmentDBEntities1(); int hour = Convert.ToInt32(HourBox.Text); int min = Convert.ToInt32(MinuteBox.Text); AppointmentTable myAppointment = new AppointmentTable(); DoctorTable doctorTable = new DoctorTable(); // add data to the myAppointment myAppointment.Reason = ReasonBox.Text; myAppointment.AppDate = Convert.ToDateTime(DateBox.Text); myAppointment.AppTime = new TimeSpan(hour, min, 0); // add myAppointment to the table dbcon.AppointmentTables.Add(myAppointment); dbcon.SaveChanges(); // clear UsernameBox.Text = ""; DoctorBox.Text = ""; DateBox.Text = ""; HourBox.Text = ""; MinuteBox.Text = ""; ReasonBox.Text = ""; }
public void NewBDcon() { dbcon.StudentTables.Load(); if (dbcon != null) { dbcon.Dispose(); dbcon = new AppointmentDBEntities1(); } }
protected string check_role() { string userName = User.Identity.Name; AppointmentDBEntities1 dbconTemp = new AppointmentDBEntities1(); UserTable credentials = dbconTemp.UserTables.Find(userName); /*if(credentials.UserRole != "student") * Response.Redirect(ResolveUrl("default.aspx"));*/ return(credentials.UserRole); }
protected void Button1_Click(object sender, EventArgs e) { AppointmentDBEntities1 dbcon = new AppointmentDBEntities1(); dbcon.AppointmentTables.Load(); // select item to delete AppointmentTable abc = (from x in dbcon.AppointmentTables.Local where x.AppointmentId == Convert.ToInt32(RemoveBox.Text) select x).First(); // delete obj dbcon.AppointmentTables.Remove(abc); dbcon.SaveChanges(); }
protected void Button1_Click(object sender, EventArgs e) { AppointmentDBEntities1 dbcon = new AppointmentDBEntities1(); EmailTable email = new EmailTable(); email.EmailText = messageTextBox.Text; email.TO = toTextBox.Text; email.FROM = "username"; dbcon.EmailTables.Add(email); dbcon.SaveChanges(); messageTextBox.Text = ""; toTextBox.Text = ""; sentLabel.Text = "Message Sent Successfully"; sentLabel.Visible = true; }