public ActionResult AddDepartman(int DepartmanNo, string kullaniciAdi)
        {
            var addedDBUserDepartman = new DBUsersDepartman
            {
                Kullanici_Adi = kullaniciAdi,
                Departman_No  = DepartmanNo
            };

            _dBUsersDepartman.AddDBUsersDepartman(addedDBUserDepartman);
            foreach (var altDepartman in _altDepartmanService.GetAllAltDepartman(x => x.Departman_No == DepartmanNo))
            {
                var addedDBUserAltDepartman = new DBUsersAltDepartman
                {
                    Kullanici_Adi    = kullaniciAdi,
                    Departman_No     = DepartmanNo,
                    Alt_Departman_No = altDepartman.Alt_Departman_No
                };
                _dBUsersAltDepartmanService.AddDBUsersAltDepartman(addedDBUserAltDepartman);
            }
            foreach (var bolum in _bolumService.GetAllBolum(x => x.Departman_No == DepartmanNo))
            {
                var addedDBUserBolum = new DBUsersBolum
                {
                    Kullanici_Adi    = kullaniciAdi,
                    Departman_No     = DepartmanNo,
                    Alt_Departman_No = bolum.Alt_Departman_No,
                    Bolum_No         = bolum.Bolum_No
                };
                _dBUsersBolumService.AddDBUsersBolum(addedDBUserBolum);
            }
            return(Json("Ok", JsonRequestBehavior.AllowGet));
        }
        public ActionResult Create(Departmanlar departmanlar)
        {
            if (permissionUser.SysAdmin == false)
            {
                throw new Exception("Yetkisiz Erişim!");
            }
            else
            {
                if (ModelState.IsValid)
                {
                    if (departmanlar.Adi != null)
                    {
                        var ID = _departmanService.GetAllDepartmanlar().Count;
                        if (ID == 0)
                        {
                            _departmanService.DeleteAll();
                        }


                        _departmanService.AddDepartman(departmanlar);

                        foreach (var dbSysAdmin in _dBUsersService.GetAllDBUsers(x => x.SysAdmin == true))
                        {
                            var dbUserDepartman = new DBUsersDepartman
                            {
                                Kullanici_Adi = dbSysAdmin.Kullanici_Adi,
                                Departman_No  = departmanlar.Departman_No
                            };
                            _dBUsersDepartmanService.AddDBUsersDepartman(dbUserDepartman);
                        }



                        _accessDatasService.AddOperatorLog(190, user.Kullanici_Adi, departmanlar.Departman_No, 0, 0, 0);
                        return(RedirectToAction("Index"));
                    }
                }
                return(RedirectToAction("Index"));
            }
        }
Exemplo n.º 3
0
 public void DeleteDBUsersDepartman(DBUsersDepartman dBUsersDepartman)
 {
     _dBUsersDepartmanDal.Delete(dBUsersDepartman);
 }
Exemplo n.º 4
0
 public DBUsersDepartman UpdateDBUsersDepartman(DBUsersDepartman dBUsersDepartman)
 {
     return(_dBUsersDepartmanDal.Update(dBUsersDepartman));
 }
Exemplo n.º 5
0
 public DBUsersDepartman AddDBUsersDepartman(DBUsersDepartman dBUsersDepartman)
 {
     return(_dBUsersDepartmanDal.Add(dBUsersDepartman));
 }