Example #1
0
        private void btnEkle_Click(object sender, EventArgs e)
        {
            CariKayitManager cm = new CariKayitManager();

            try
            {
                Clear();
                txtCariKodu.Text = cm.EnSonCariKoduGetir();
            }
            catch (MyNotImplementedException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyDbEntityValidationException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyArgumentNullException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyArgumentException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyInvalidOperationException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyNullReferenceException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyAggregateException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyFormatException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (NullDataOnDatabaseCustomException)
            {
                throw new NullDataOnDatabaseCustomException();
            }
            catch (NotModifiedDataOnDatabaseCustomException)
            {
                throw new NotModifiedDataOnDatabaseCustomException();
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                cm = null;
            }
        }
Example #2
0
 public void TestMethod1()
 {
     try
     {
         //throw new DirectoryNotFoundException();
         //SirketKayitManager sk = new SirketKayitManager();
         //sk.SirketKayitEkle(new SirketKayitTumDTO()
         //{
         //    Muhasebeci = "ewrgerw"
         //});
         CariKayitManager cm   = new CariKayitManager();
         CariKayitTumDTO  c    = new CariKayitTumDTO();
         string           temp = cm.EnSonCariKoduGetir();
     }
     catch (MyNotImplementedException error)
     {
         foreach (DictionaryEntry item in error.Data)
         {
         }
         string temp = error.Message;
         throw new DirectoryNotFoundException(error.Message);
     }
     catch (DirectoryNotFoundException error)
     {
         throw new DirectoryNotFoundException(error.Message);
     }
     catch (IOException error)
     {
         throw new IOException(error.Message);
     }
     catch (ArgumentNullException error)
     {
         string temp = error.GetType().ToString();
         throw new ArgumentNullException(error.Message);
     }
     catch (DbEntityValidationException)
     {
         throw new DbEntityValidationException();
     }
     catch (Exception error)
     {
         string temp = error.GetType().ToString();
         throw new Exception(error.Message);
     }
 }
Example #3
0
        private void btnKaydet_Click(object sender, EventArgs e)
        {
            CariKayitManager cm = new CariKayitManager();

            try
            {
                string img     = String.Empty;
                string cariKod = String.Empty;
                if (openFileDialog1.FileName != String.Empty)
                {
                    Guid     guid        = Guid.NewGuid();
                    string   name        = openFileDialog1.SafeFileName;
                    FileInfo info        = new FileInfo(openFileDialog1.FileName);
                    string   suffix      = (guid.ToString()).Replace("-", "");
                    string   code        = suffix.Substring(0, 5);
                    string   folder      = Properties.Settings.Default.CariKlasorAdi;
                    string   imageFolder = Properties.Settings.Default.ResimKlasorYolu;
                    if (Directory.Exists(imageFolder + @"\" + folder) == false)
                    {
                        Directory.CreateDirectory(imageFolder + @"\" + folder);
                    }
                    if (File.Exists(imageFolder + @"\" + folder + @"\" + name + "_" + code + info.Extension) == false)
                    {
                        File.Create(imageFolder + @"\" + folder + @"\" + name + "_" + code + info.Extension).Close();
                    }
                    img = name + "_" + code + info.Extension;
                }
                if (txtCariKodu.Text == String.Empty)
                {
                    cariKod = cm.EnSonCariKoduGetir();
                }
                bool result = cm.CariKayitEkle(new CariKayitTumDTO()
                {
                });
                if (result == true)
                {
                    MessageBox.Show("Kayıt İşlemi Başarılı Olmuştur", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("İşlem Başarısız Olmuştur", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (FileNotFoundException)
            {
                MessageBox.Show(new MyFileNotFoundException().Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (DirectoryNotFoundException)
            {
                MessageBox.Show(new MyDirectoryNotFoundException().Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (PathTooLongException)
            {
                MessageBox.Show(new MyPathTooLongException().Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (IOException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyNotImplementedException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyDbEntityValidationException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyArgumentNullException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyArgumentException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyInvalidOperationException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyNullReferenceException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyAggregateException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyFormatException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (NullDataOnDatabaseCustomException)
            {
                throw new NullDataOnDatabaseCustomException();
            }
            catch (NotModifiedDataOnDatabaseCustomException)
            {
                throw new NotModifiedDataOnDatabaseCustomException();
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                cm = null;
            }
        }
Example #4
0
        private void btnSil_Click(object sender, EventArgs e)
        {
            CariKayitManager cm = new CariKayitManager();

            try
            {
                int  id     = Convert.ToInt32(btnSil.Tag);
                bool result = cm.CariKayitSil(id);
                if (result == true)
                {
                    MessageBox.Show("Silme İşlemi Başarılı Olmuştur", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("İşlem Başarısız Olmuştur", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (MyNotImplementedException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyDbEntityValidationException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyArgumentNullException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyArgumentException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyInvalidOperationException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyNullReferenceException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyAggregateException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (MyFormatException error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (NullDataOnDatabaseCustomException)
            {
                throw new NullDataOnDatabaseCustomException();
            }
            catch (NotModifiedDataOnDatabaseCustomException)
            {
                throw new NotModifiedDataOnDatabaseCustomException();
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message, "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                cm = null;
            }
        }