public void Reset()
        {
            var doctorsProceduresState = new DoctorsProceduresState
            {
                SelectedDoctorsIndex = new[] { "0" },
                SelectedProcedures   = new[] { "" }
            };

            ViewState["DoctorsProceduresState"] = doctorsProceduresState;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var formHandlerServiceClient = Utilities.GetConsentFormSvcClient();
                if (!IsPostBack)
                {
                    var procedures = new List<string>();

                    if (!IsStaticTextBoxForPrecedures)
                    {
                        procedures.AddRange(from DataRow row in formHandlerServiceClient.GetProcedures(consentType).Rows select row["CFName"].ToString());
                        if (consentType != ConsentType.Endoscopy)
                            procedures.Add("Other");
                    }

                    ViewState["ListOfProcedures"] = procedures;

                    var primaryDoctors = new List<PrimaryDoctor> { new PrimaryDoctor() { Id = 0, Name = "----Select Primary Doctor----" } };
                    var physicians = formHandlerServiceClient.GetDoctorDetails();
                    if (physicians != null)
                    {
                        primaryDoctors.AddRange(physicians.Select(doctorDetails => new PrimaryDoctor { Name = doctorDetails.Lname + ", " + doctorDetails.Fname, Id = doctorDetails.ID }));
                    }

                    ViewState["PrimaryDoctors"] = primaryDoctors;

                    var doctorsProceduresState = new DoctorsProceduresState
                    {
                        SelectedDoctorsIndex = new[] { "0" },
                        SelectedProcedures = new[] { "" },
                        OtherProcedures = new[] { "" }
                    };
                    ViewState["DoctorsProceduresState"] = doctorsProceduresState;

                    string patientId = string.Empty;
                    try
                    {
                        patientId = Session["PatientID"].ToString();
                    }
                    catch (Exception)
                    {
                        Response.Redirect("/PatientConsent.aspx");
                    }

                    LblPatientName.Text = Utilities.GetPatientName(patientId, consentType.ToString(), Session["Location"].ToString()).name;
                }
                else
                {
                    var doctorsProceduresState = new DoctorsProceduresState
                                                     {
                                                         SelectedDoctorsIndex = Request.Form["DdlPrimaryDoctors"].Split(','),
                                                         SelectedProcedures =
                                                             IsStaticTextBoxForPrecedures
                                                                 ? Request.Form["TxtProcedures"].Split(',')
                                                                 : Request.Form["HdnSelectedProcedures"].Split(','),
                                                         OtherProcedures = Request.Form["TxtOtherProcedure"] != null ? Request.Form["TxtOtherProcedure"].Split(',') : new string[] { "" }
                                                     };
                    ViewState["DoctorsProceduresState"] = doctorsProceduresState;
                }
            }
            catch (Exception ex)
            {
                var client = Utilities.GetConsentFormSvcClient();
                client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(),
                                 ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
 public void Reset()
 {
     var doctorsProceduresState = new DoctorsProceduresState
     {
         SelectedDoctorsIndex = new[] { "0" },
         SelectedProcedures = new[] { "" }
     };
     ViewState["DoctorsProceduresState"] = doctorsProceduresState;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var formHandlerServiceClient = Utilities.GetConsentFormSvcClient();
                if (!IsPostBack)
                {
                    var procedures = new List <string>();

                    if (!IsStaticTextBoxForPrecedures)
                    {
                        procedures.AddRange(from DataRow row in formHandlerServiceClient.GetProcedures(consentType).Rows select row["CFName"].ToString());
                        if (consentType != ConsentType.Endoscopy)
                        {
                            procedures.Add("Other");
                        }
                    }

                    ViewState["ListOfProcedures"] = procedures;

                    var primaryDoctors = new List <PrimaryDoctor> {
                        new PrimaryDoctor()
                        {
                            Id = 0, Name = "----Select Primary Doctor----"
                        }
                    };
                    var physicians = formHandlerServiceClient.GetDoctorDetails();
                    if (physicians != null)
                    {
                        primaryDoctors.AddRange(physicians.Select(doctorDetails => new PrimaryDoctor {
                            Name = doctorDetails.Lname + ", " + doctorDetails.Fname, Id = doctorDetails.ID
                        }));
                    }

                    ViewState["PrimaryDoctors"] = primaryDoctors;

                    var doctorsProceduresState = new DoctorsProceduresState
                    {
                        SelectedDoctorsIndex = new[] { "0" },
                        SelectedProcedures   = new[] { "" },
                        OtherProcedures      = new[] { "" }
                    };
                    ViewState["DoctorsProceduresState"] = doctorsProceduresState;

                    string patientId = string.Empty;
                    try
                    {
                        patientId = Session["PatientID"].ToString();
                    }
                    catch (Exception)
                    {
                        Response.Redirect("/PatientConsent.aspx");
                    }

                    LblPatientName.Text = Utilities.GetPatientName(patientId, consentType.ToString(), Session["Location"].ToString()).name;
                }
                else
                {
                    var doctorsProceduresState = new DoctorsProceduresState
                    {
                        SelectedDoctorsIndex = Request.Form["DdlPrimaryDoctors"].Split(','),
                        SelectedProcedures   =
                            IsStaticTextBoxForPrecedures
                                                                 ? Request.Form["TxtProcedures"].Split(',')
                                                                 : Request.Form["HdnSelectedProcedures"].Split(','),
                        OtherProcedures = Request.Form["TxtOtherProcedure"] != null ? Request.Form["TxtOtherProcedure"].Split(',') : new string[] { "" }
                    };
                    ViewState["DoctorsProceduresState"] = doctorsProceduresState;
                }
            }
            catch (Exception ex)
            {
                var client = Utilities.GetConsentFormSvcClient();
                client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(),
                                 ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }