Exemple #1
0
        private void simpleButtonRegister_Click(object sender, EventArgs e)
        {
            MemberEnumGender memberGender = (MemberEnumGender)radioGroupGender.Properties.Items[radioGroupGender.SelectedIndex].Value;

            int result = bllMember.MemberRegister(memberGender, textEditSsn.Text, textEditPassword.Text, textEditName.Text, textEditSurname.Text, textEditPhone.Text, textEditMail.Text, dateEditBirthday.DateTime);

            if (result == 1)
            {
                MessageBox.Show("Kaydınız başarıyla tamamlandı.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (result == -1)
            {
                MessageBox.Show("Lütfen yıldızlı alanları eksiksiz doldurunuz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (result == -100)
            {
                MessageBox.Show("Girilen TC sistemde mevcut.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (result == -101)
            {
                MessageBox.Show("Girilen telefon sistemde mevcut.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (result == -102)
            {
                MessageBox.Show("Girilen mail sistemde mevcut.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                MessageBox.Show("Bir şeyler yanlış gitti. Lütfen sistem yöneticinizle görüşünüz.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void simpleButtonUpdateInfo_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Bilgilerinizi güncellemek istediğinize emin misiniz?", "Soru", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                bool?smoke;
                if (radioGroupSmoke.SelectedIndex == 0)
                {
                    smoke = null;
                }
                else if (radioGroupSmoke.SelectedIndex == 1)
                {
                    smoke = true;
                }
                else
                {
                    smoke = false;
                }
                MemberEnumGender memberGender = (MemberEnumGender)radioGroupGender.Properties.Items[radioGroupGender.SelectedIndex].Value;
                int updateResult = bllMember.MemberInfoUpdate(member, textEditName.Text, textEditSurname.Text, memberGender, dateEditBirthday.DateTime, numericUpDownHeight.Value, numericUpDownWeight.Value, smoke, textEditPhone.Text, textEditMail.Text, comboBoxEditCity.Text, comboBoxEditCounty.Text);
                if (updateResult == 1)
                {
                    MessageBox.Show("Güncelleme işlemi başarılı.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (updateResult == -1)
                {
                    MessageBox.Show("Lütfen yıldızlı alanları eksiksiz doldurunuz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (updateResult == -101)
                {
                    MessageBox.Show("Girilen telefon sistemde mevcut.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (updateResult == -102)
                {
                    MessageBox.Show("Girilen mail sistemde mevcut.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Exemple #3
0
        public int MemberRegister(MemberEnumGender gender, string ssn, string password, string name, string surname, string phone, string mail, DateTime birthday)
        {
            int returnValueInt = 0;

            if (!string.IsNullOrEmpty(ssn) && !string.IsNullOrWhiteSpace(ssn) && !string.IsNullOrEmpty(password) && !string.IsNullOrWhiteSpace(password) && !string.IsNullOrEmpty(name) && !string.IsNullOrWhiteSpace(name) && !string.IsNullOrEmpty(surname) && !string.IsNullOrWhiteSpace(surname) && ssn.Length == 11 && birthday != null)
            {
                string tempPhone;
                string tempMail;
                if (string.IsNullOrEmpty(phone.Trim()))
                {
                    tempPhone = null;
                }
                else
                {
                    tempPhone = phone;
                }
                if (string.IsNullOrEmpty(mail.Trim()))
                {
                    tempMail = null;
                }
                else
                {
                    tempMail = mail;
                }
                using (RepositoryMember repositoryMember = new RepositoryMember())
                {
                    if (!repositoryMember.AnyWithExplicitLoad(I => I.Ssn == ssn))
                    {
                        if (!repositoryMember.AnyWithExplicitLoad(I => I.Phone == phone))
                        {
                            if (!repositoryMember.AnyWithExplicitLoad(I => I.Mail == mail))
                            {
                                repositoryMember.CUDOperation(new Member()
                                {
                                    Id       = Guid.NewGuid(),
                                    Ssn      = ssn,
                                    Name     = BLLHelper.TrimName(name),
                                    Surname  = BLLHelper.TrimSurname(surname),
                                    Gender   = gender,
                                    Birthday = birthday,
                                    Phone    = tempPhone,
                                    Mail     = tempMail,
                                    Password = PasswordCrypto.EncryptToSha512(password),
                                    Picture  = BLLHelper.DefaultUserPic()
                                }, EntityState.Added);
                                returnValueInt = repositoryMember.SaveChanges();
                            }
                            else
                            {
                                returnValueInt = -102;
                            }
                        }
                        else
                        {
                            returnValueInt = -101;
                        }
                    }
                    else
                    {
                        returnValueInt = -100;
                    }
                }
            }
            else
            {
                returnValueInt = -1;
            }
            return(returnValueInt);
        }
Exemple #4
0
 public int MemberInfoUpdate(Member member, string name, string surname, MemberEnumGender memberGender, DateTime birthday, decimal height, decimal weight, bool?smoke, string phone, string mail, string city, string county)
 {
     if (!string.IsNullOrEmpty(name) && !string.IsNullOrWhiteSpace(name) && !string.IsNullOrEmpty(surname) && !string.IsNullOrWhiteSpace(surname) && member != null)
     {
         int?   tempHeight;
         double?tempWeight;
         string tempPhone;
         string tempMail;
         string tempCity;
         string tempCounty;
         if (height == 0)
         {
             tempHeight = null;
         }
         else
         {
             tempHeight = (int)height;
         }
         if (weight == 0)
         {
             tempWeight = null;
         }
         else
         {
             tempWeight = (double)weight;
         }
         if (string.IsNullOrEmpty(phone.Trim()))
         {
             tempPhone = null;
         }
         else
         {
             tempPhone = phone;
         }
         if (string.IsNullOrEmpty(mail.Trim()))
         {
             tempMail = null;
         }
         else
         {
             tempMail = mail;
         }
         if (string.IsNullOrEmpty(city.Trim()))
         {
             tempCity = null;
         }
         else
         {
             tempCity = city;
         }
         if (string.IsNullOrEmpty(county.Trim()))
         {
             tempCounty = null;
         }
         else
         {
             tempCounty = county;
         }
         using (RepositoryMember repositoryMember = new RepositoryMember())
         {
             if (!repositoryMember.AnyWithExplicitLoad(I => I.Id != member.Id && I.Phone == phone))
             {
                 if (!repositoryMember.AnyWithExplicitLoad(I => I.Id != member.Id && I.Mail == mail))
                 {
                     member.Name       = name;
                     member.Surname    = surname;
                     member.Gender     = memberGender;
                     member.Birthday   = birthday;
                     member.Height     = tempHeight;
                     member.Weight     = tempWeight;
                     member.DoesSmoke  = smoke;
                     member.Phone      = tempPhone;
                     member.Mail       = tempMail;
                     member.City       = tempCity;
                     member.County     = tempCounty;
                     member.UpdateTime = DateTime.Now;
                     repositoryMember.CUDOperation(member, EntityState.Modified);
                     return(repositoryMember.SaveChanges());
                 }
                 else
                 {
                     return(-102);
                 }
             }
             else
             {
                 return(-101);
             }
         }
     }
     else
     {
         return(-1);
     }
 }