Ejemplo n.º 1
0
        /// <summary>
        /// Binds the data to UI
        /// </summary>
        private void BindData()
        {
            try
            {
                //Declarations
                DBUtility dbUtility = new DBUtility();
                Person person;
                String[] phone;
                String tableName, dataBaseName;

                //Get the table name and datatbase name from the configuration file
                tableName = Configurations.TableName;
                dataBaseName = Configurations.DatabaseName;

                drpMonth.CssClass = "input-success";

                //Bind the days
                drpDay.DataSource = Utility.GetTableData(1, 31);
                drpDay.DataBind();
                drpDay.CssClass = "input-success";

                //Bind the years
                drpYear.DataSource = Utility.GetTableData(1900, 1996);
                drpYear.DataBind();
                drpYear.CssClass = "input-success";

                //Get the person data
                person = dbUtility.getData(dataBaseName, tableName, lblName.Text);

                //Check if the person has a data or it has been configured not to display the PII
                if (person == null || !Configurations.DisplayPII)
                    return;

                //Set the birth dates
                drpMonth.SelectedValue = person.MonthOfBirth;
                drpMonth.CssClass = "input-success";
                drpDay.SelectedValue = person.DayOfBirth;
                drpDay.CssClass = "input-success";
                drpYear.SelectedValue = person.YearOfBirth;
                drpYear.CssClass = "input-success";

                //Bind the personal information
                txtName.Text = person.FullName;
                txtName.CssClass = "input-success";
                txtCity.Text = person.City;
                txtCity.CssClass = "input-success";
                txtEmail.Text = person.EmailAddress;
                txtEmail.CssClass = "input-success";
                txtSpouse.Text = person.SpouseName;
                txtSpouse.CssClass = "input-success";
                txtState.Text = person.State;
                txtState.CssClass = "input-success";
                txtStreet.Text = person.StreetAddress;
                txtStreet.CssClass = "input-success";
                txtZip.Text = person.Zip;
                txtZip.CssClass = "input-success";

                txtCurrentEmployer.Text = Utility.AppendWithComma(person.CurrentEmployers);
                txtCurrentEmployer.CssClass = "input-success";
                txtPastEmployer.Text = Utility.AppendWithComma(person.PastEmployers);
                txtPastEmployer.CssClass = "input-success";
                txtChildren.Text = Utility.AppendWithComma(person.Children);
                txtChildren.CssClass = "input-success";
                txtGrandChildren.Text = Utility.AppendWithComma(person.GrandChildren);
                txtGrandChildren.CssClass = "input-success";

                //Populate the phone
                phone = person.PhoneNumber.Split(new Char[] { '-' });
                txtPhone1.Text = phone[0];
                txtPhone1.CssClass = "input-success";
                txtPhone2.Text = phone[1];
                txtPhone2.CssClass = "input-success";
                txtPhone3.Text = phone[2];
                txtPhone3.CssClass = "input-success";

                lblUpdatedOn.Text = "Last updated on: " + person.LastUpdatedOn ;
            }
            catch (Exception ex)
            {
                Logger.Log("BindData: " + ex.Message);
            }
        }
        /// <summary>
        /// Binds the data to the grid view
        /// </summary>
        private void BindData()
        {
            try
            {
                //Declarations
                DBUtility dbUtility = new DBUtility();
                String dbName = Configurations.DatabaseName;
                String tableName = Configurations.Websites;
                List<Website> websites;

                //Bind the grid view
                grdWebsites.DataSource = dbUtility.getData(dbName, tableName, out websites);
                grdWebsites.DataBind();

                //Add the list to session
                Session.Add("Websites", websites ?? new List<Website>());
            }
            catch (Exception ex)
            {
                Logger.Log("BindData: " + ex.Message);
            }
        }