Beispiel #1
0
        void KayitSil()
        {
            DialogResult re = MessageBox.Show("Kayıt Silinsin mi?", "Dikkat", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (re == DialogResult.Yes)
            {
                try {
                    Sube sube = managerSube.GetById(txtSubeKodu.Text, true);
                    if (!UserInfo.Kullanici.Adminmi.Value)
                    {
                        MessageBox.Show("Sadece admin kullanıcı şube silebilir");
                        return;
                    }
                    if (sube != null && UserInfo.Sube.Id == sube.Id)
                    {
                        MessageBox.Show("Bulunduğunuz şubeyi silemezsiniz");
                        return;
                    }
                    managerSube.BeginTransaction();
                    managerSube.Delete(sube);
                    LoadAllSube();
                    btnYeni_Click(this, EventArgs.Empty);
                } catch (Exception exc) {
                    MessageBox.Show(exc.Message);
                    LogWrite.Write(exc);
                } finally {
                    try {
                        managerSube.CommitChanges();
                    } catch (Exception exc) {
                        LogWrite.Write(exc);
                        MessageBox.Show(exc.Message);
                    }
                }
            }
        }
Beispiel #2
0
        void Kaydet()
        {
            Sube sube = new Sube();

            //AssignSubeValue(sube);
            try
            {
                sube = managerSube.GetById(txtSubeKodu.Text, false);
                if (sube == null)
                {
                    sube = new Sube();
                }
                AssignSubeValue(sube);
                sube.Id = txtSubeKodu.Text;
                BeginTransaction();
                managerSube.SaveOrUpdate(sube);

                LoadAllSube();
                YeniKayit();
            }
            catch (Exception)
            {
            } finally {
                try {
                    CommitTransaction();
                } catch (Exception exc) {
                    LogWrite.Write(exc);
                    MessageBox.Show(exc.Message);
                }
            }
        }
Beispiel #3
0
        public void UpdateSube(Sube model)
        {
            Sube sube = repository.Find(x => x.Id == model.Id);

            sube.isim = model.isim;

            repository.Update();
        }
Beispiel #4
0
 void AssignSubeValue(Sube sube)
 {
     sube.SubeIsmi     = txtSubeIsmi.Text;
     sube.Adres        = txtAdres.Text;
     sube.VergiNo      = txtVergiNo.Text;
     sube.VergiDairesi = txtVergiDairesi.Text;
     sube.Aktif        = chkAktif.Checked ? true : false;
     sube.Merkezmi     = chkMerkez.Checked ? true : false;
 }
Beispiel #5
0
        public void UpdateDepartman(Departman model, int dropSube)
        {
            Departman departman = repository.Find(x => x.Id == model.Id);
            Sube      sube      = repositorySube.Find(x => x.Id == dropSube);

            departman.isim = model.isim;
            departman.Sube = sube;
            repository.Update();
        }
        public static bool Sil(Sube nesne)
        {
            SqlCommand sil = new SqlCommand("SubeSil", Tools.Baglanti);

            sil.CommandType = CommandType.StoredProcedure;
            sil.Parameters.AddWithValue("@SubeID", nesne.SubeID);

            return(Tools.ExecuteNonQuery(sil));
        }
Beispiel #7
0
        private void button2_Click(object sender, EventArgs e)
        {
            Sube sil = new Sube();

            sil.SubeID = (int)textBox1.Tag;
            if (!Subeler.Sil(sil))
            {
                MessageBox.Show("Veri Silinemedi..");
            }
            dataGridView1.DataSource = Subeler.Listele();
        }
Beispiel #8
0
        public void UpdateEkip(Ekip model, int subedrop, int departmandrop)
        {
            Sube      sube      = repositorySube.Find(x => x.Id == subedrop);
            Departman departman = repositoryDepartman.Find(x => x.Id == departmandrop);

            Ekip ekip = repository.Find(x => x.Id == model.Id);

            ekip.isim      = model.isim;
            ekip.Sube      = sube;
            ekip.Departman = departman;
            repository.Update();
        }
        public static bool Yenile(Sube nesne)
        {
            SqlCommand kaydet = new SqlCommand("SubeYenile", Tools.Baglanti);

            kaydet.CommandType = CommandType.StoredProcedure;
            kaydet.Parameters.AddWithValue("@SubeID", nesne.SubeID);
            kaydet.Parameters.AddWithValue("@SubeAdi", nesne.SubeAdi);
            kaydet.Parameters.AddWithValue("@SubeIl", nesne.SubeIl);
            kaydet.Parameters.AddWithValue("@SubeIlce", nesne.SubeIlce);
            kaydet.Parameters.AddWithValue("@TeslimDurumu", nesne.TeslimDurumu);
            return(Tools.ExecuteNonQuery(kaydet));
        }
        public void SetOgretmenPropInConst()
        {
            //Arrange
            Ders     ders     = new Ders("Test Ders");
            Sube     sube     = new Sube("Test Sube");
            Ogretmen ogretmen = new Ogretmen("Test Ogretmen");
            //Act
            Egitim egitim = new Egitim(ders, ogretmen, sube);

            // Assert
            Assert.AreEqual(ogretmen, egitim.Ogretmen);
        }
Beispiel #11
0
        public void AddDepartman(Departman model, int Id)
        {
            Sube sube = repositorySube.Find(x => x.Id == Id);

            Departman departman = new Departman()
            {
                isim = model.isim,
                Sube = sube,
            };

            sube.Departmens.Add(departman);
            repository.Insert(departman);
        }
Beispiel #12
0
        public int DeleteSube(int?Id)
        {
            Sube sube = repository.Find(x => x.Id == Id);

            if (sube.Departmens.Count() != 0 || sube.Ekips.Count() != 0 || sube.Kisis.Count() != 0)
            {
                return(0);
            }
            else
            {
                repository.Delete(sube);
                return(1);
            }
        }
Beispiel #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            Sube ekle = new Sube();

            ekle.SubeAdi      = textBox1.Text;
            ekle.SubeIl       = textBox2.Text;
            ekle.SubeIlce     = textBox3.Text;
            ekle.TeslimDurumu = textBox4.Text;
            if (!Subeler.Ekle(ekle))
            {
                MessageBox.Show("Veriler Eklenmedi....");
            }
            dataGridView1.DataSource = Subeler.Listele();
        }
Beispiel #14
0
        public void AddEkip(Ekip model, int subedrop, int departmandrop)
        {
            Sube      sube      = repositorySube.Find(x => x.Id == subedrop);
            Departman departman = repositoryDepartman.Find(x => x.Id == departmandrop);
            Ekip      ekip      = new Ekip()
            {
                isim      = model.isim,
                Departman = departman,
                Sube      = sube
            };

            sube.Ekips.Add(ekip);
            departman.Ekips.Add(ekip);
            repository.Insert(ekip);
        }
Beispiel #15
0
        private void button3_Click(object sender, EventArgs e)
        {
            Sube yenile = new Sube();

            yenile.SubeID       = (int)textBox1.Tag;
            yenile.SubeAdi      = textBox1.Text;
            yenile.SubeIl       = textBox2.Text;
            yenile.SubeIlce     = textBox3.Text;
            yenile.TeslimDurumu = textBox4.Text;
            if (!Subeler.Yenile(yenile))
            {
                MessageBox.Show("Veriler Güncellenemedi....");
            }
            dataGridView1.DataSource = Subeler.Listele();
        }
Beispiel #16
0
 private void btnDuzelt_Click(object sender, EventArgs e)
 {
     try
     {
         Sube sube = managerSube.GetById(txtSubeKodu.Text, true);
         AssignSubeValue(sube);
         managerSube.SaveOrUpdate(sube);
         managerSube.CommitChanges();
         LoadAllSube();
     }
     catch (Exception exc)
     {
         LogWrite.Write(exc);
         MessageBox.Show(exc.Message);
     }
 }
Beispiel #17
0
        public void UpdateKisi(Kisi model, int subedrop, int departmandrop, int ekipdrop)
        {
            Sube      sube      = repositorySube.Find(x => x.Id == subedrop);
            Departman departman = repositoryDepartman.Find(x => x.Id == departmandrop);
            Ekip      ekip      = repositoryEkip.Find(x => x.Id == ekipdrop);
            Kisi      kisi      = repositoryKisi.Find(x => x.Id == model.Id);

            kisi.isim        = model.isim;
            kisi.soyisim     = model.soyisim;
            kisi.Statu       = model.Statu;
            kisi.Sube        = sube;
            kisi.dogumTarihi = model.dogumTarihi;
            kisi.Departman   = departman;
            kisi.Ekip        = ekip;
            kisi.maas        = model.maas;
            repositoryKisi.Update();
        }
Beispiel #18
0
        public List <Sube> Filter([FromBody] Sube entity)
        {
            Expression <Func <Sube, bool> > predicate = PredicateBuilder.New <Sube>(true);

            if (entity.Ad != null)
            {
                predicate = predicate.And(x => x.Ad == entity.Ad);
            }
            if (entity.Il != null)
            {
                predicate = predicate.And(x => x.Il == entity.Il);
            }
            if (entity.Ilce != null)
            {
                predicate = predicate.And(x => x.Ilce == entity.Ilce);
            }

            return(_subeRepo.Filter(predicate));
        }
        public List <KodIsim> StokKods(string stokKodIsim, Sube sube)
        {
            //ICriteria criteria = Session.CreateCriteria(typeof(Stok)).SetProjection(Projections.Property("Id"))
            //                     .Add(Expression.Like("Id", stokKod, MatchMode.Start)).SetMaxResults(GetMaxResult);
            //ICriteria subeCriteria = criteria.CreateCriteria("Sube");
            //subeCriteria.Add(NHibernate.Criterion.Expression.Eq("Id", sube.Id));
            //return criteria.List<string>() as List<string>;
            //IQuery query = Session.CreateQuery("select st.Id from Stok st where st.Sube=:sube and st.Id like :st").SetString("st", stokKod + "%").SetEntity("sube", sube).SetMaxResults(10);
            //return (List<string>)query.List<string>();
            KodIsim kodIsim = null;

            return(Session.QueryOver <Stok>().Where(x => (x.Sube == sube || x.SubelerdeOrtak == true) &&
                                                    (x.Id.IsLike(stokKodIsim, MatchMode.Anywhere) || x.StokAdi.IsLike(stokKodIsim, MatchMode.Anywhere)))
                   .SelectList(liste =>
                               liste.SelectGroup(c => c.Id).WithAlias(() => kodIsim.Kod)
                               .SelectGroup(c => c.StokAdi).WithAlias(() => kodIsim.Isim)

                               ).TransformUsing(Transformers.AliasToBean <KodIsim>())
                   .Take(GetMaxResult).List <KodIsim>() as List <KodIsim>);
        }
Beispiel #20
0
 protected override void GuncelNesneOlustur()
 {
     currentEnttiy = new Sube
     {
         Id          = id,
         Kod         = txtKod.Text,
         SubeAdi     = txtSubeAdi.Text,
         GrupAdi     = txtGrupAdi.Text,
         SiraNo      = (int)txtSiraNo.Value,
         IbanNo      = txtIbanNo.Text,
         Telefon     = txtTelefon.Text,
         Fax         = txtFax.Text,
         Adres       = txtAdres.Text,
         AdresIlId   = Convert.ToInt64(txtAdresIl.Id),
         AdresIlceId = Convert.ToInt64(txtAdresIlce.Id),
         Logo        = (byte[])imgLogo.EditValue,
         Durum       = tglDurum.IsOn
     };
     ButonEnabledDurumu();
 }
Beispiel #21
0
        public List <Sube> SubeListe()
        {
            List <Sube>  liste      = new List <Sube>();
            DbConnection connection = GetConnection();

            connection.Open();
            DbCommand cmd = connection.CreateCommand();

            cmd.CommandText = "select SUBE_KODU from  Sube";
            cmd.Connection  = connection;
            DbDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                Sube sube = new Sube {
                    Id = Convert.ToString(dr[0])
                };
                liste.Add(sube);
            }
            return(liste);
        }
Beispiel #22
0
        public void AddKisi(Kisi model, int subedrop, int departmandrop, int ekipdrop)
        {
            Sube      sube      = repositorySube.Find(x => x.Id == subedrop);
            Departman departman = repositoryDepartman.Find(x => x.Id == departmandrop);
            Ekip      ekip      = repositoryEkip.Find(x => x.Id == ekipdrop);
            Kisi      kisi      = new Kisi()
            {
                isim        = model.isim,
                soyisim     = model.soyisim,
                maas        = model.maas,
                dogumTarihi = model.dogumTarihi,
                Statu       = model.Statu,
                Sube        = sube,
                Departman   = departman,
                Ekip        = ekip
            };

            sube.Kisis.Add(kisi);
            departman.Kisis.Add(kisi);
            ekip.Kisis.Add(kisi);
            repositoryKisi.Insert(kisi);
        }
Beispiel #23
0
 public ActionResult AddSube(Sube model)
 {
     repoSube.AddSube(model);
     return(RedirectToAction("Index", "Sube"));
 }
Beispiel #24
0
        protected void btnSube_Click(object sender, EventArgs e)
        {
            Sube  sube;
            Adres adres;
            Il    il;
            Ilce  ilce;
            int   selectedRowIndex = gvSube.SelectedIndex;

            try
            {
                if (selectedRowIndex < 0)
                {
                    sube  = new Sube();
                    adres = new Adres();
                    il    = new Il();
                    ilce  = new Ilce();

                    var i  = ddlSubeIl.SelectedIndex;
                    var ie = ddlSubeIlce.SelectedItem.Text.ToString();
                    il   = db.Iller.Find(i);
                    ilce = (from ii in db.Iller
                            join iiee in db.Ilceler on ii.Id equals iiee.IlId
                            where iiee.IlId == i && iiee.Ad == ie
                            select iiee).SingleOrDefault();
                    adres.IlId   = i;
                    adres.IlceId = ilce.Id;

                    adres.Mahalle = tbSubeMahalle.Text;
                    adres.Sokak   = tbSubeSokak.Text;
                    db.Adresler.Add(adres);
                    db.SaveChanges();

                    sube.Ad      = tbSubeAd.Text;
                    sube.Tel     = tbSubeTel.Text;
                    sube.AdresId = adres.Id;
                    db.Subeler.Add(sube);

                    lblSubeSonuc.Text = "Şube başarıyla eklenmiştir.";
                }
                else
                {
                    int subeId = Convert.ToInt32(tbSubeId.Text);
                    sube = db.Subeler.Find(subeId);

                    int adresId = Convert.ToInt32(sube.AdresId);
                    adres = db.Adresler.Find(adresId);

                    var i  = ddlSubeIl.SelectedIndex;
                    var ie = ddlSubeIlce.SelectedItem.Text.ToString();
                    il   = db.Iller.Find(i);
                    ilce = (from ii in db.Iller
                            join iiee in db.Ilceler on ii.Id equals iiee.IlId
                            where iiee.IlId == i && iiee.Ad == ie
                            select iiee).SingleOrDefault();
                    adres.IlId   = i;
                    adres.IlceId = ilce.Id;

                    adres.Mahalle = tbSubeMahalle.Text;
                    adres.Sokak   = tbSubeSokak.Text;

                    sube.Ad           = tbSubeAd.Text;
                    sube.Tel          = tbSubeTel.Text;
                    lblSubeSonuc.Text = "Sube başarıyla güncellenmiştir.";
                }
                db.SaveChanges();
            }
            catch (Exception)
            {
                lblSubeSonuc.Text = "İşlem başarısız olmuştur.";
            }
            gvSubeDataBind();
            clearSube();
        }
Beispiel #25
0
        protected override void Seed(DatabaseContext context)
        {
            for (int i = 0; i < 10; i++)
            {
                Sube sube = new Sube()
                {
                    isim = FakeData.NameData.GetCompanyName(),
                };
                context.Subes.Add(sube);

                for (int k = 0; k < 5; k++)
                {
                    Departman departman = new Departman()
                    {
                        isim = FakeData.NameData.GetCompanyName(),
                        Sube = sube,
                    };

                    context.Departmens.Add(departman);
                    for (int j = 0; j < 5; j++)
                    {
                        Ekip ekip = new Ekip()
                        {
                            isim      = FakeData.NameData.GetCompanyName(),
                            Departman = departman,
                            Sube      = sube
                        };
                        context.Ekips.Add(ekip);
                    }
                }
            }
            context.SaveChanges();
            Repository <Departman> departmans = new Repository <Departman>();
            Repository <Ekip>      ekips      = new Repository <Ekip>();
            Repository <Sube>      subes      = new Repository <Sube>();
            Kisi calisan = new Kisi()
            {
                isim        = "Cihad",
                soyisim     = "İnan",
                Statu       = Statu.mudur,
                dogumTarihi = new DateTime(1994, 9, 2),
                maas        = 4000,
                Departman   = departmans.Find(x => x.Id == 1),
                Ekip        = ekips.Find(x => x.Id == 1),
                Sube        = subes.Find(x => x.Id == 1)
            };

            context.Kisis.Add(calisan);
            Kisi calisan2 = new Kisi()
            {
                isim        = "ebu",
                soyisim     = "İnan",
                Statu       = Statu.uzman,
                dogumTarihi = new DateTime(1994, 2, 4),
                maas        = 4600,
                Departman   = departmans.Find(x => x.Id == 2),
                Ekip        = ekips.Find(x => x.Id == 2),
                Sube        = subes.Find(x => x.Id == 2)
            };

            context.Kisis.Add(calisan2);
            context.SaveChanges();
        }
Beispiel #26
0
 public void AddSube(Sube model)
 {
     repository.Insert(model);
 }
Beispiel #27
0
        private void cmbSubeKodu_SelectedIndexChanged(object sender, EventArgs e)
        {
            Sube sube = (Sube)cmbSubeKodu.SelectedItem;

            txtSubeIsmi.Text = sube.SubeIsmi;
        }
Beispiel #28
0
 public bool Delete([FromBody] Sube entity)
 {
     return(_subeRepo.Delete(entity));
 }
Beispiel #29
0
 public ActionResult UpdateSube(Sube sube)
 {
     repoSube.UpdateSube(sube);
     return(RedirectToAction("Index", "Sube"));
 }
Beispiel #30
0
 public async Task <bool> Create([FromBody] Sube sube)
 {
     return(await _subeRepo.CreateAsync(sube));
 }