示例#1
0
        public override void Load()
        {
            DBInterface.CommandText = "SELECT `people`.`idPeople`, " +
                                      "`people`.`idPerson`, " +
                                      "`people`.`firstName`, " +
                                      "`people`.`middleName`, " +
                                      "`people`.`lastName`, " +
                                      "`people`.`firstNameUA`, " +
                                      "`people`.`middleNameUA`, " +
                                      "`people`.`lastNameUA`, " +
                                      "`people`.`birthDate`, " +
                                      "`people`.`Note`, " +
                                      "`people`.`itn`, " +
                                      "`people`.`gender` " +
                                      "FROM `sellcontroller`.`people` WHERE `idPeople` = @id;";

            DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, PersonID);
            DataTable tab = DBInterface.ExecuteSelection();

            if (tab.Rows.Count == 1)
            {
                FirstName    = Convert.ToString(tab.Rows[0]["firstName"]);
                SecondName   = Convert.ToString(tab.Rows[0]["lastName"]);
                MiddleName   = Convert.ToString(tab.Rows[0]["middleName"]);
                FirstNameUA  = Convert.ToString(tab.Rows[0]["firstNameUA"]);
                SecondNameUA = Convert.ToString(tab.Rows[0]["lastNameUA"]);
                MiddleNameUA = Convert.ToString(tab.Rows[0]["middleNameUA"]);
                itn          = Convert.ToString(tab.Rows[0]["itn"]);
                Birth        = Convert.ToDateTime(tab.Rows[0]["birthDate"]);
                Description  = Convert.ToString(tab.Rows[0]["Note"]);

                if (Convert.ToInt32(tab.Rows[0]["gender"]) == 0)
                {
                    _sex = Sex.male;
                }
                else
                {
                    _sex = Sex.female;
                }
            }
            else if (tab.Rows.Count > 1)
            {
                throw new DuplicateNameException("People table has rows with same id");
            }


            PassportList.Load();
            LoadGeneral();

            Changed = false;
        }
示例#2
0
 public Person()
 {
     PassportList        = new PassportList();
     PassportList.person = this;
 }