protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         PolicyRepository polRepos = new PolicyRepository();
         AppData.Instance.policy.CompanyName = polRepos.GetCompanies();
         AppData.Instance.policy.PolicyType = polRepos.GetPolicyTypes();
         foreach (DataRow row in AppData.Instance.policy.CompanyName.Rows)
         {
             PolicyUC.Company.Items.Add(new ListItem(row["Company"].ToString(), row["Company_ID"].ToString()));
         }
         foreach (DataRow row in AppData.Instance.policy.PolicyType.Rows)
         {
             PolicyUC.PolicyType.Items.Add(new ListItem(row["PolicyType"].ToString(), row["PolicyType_ID"].ToString()));
         }
         PolicyUC.Company.SelectedIndex = AppData.Instance.policy.CompanyID - 1;
         PolicyUC.PolicyType.SelectedIndex = AppData.Instance.policy.PolicyTypeID - 1;
         PolicyUC.Header.Text = string.Format("Policy for {0} {1}", AppData.Instance.customer.FirstName, AppData.Instance.customer.LastName);
         PolicyUC.AgeAtIssue.Text = AppData.Instance.policy.AgeAtIssue;
         PolicyUC.Billing.SelectedValue = AppData.Instance.policy.Billing;
         PolicyUC.Commission.Text = AppData.Instance.policy.CommissionPercentage.ToString();
         PolicyUC.DateEffective.Text = AppData.Instance.policy.DateEffective.ToString("MM/dd/yyyy");
         PolicyUC.DateWritten.Text = AppData.Instance.policy.DateWritten.ToString("MM/dd/yyyy");
         PolicyUC.PolicyHolder.SelectedValue = AppData.Instance.policy.PolicyHolder;
         PolicyUC.PolicyNumber.Text = AppData.Instance.policy.PolicyNumber;
         PolicyUC.PolicyStatus.Text = AppData.Instance.policy.PolicyStatus;
         PolicyUC.Premium.Text = AppData.Instance.policy.Premium.ToString();
         PolicyUC.Renewal.Text = AppData.Instance.policy.Renewal.ToString();
     }
 }
 protected void btYes_Click(object sender, EventArgs e)
 {
     PolicyRepository polRepos = new PolicyRepository();
     lbAnswer.Text = polRepos.AddPolicy(AppData.Instance.policy, AppData.Instance.customer.CustomerID, AppData.Instance.employee.EmployeeID);
     btYes.Visible = false;
     btNo.Visible = false;
     btReturn.Visible = true;
     //Response.Redirect("~/WebPages/Policy/AddPolicy.aspx");
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         PolicyRepository polRepos = new PolicyRepository();
         DataTable dt = polRepos.GetPolicies(AppData.Instance.customer.CustomerID);
         if (dt.Rows.Count == 0)
             Response.Redirect("~/WebPages/Policy/AddPolicy.aspx");
         PolicyView.DataSource = dt;
         PolicyView.DataBind();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         PolicyRepository polRepos = new PolicyRepository();
         AppData.Instance.policy.CompanyName = polRepos.GetCompanies();
         AppData.Instance.policy.PolicyType = polRepos.GetPolicyTypes();
         foreach (DataRow row in AppData.Instance.policy.CompanyName.Rows)
         {
             PolicyUC.Company.Items.Add(new ListItem(row["Company"].ToString(), row["Company_ID"].ToString()));
         }
         foreach (DataRow row in AppData.Instance.policy.PolicyType.Rows)
         {
             PolicyUC.PolicyType.Items.Add(new ListItem(row["PolicyType"].ToString(), row["PolicyType_ID"].ToString()));
         }
         PolicyUC.Header.Text = string.Format("Policy for {0} {1}", AppData.Instance.customer.FirstName, AppData.Instance.customer.LastName);
     }
 }
 protected void btYes_Click(object sender, EventArgs e)
 {
     PolicyRepository polRepos = new PolicyRepository();
     lbAnswer.Text = polRepos.UpdatePolicy(AppData.Instance.policy);
     //Response.Redirect("~/WebPages/Policy/AddPolicy.aspx");
 }