Exemple #1
0
        private void InsertRecord()
        {
            int      i          = 0;
            string   today_date = DateTime.Now.ToString("MM/dd/yyyy");
            DateTime temp       = DateTime.Now;
            string   due_date   = temp.AddYears(1).ToString("MM/dd/yyyy");

            try
            {
                ApplyPlanBAL ab = new ApplyPlanBAL();
                Users        u  = new Users();
                u.Policyid     = Convert.ToInt32(policyid);
                u.PolicyNumber = policynum;
                u.UserID       = txtid.Text;
                u.Taken_date   = today_date;
                u.Due_Date     = due_date;
                i          = ab.AddPolicy(u);
                txtid.Text = string.Empty;
                if (i == 1)
                {
                    lblack.Text      = "Inserted successfully";
                    lblack.ForeColor = System.Drawing.Color.Green;
                }
            }

            catch (SqlException sqlex)
            {
                if (sqlex.Number == 2601 || sqlex.Number == 2627)
                {
                    lblack.Text      = "Oops ! Policy Number seems to be inserted already";
                    lblack.ForeColor = System.Drawing.Color.Red;
                }
            }
        }
        private void Refine(string type, int age, int dependent)
        {
            u.ProductType  = type;
            u.Eligible     = age;
            u.MaxDependent = dependent;
            /* calls BAL Method */
            rd = ap.ApplyPlan(u);
            rd.Fill(ds);
            StringBuilder table = new StringBuilder();

            try
            {
                if (ds.Tables[0].Rows.Count == 0)
                {
                    lblnote.Text      = "No matches found";
                    lblnote.ForeColor = System.Drawing.Color.Red;
                }
                else
                {
                    table.Append("<h4>Your search results for " + type.ToUpper() + "</h4><label><span style='color:#d35400;'>* Note : Click on policy name to apply for it</span></label>");
                    table.Append("<table class='result-table  table table-bordered table-striped table-condensed table-responsive'>");
                    table.Append("<tr><th>Policy Name</th><th>Plan Name</th><th>Feature</th><th>Benefits</th><th>Benefit Illustration</th><th>Pay Premium</th><th>Eligibility (yr)</th><th>Dependents</th>");
                    table.Append("</tr>");
                    for (int j = 0; j <= ds.Tables[0].Rows.Count - 1; j++)
                    {
                        table.Append("<tr>");
                        table.Append("<td>" + "<a href='preview.aspx?id=" + ds.Tables[0].Rows[j][0] + "' target='_blank' class='goLink' style='color:#000;'>" + ds.Tables[0].Rows[j][2] + "</a>" + "</td>");
                        table.Append("<td>" + ds.Tables[0].Rows[j][1].ToString() + "</td>");
                        table.Append("<td>" + ds.Tables[0].Rows[j][3] + "</td>");
                        table.Append("<td>" + ds.Tables[0].Rows[j][4] + "</td>");
                        table.Append("<td>" + ds.Tables[0].Rows[j][5] + "</td>");
                        table.Append("<td>" + ds.Tables[0].Rows[j][6] + "</td>");
                        table.Append("<td>" + ds.Tables[0].Rows[j][7] + "</td>");
                        table.Append("<td>" + ds.Tables[0].Rows[j][8] + "</td>");
                        table.Append("</tr>");
                    }
                }
                employeeplans.Controls.Add(new Literal {
                    Text = table.ToString()
                });
            }
            catch (Exception ex)
            {
                Console.Write(ex);
            }
            finally
            {
                u  = null;
                ap = null;
                ds.Dispose();
            }
        }
Exemple #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["customerid"] == null)
     {
         Response.Redirect("sessionExpired.htm");
     }
     if (!IsPostBack)
     {
         Users         u        = new Users();
         ApplyPlanBAL  ap       = new ApplyPlanBAL();
         string        policyid = "";
         StringBuilder table    = new StringBuilder();
         DateTime      dateval  = DateTime.Now;
         string        date     = dateval.ToString("MM/dd/yyyy");
         string        duedate  = dateval.AddYears(1).ToString("MM/dd/yyyy");
         txtdate.Text = date;
         string polnum = ap.generatePolicyNumber();
         polnum = "PL/" + polnum;
         string id = Request.QueryString["id"];
         u.Policyid = Convert.ToInt32(id);
         /* Call for BAL method */
         rd = ap.GenerateNominationForm(u);
         rd.Fill(ds);
         try
         {
             for (int j = 0; j <= ds.Tables[0].Rows.Count - 1; j++)
             {
                 table.Append("<tr>");
                 table.Append("<td class='col-lg-3'><b>Policy Number :</b></td><td class='col-lg-3'><b>" + polnum + "</b></td>");
                 table.Append("<td class='col-lg-3'></td><td class='col-lg-3'></td>");
                 table.Append("</tr>");
                 table.Append("<tr>");
                 table.Append("<td class='col-lg-3'><b>Policy ID :</b></td><td class='col-lg-3'>" + ds.Tables[0].Rows[j][1] + "</td>");
                 table.Append("<td class='col-lg-3'><b>Product Type :</b></td><td class='col-lg-3'>" + ds.Tables[0].Rows[j][0].ToString().ToUpper() + "</td>");
                 table.Append("</tr>");
                 table.Append("<tr>");
                 table.Append("<td class='col-lg-3'><b>Plan Name :</b></td><td class='col-lg-3'>" + ds.Tables[0].Rows[j][2].ToString().ToUpper() + "</td>");
                 table.Append("<td class='col-lg-3'><b>Policy Name :</b></td><td class='col-lg-3'>" + ds.Tables[0].Rows[j][3] + "</td>");
                 table.Append("</tr>");
                 table.Append("<tr>");
                 table.Append("<td class='col-lg-3'><b>Policy Feature :</b></td><td class='col-lg-3'>" + ds.Tables[0].Rows[j][4] + "</td>");
                 table.Append("<td class='col-lg-3'><b>Product Benefit :</b></td><td class='col-lg-3'>" + ds.Tables[0].Rows[j][5] + "</td>");
                 table.Append("</tr>");
                 table.Append("<tr>");
                 table.Append("<td class='col-lg-3'><b>Illustration :</b></td><td class='col-lg-3'>" + ds.Tables[0].Rows[j][6] + "</td>");
                 table.Append("<td class='col-lg-3'><b>Premium Payment :</b></td><td class='col-lg-3'>" + ds.Tables[0].Rows[j][7] + "</td>");
                 table.Append("</tr>");
                 table.Append("<tr>");
                 table.Append("<td class='col-lg-3'><b>Eligibilty :</b></td><td class='col-lg-3'>" + ds.Tables[0].Rows[j][8] + "</td>");
                 table.Append("<td class='col-lg-3'><b>Dependents :</b></td><td class='col-lg-3'>" + ds.Tables[0].Rows[j][9] + "</td>");
                 table.Append("</tr>");
                 table.Append("<tr>");
                 table.Append("<td class='col-lg-3'><b>Policy Taken on :</b></td><td class='col-lg-3'>" + date + "</td>");
                 table.Append("<td class='col-lg-3'><b>Policy Due on :</b></td><td class='col-lg-3'>" + duedate + "</td>");
                 table.Append("</tr>");
                 table.Append("</tr>");
             }
             phpolsummary.Controls.Add(new Literal {
                 Text = table.ToString()
             });
             hdpolnum.Value = polnum;
             hdpolid.Value  = id;
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex);
         }
         finally
         {
             rd.Dispose();
             u = null;
         }
     }
 }