Esempio n. 1
0
        public override string ToString()
        {
            string result = $"Фамилия: {SecondName}\n" +
                            $"Имя: {Name}\n";

            if (Sername != "")
            {
                result += $"Отчество : {Sername}\n";
            }

            result += $"Номер телефона: {telNamber}\n" +
                      $"Страна: {Country}\n";

            if (BirthDay != DateTime.MinValue)
            {
                result += $"День рождения : {BirthDay.ToString("dd MMMM yyyy")}\n";
            }

            if (Organizaition != "")
            {
                result += $"Организация : {Organizaition}\n";
            }

            if (Position != "")
            {
                result += $"Должность : {Position}\n";
            }

            if (Notes != "")
            {
                result += $"Прочие заметки: {Notes}\n";
            }

            return(result);
        }
        public void Validate()
        {
            new AddNotifications <FuncionarioEntity>(this)
            .IfLowerOrEqualsThan(Id, 0, "Id must be greater than zero")
            .IfNullOrEmpty(Name, "Name is obligatory")
            .IfNullOrEmpty(Gender, "Gender is obligatory")
            .IfNullOrEmpty(BirthDay.ToString(), "BirthDay is obligatory")
            .IfNullOrEmpty(Salary.ToString(), "Salary is obligatory")
            .IfNullOrEmpty(Level, "Level is obligatory")
            .IfNullOrEmpty(HiringDate.ToString(), "HiringDate is obligatory")
            .IfLengthGreaterThan(Name, 64, "Name must be a maximum of 64 characters")
            .IfLengthGreaterThan(Gender, 1, "Gender must be a maximum of 1 characters")
            .IfGreaterOrEqualsThan(BirthDay, DateTime.Now, "BirthDay must be smaller than today")
            .IfLowerOrEqualsThan(Salary, 800, "Salary must be greater than R$ 800,00")
            .IfLengthGreaterThan(Level, 1, "Level must be a maximum of 1 characters")
            .IfGreaterThan(HiringDate, DateTime.Now, "HiringDate must be less than or equals today");

            if (!new string[] { "F", "M" }.Contains(Gender))
            {
                AddNotification("Gender", "Gender should be M or F");
            }

            if (!new string[] { "J", "P", "S" }.Contains(Level))
            {
                AddNotification("Level", "Level should be J, P or S");
            }
        }
    protected void txt_IDCode_TextChanged(object sender, EventArgs e)
    {
        DateTime     BirthDay; int Sex;
        TextBox      txt_birthday = UC_DetailView1.FindControl("PM_Promotor_Birthday") != null ? (TextBox)UC_DetailView1.FindControl("PM_Promotor_Birthday") : null;
        DropDownList ddl_sex      = UC_DetailView1.FindControl("PM_Promotor_Sex") != null ? (DropDownList)UC_DetailView1.FindControl("PM_Promotor_Sex") : null;

        if (Tools.DoVerifyIDCode(((TextBox)sender).Text, out BirthDay, out Sex) && ((TextBox)sender).Text.Trim().Length == 18)
        {
            if (txt_birthday != null)
            {
                txt_birthday.Text = BirthDay.ToString("yyyy-MM-dd");
            }
            if (ddl_sex != null)
            {
                ddl_sex.SelectedValue = Sex.ToString();
            }


            if (DateTime.Now < BirthDay.AddYears(16) || DateTime.Now > BirthDay.AddYears(50))
            {
                int year = DateTime.Now.Year - BirthDay.Year;
                if (BirthDay.AddYears(year) > DateTime.Now)
                {
                    year++;
                }
                MessageBox.Show(this, "对不起,该导购年龄不符合规则(16~49岁),该人员年龄:" + year);
                return;
            }
        }
        else
        {
            MessageBox.Show(this, "身份证号码错误!");
            ((TextBox)sender).Text = "";
            if (txt_birthday != null)
            {
                txt_birthday.Text = "";
            }
            if (ddl_sex != null)
            {
                ddl_sex.SelectedValue = "0";
            }
            return;
        }
    }
Esempio n. 4
0
 /// <summary>
 /// Write a vCard to a string
 /// </summary>
 /// <param name="vCardString">An empty string passed by reference</param>
 internal void WriteV2ObjectToString(ref string vCardString)
 {
     vCardString += "BEGIN:VCARD" + Environment.NewLine;
     vCardString += "VERSION:2.1" + Environment.NewLine;
     vCardString += "N:" + Firstname + ";" + Surname + ";" + Othernames + Environment.NewLine;
     vCardString += "FN:" + FormattedName + Environment.NewLine;
     vCardString += "ORG:" + Organization + Environment.NewLine;
     vCardString += "TITLE:" + Title + Environment.NewLine;
     vCardString += "URL:" + URL + Environment.NewLine;
     vCardString += "NICKNAME:" + NickName + Environment.NewLine;
     vCardString += "KIND:" + Kind.ToString().ToUpper() + Environment.NewLine;
     vCardString += "GENDER:" + Gender + Environment.NewLine;
     vCardString += "LANG:" + Language + Environment.NewLine;
     vCardString += "BIRTHPLACE:" + BirthPlace + Environment.NewLine;
     vCardString += "DEATHPLACE:" + DeathPlace + Environment.NewLine;
     vCardString += "TZ:" + TimeZone + Environment.NewLine;
     vCardString += "BDAY:" + BirthDay.Year + BirthDay.ToString("00") + BirthDay.ToString("00");
     foreach (PhoneNumber phoneNumber in PhoneNumbers)
     {
         vCardString += Environment.NewLine;
         if (phoneNumber.Type == PhoneNumberType.None)
         {
             vCardString += "TEL:" + phoneNumber.Number;
         }
         else if (phoneNumber.Type == PhoneNumberType.MainNumber)
         {
             vCardString += "TEL;MAIN-NUMBER:" + phoneNumber.Number;
         }
         else
         {
             vCardString += "TEL;" + phoneNumber.Type.ToString().ToUpper() + ":" + phoneNumber.Number;
         }
     }
     foreach (EmailAddress email in EmailAddresses)
     {
         vCardString += Environment.NewLine;
         if (email.Type == EmailType.None)
         {
             vCardString += "EMAIL:" + email.Email.Address;
         }
         else
         {
             vCardString += "EMAIL;" + email.Type.ToString().ToUpper() + ":" + email.Email.Address;
         }
     }
     foreach (Address address in Addresses)
     {
         vCardString += Environment.NewLine;
         if (address.Type == AddressType.None)
         {
             vCardString += "ADR:" + address.Location;
         }
         else
         {
             vCardString += "ADR;" + address.Type.ToString().ToUpper() + ":" + address.Location;
         }
     }
     foreach (Photo photo in Pictures)
     {
         vCardString += Environment.NewLine;
         vCardString += "PHOTO;" + photo.Encoding;
         if (photo.Type == PhotoType.URL)
         {
             vCardString += ":" + photo.PhotoURL;
         }
         else if (photo.Type == PhotoType.Image)
         {
             vCardString += ";ENCODING=BASE64:" + photo.ToBase64String();
         }
     }
     foreach (Expertise expertise in Expertises)
     {
         vCardString += Environment.NewLine;
         vCardString += "EXPERTISE;LEVEL=" + expertise.Level.ToString().ToLower() + ":" + expertise.Area;
     }
     foreach (Hobby hobby in Hobbies)
     {
         vCardString += Environment.NewLine;
         vCardString += "HOBBY;LEVEL=" + hobby.Level.ToString().ToLower() + ":" + hobby.Activity;
     }
     foreach (Interest interest in Interests)
     {
         vCardString += Environment.NewLine;
         vCardString += "INTEREST;LEVEL=" + interest.Level.ToString().ToLower() + ":" + interest.Activity;
     }
     vCardString += Environment.NewLine;
     vCardString += "END:VCARD";
 }
Esempio n. 5
0
 public string GetAllInfo()
 {
     return($"{FullName} {country} {city} {BirthDay.ToString()} {Group}");
 }
Esempio n. 6
0
 public override string ToString()
 {
     return("Person:\nName: " + Name + "\nBirth Day: " + BirthDay.ToString("d") + "\nGender: " + IsGender() + "\n\n");
 }
Esempio n. 7
0
 public override string ToString()
 {
     return("\n\nPerson:\nName: " + Name + "\nBirth Day: " + BirthDay.ToString("d") + "\nGender: " + IsGender() + "\nSalary: " + Salary + " PLN" + "\nProfession: " + Profession + "\nRoom Number: " + Room.RoomNumber);
 }
 public void CalculateBirthday()
 {
     Age = (int.Parse(DateTime.Now.ToString("yyyyMMdd")) - int.Parse(BirthDay.ToString("yyyyMMdd"))) / 10000;
 }