protected void Add_Appointment(object sender, EventArgs e) { AddNewAppointmentrequest objAddAppointment = new AddNewAppointmentrequest(); AppointmentSheduling objAppointment = new AppointmentSheduling(); DateTime datetime; objAppointment.Date = DateTime.TryParse(txtFromDate.Text, out datetime) ? (DateTime?)datetime : null;; objAppointment.Timein = DateTime.TryParse(txtFromDate1.Text, out datetime) ? (DateTime?)datetime : null;; objAppointment.Timeout = DateTime.TryParse(txtFromDate2.Text, out datetime) ? (DateTime?)datetime : null;; objAppointment.Department = txtDepartment.Text; objAppointment.Username = txtName.Text; objAppointment.UserID = txtID.Text; AdminBLL ws = new AdminBLL(); ws.AddAppointment(objAppointment); HttpContext.Current.Items.Add("COMPLETE", "INSERT"); Server.Transfer("..//SMSADMIN//AddNewUserComplete.aspx"); }