コード例 #1
0
        public ActionResult Create(Visitors visitors, HttpPostedFileBase ProfileImage)
        {
            if (ProfileImage != null && (ProfileImage.ContentType == "image/jpeg" || ProfileImage.ContentType == "image/jpg" || ProfileImage.ContentType == "image/png"))
            {
                string filename = $"visitor_{visitors.ID}.{ProfileImage.ContentType.Split('/')[1]}";
                ProfileImage.SaveAs(Server.MapPath($"~/Images/{filename}"));
                visitors.Resim = filename;
            }

            if (ProfileImage == null)
            {
                visitors.Resim = "BaseUser.jpg";
            }


            if (ModelState.IsValid)
            {
                visitors.Saat = DateTime.Now;
                var addedVisitor = _visitorsService.AddVisitor(visitors);
                _accessDatasService.AddOperatorLog(320, permissionUser.Kullanici_Adi, addedVisitor.Kayit_No, 0, 0, 0);
                return(RedirectToAction("Index"));
            }

            return(View(visitors));
        }
コード例 #2
0
        public ActionResult AddUser(bool?TabloDelete)
        {
            if (TabloDelete == true)
            {
                _userService.DeleteAllUsers();
                foreach (var item in _rawUsersService.GetAllRawUsers())
                {
                    var users = ConvertUser.RawUserToUser(item);
                    _userService.AddUsers(users);
                }
                _rawUsersService.DeleteAll();
                _accessDatasService.AddOperatorLog(211, user.Kullanici_Adi, 0, 0, 0, 0);
            }
            else
            {
                foreach (var item in _rawUsersService.GetAllRawUsers())
                {
                    if (!_userService.GetAllUsers().Any(x => x.ID == item.ID))
                    {
                        var users = ConvertUser.RawUserToUser(item);
                        _userService.AddUsers(users);
                        var rawuser = _rawUsersService.GetById(item.ID);
                        _rawUsersService.DeleteRawUsers(rawuser);
                    }
                }
                _accessDatasService.AddOperatorLog(211, user.Kullanici_Adi, 0, 0, 0, 0);
            }

            return(RedirectToAction("Index", "Users"));
        }
コード例 #3
0
        public ActionResult Create(Bloklar bloklar)
        {
            if (permissionUser.SysAdmin == false)
            {
                throw new Exception("Yetkisiz Erişim!");
            }
            else
            {
                if (ModelState.IsValid)
                {
                    if (bloklar.Adi != null)
                    {
                        var ID = _bloklarService.GetAllBloklar().Count;
                        if (ID == 0)
                        {
                            _bloklarService.DeleteAll();
                        }

                        _bloklarService.AddBloklar(bloklar);
                        _accessDatasService.AddOperatorLog(200, user.Kullanici_Adi, bloklar.Blok_No, 0, 0, 0);
                        return(RedirectToAction("Index"));
                    }
                    throw new Exception("Yanlış yada eksik karakter girdiniz");
                }
                return(RedirectToAction("Index"));
            }
        }
コード例 #4
0
 [HttpPost]//AGG Ekleme
 public ActionResult Create(LiftGroups liftGroups)
 {
     if (ModelState.IsValid)
     {
         _liftGroupsService.AddLiftGroup(liftGroups);
         _accessDatasService.AddOperatorLog(160, user.Kullanici_Adi, liftGroups.Asansor_Grup_No, 0, 0, 0);
         return(RedirectToAction("LiftGroups", "Lift"));
     }
     return(View(liftGroups));
 }
コード例 #5
0
 public ActionResult ProgRelayEdit(ProgRelay2 progRelay2)
 {
     if (ModelState.IsValid)
     {
         _progRelay2Service.UpdateProgRelay2(progRelay2);
         _accessDatasService.AddOperatorLog(170, user.Kullanici_Adi, progRelay2.Kayit_No, 0, 0, 0);
         return(RedirectToAction("ProgRelay", "Door", new { @ListPanel_No = progRelay2.Panel_No, @ListHaftanin_Gunu = progRelay2.Haftanin_Gunu }));
     }
     return(View(progRelay2));
 }
コード例 #6
0
        public ActionResult GroupSettings(GroupsMaster groupsMaster)
        {
            if (ModelState.IsValid)
            {
                _groupMasterService.UpdateGroupsMaster(groupsMaster);
                _groupsDetailNewService.UpdateTSQL(groupsMaster.Grup_Adi, groupsMaster.Grup_No);
                _accessDatasService.AddOperatorLog(122, permissionUser.Kullanici_Adi, groupsMaster.Grup_No, 0, 0, 0);

                return(RedirectToAction("Groups", "AccessGroup"));
            }
            return(View(groupsMaster));
        }
コード例 #7
0
        public ActionResult TurnBackUser(int?id)
        {
            if (id != null)
            {
                if (user.SysAdmin == false)
                {
                    if (user.Kullanici_Islemleri == (int)SecurityCode.Sadece_Izleme || user.Kullanici_Islemleri == (int)SecurityCode.Yetkisiz)
                    {
                        throw new Exception("Kullanıcı ekleme yetkiniz yok!");
                    }
                }


                var entity          = _usersOLDService.GetAllUsersOLD().FirstOrDefault(x => x.ID == id);
                var checkUserKartID = _userService.GetAllUsers().FirstOrDefault(x => x.Kart_ID == entity.Kart_ID);
                if (checkUserKartID == null)
                {
                    Users ReCycleUser = ConvertUser.UserOldToUser(entity);
                    var   checkUserID = _userService.GetAllUsers().FirstOrDefault(x => x.ID == ReCycleUser.ID);
                    if (checkUserID != null)
                    {
                        ReCycleUser.ID = (_userService.GetAllUsers().Max(x => x.ID) + 1);
                    }

                    _userService.AddUsers(ReCycleUser);
                    _usersOLDService.DeleteUsersOLD(entity);
                    _accessDatasService.AddOperatorLog(100, user.Kullanici_Adi, ReCycleUser.ID, 0, 0, 0);
                    foreach (var panel in _panelSettingsService.GetAllPanelSettings(x => x.Panel_TCP_Port != 0 && x.Panel_IP1 != 0 && x.Panel_IP2 != 0 && x.Panel_IP3 != 0 && x.Panel_IP4 != 0))
                    {
                        TaskList taskSendUser = new TaskList
                        {
                            Deneme_Sayisi  = 1,
                            Durum_Kodu     = (int)PanelStatusCode.Beklemede,
                            Gorev_Kodu     = (int)CommandConstants.CMD_SND_USER,
                            IntParam_1     = ReCycleUser.ID,
                            Kullanici_Adi  = user.Kullanici_Adi,
                            Panel_No       = panel.Panel_ID,
                            Tablo_Guncelle = true,
                            Tarih          = DateTime.Now
                        };
                        _taskListService.AddTaskList(taskSendUser);
                    }
                    _accessDatasService.AddOperatorLog(103, user.Kullanici_Adi, ReCycleUser.ID, 0, 0, 0);
                    return(RedirectToAction("Index", "Users"));
                }
                else
                {
                    throw new Exception("Aynı Kart ID'sine sahip kullanıcı bulunmaktadır!");
                }
            }
            throw new Exception("Upps! Yanlış Giden Birşeyler Var!");
        }
コード例 #8
0
 public ActionResult Edit(Alarmlar alarmlar)
 {
     if (ModelState.IsValid)
     {
         if (alarmlar != null)
         {
             _alarmlarService.UpdateAlarmlar(alarmlar);
             _accessDatasService.AddOperatorLog(141, user.Kullanici_Adi, alarmlar.Alarm_No, 0, 0, 0);
             return(RedirectToAction("Index", "Alarm"));
         }
     }
     return(View(alarmlar));
 }
コード例 #9
0
 public ActionResult Delete(int id = -1)
 {
     if (id != -1)
     {
         Cameras cameras = _camerasService.GetById(id);
         if (cameras == null)
         {
             return(RedirectToAction("Index"));
         }
         _camerasService.DeleteCamera(cameras);
         _accessDatasService.AddOperatorLog(152, user.Kullanici_Adi, cameras.Kamera_No, 0, 0, 0);
         RouteValueCheck();
         return(RedirectToAction("Index"));
     }
     return(RedirectToAction("Index"));
 }
コード例 #10
0
        public ActionResult Create(Visitors visitors)
        {
            if (ModelState.IsValid)
            {
                visitors.Saat = DateTime.Now;
                int MaxID;
                if (_userService.GetAllUsers().Count == 0)
                {
                    MaxID = 0;
                }
                else
                {
                    MaxID = _userService.GetAllUsers().Max(x => x.ID);
                }


                var userEntity = new Users
                {
                    Adi              = "Ziyaretci_" + visitors.Adi,
                    Soyadi           = "Ziyaretci_" + visitors.Soyadi,
                    ID               = MaxID + 1,
                    Kart_ID          = visitors.Kart_ID,
                    Grup_No          = visitors.Grup_No,
                    Visitor_Grup_No  = visitors.Grup_No,
                    Aciklama         = "QR Kodlu Sistem Ziyaretçisi",
                    Kullanici_Tipi   = 1,
                    TCKimlik         = visitors.TCKimlik,
                    Telefon          = visitors.Telefon,
                    Resim            = "BaseUser.jpg",
                    Plaka            = visitors.Plaka,
                    Sirket_No        = _sirketService.GetAllSirketler().FirstOrDefault().Sirket_No,
                    Departman_No     = _departmanService.GetAllDepartmanlar().FirstOrDefault().Departman_No,
                    Alt_Departman_No = _altDepartmanService.GetAllAltDepartman().FirstOrDefault().Alt_Departman_No
                };
                visitors.UseUserGroup = true;
                visitors.ID           = MaxID + 1;
                var addedUser    = _userService.AddUsers(userEntity);
                var addedVisitor = _visitorsService.AddVisitor(visitors);
                Send(PanelListesi, CommandConstants.CMD_SND_USER, addedUser.ID);
                _accessDatasService.AddOperatorLog(320, permissionUser.Kullanici_Adi, addedVisitor.Kayit_No, 0, 0, 0);
                return(RedirectToAction("PrintQRCode", new { KartID = visitors.Kart_ID }));
            }
            return(View(visitors));
        }
コード例 #11
0
        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"));
            }
        }
コード例 #12
0
        public ActionResult Create(Sirketler Sirket)
        {
            if (permissionUser.SysAdmin == false)
            {
                throw new Exception("Yetkisiz Erişim!");
            }
            else
            {
                if (ModelState.IsValid)
                {
                    if (Sirket.Adi != null)
                    {
                        var ID = _sirketService.GetAllSirketler().Count;
                        if (ID == 0)
                        {
                            _sirketService.DeleteAll();
                        }

                        _sirketService.AddSirket(Sirket);
                        foreach (var dbsysAdmin in _dBUsersService.GetAllDBUsers(x => x.SysAdmin == true))
                        {
                            var dbSirket = new DBUsersSirket
                            {
                                Kullanici_Adi = dbsysAdmin.Kullanici_Adi,
                                Sirket_No     = Sirket.Sirket_No
                            };
                            _dBUsersSirketService.AddDBUsersSirket(dbSirket);
                        }

                        _accessDatasService.AddOperatorLog(180, user.Kullanici_Adi, Sirket.Sirket_No, 0, 0, 0);
                        return(RedirectToAction("Index"));
                    }
                    ModelState.AddModelError(string.Empty, "Şirket Adı Boş Geçilemez");
                }
                return(RedirectToAction("Index"));
            }
        }
コード例 #13
0
        public ActionResult Add(SMSSetting sMSSetting)
        {
            if (ModelState.IsValid)
            {
                if (permissionUser.SysAdmin == false)
                {
                    throw new Exception("Yetkisiz Erişim!");
                }

                _smsSettingsService.UpdateSMSSetting(sMSSetting);
                _accessDatasService.AddOperatorLog(221, user.Kullanici_Adi, sMSSetting.Kayit_No, 0, 0, 0);
                return(RedirectToAction("Add", "SMS"));
            }
            return(View(sMSSetting));
        }
コード例 #14
0
        public ActionResult Add(EMailSetting eMailSetting)
        {
            if (ModelState.IsValid)
            {
                if (permissionUser.SysAdmin == false)
                {
                    throw new Exception("Yetkisiz Erişim!");
                }

                var updatedemail = _emailSettingsService.UpdateEMailSetting(eMailSetting);
                ConfigHelper.SetEmailConfig(updatedemail);
                _accessDatasService.AddOperatorLog(220, user.Kullanici_Adi, eMailSetting.Kayit_No, 0, 0, 0);
                return(RedirectToAction("Add", "Email"));
            }
            return(View(eMailSetting));
        }
コード例 #15
0
 public ActionResult WatchSettings(ProgInit progInit)
 {
     if (ModelState.IsValid)
     {
         if (progInit != null)
         {
             if (permissionUser.Canli_Izleme == (int)SecurityCode.Sadece_Izleme || permissionUser.Canli_Izleme == (int)SecurityCode.Yetkisiz)
             {
                 throw new Exception("Değişiklik yapmaya yetkiniz yok!");
             }
             if (progInit.Kayit_No != 0)
             {
                 _progInitService.UpdateProgInit(progInit);
                 _accessDatasService.AddOperatorLog(260, user.Kullanici_Adi, progInit.Kayit_No, 0, 0, 0);
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
             return(RedirectToAction("Index"));
         }
     }
     return(View(progInit));
 }
コード例 #16
0
        public ActionResult Add(TimeGroups timeGroups, DateTime?Baslangic_Tarihi_Two = null, DateTime?Baslangic_Saati_Two = null, DateTime?Bitis_Tarihi_Two = null, DateTime?Bitis_Saati_Two = null)
        {
            if (ModelState.IsValid)
            {
                if (Baslangic_Tarihi_Two != null)
                {
                    if (Baslangic_Saati_Two != null)
                    {
                        timeGroups.Baslangic_Tarihi = Baslangic_Tarihi_Two;
                        timeGroups.Baslangic_Saati  = Baslangic_Saati_Two;
                    }
                    else
                    {
                        timeGroups.Baslangic_Tarihi = Baslangic_Tarihi_Two;
                    }
                }
                if (Bitis_Tarihi_Two != null)
                {
                    if (Bitis_Saati_Two != null)
                    {
                        timeGroups.Bitis_Tarihi = Bitis_Tarihi_Two;
                        timeGroups.Bitis_Saati  = Bitis_Saati_Two;
                    }
                    else
                    {
                        timeGroups.Bitis_Tarihi = Bitis_Tarihi_Two;
                    }
                }

                if (timeGroups.Gecis_Sinirlama_Tipi == null)
                {
                    throw new Exception("Geçiş sınırlama tipi seçilmeli!");
                }



                _timeGroupsService.AddTimeGroups(timeGroups);
                _accessDatasService.AddOperatorLog(110, permissionUser.Kullanici_Adi, timeGroups.Zaman_Grup_No, 0, 0, 0);
                return(RedirectToAction("Index"));
            }
            return(View(timeGroups));
        }
コード例 #17
0
        public ActionResult SendToPanel(int?Panel)
        {
            try
            {
                #region Normal Panel Ayarları
                //TaskList taskList = new TaskList
                //{
                //    Deneme_Sayisi = 1,
                //    Durum_Kodu = (int)PanelStatusCode.Beklemede,
                //    Gorev_Kodu = (int)CommandConstants.CMD_SND_GENERALSETTINGS,
                //    IntParam_1 = (int)Panel,
                //    Kullanici_Adi = user.Kullanici_Adi,
                //    Panel_No = Panel,
                //    Tablo_Guncelle = true,
                //    Tarih = DateTime.Now
                //};
                //_taskListService.sp_AddTaskList(taskList);
                #endregion

                #region Fortigate Panel Ayarları
                if (_panelSettingsService.GetById((int)Panel).Panel_Model == (int)PanelModel.Panel_1010)
                {
                    TaskList taskListms = new TaskList
                    {
                        Deneme_Sayisi  = 1,
                        Durum_Kodu     = (int)PanelStatusCode.Beklemede,
                        Gorev_Kodu     = (int)CommandConstants.CMD_SND_GENERALSETTINGS,
                        IntParam_1     = (int)Panel,
                        Kullanici_Adi  = user.Kullanici_Adi,
                        Panel_No       = Panel,
                        Tablo_Guncelle = true,
                        Tarih          = DateTime.Now
                    };
                    _taskListService.sp_AddTaskList(taskListms);
                }
                else
                {
                    TaskList taskList3 = new TaskList
                    {
                        Deneme_Sayisi  = 1,
                        Durum_Kodu     = (int)PanelStatusCode.Beklemede,
                        Gorev_Kodu     = (int)CommandConstants.CMD_SND_GENERALSETTINGS_3,
                        IntParam_1     = (int)Panel,
                        Kullanici_Adi  = user.Kullanici_Adi,
                        Panel_No       = Panel,
                        Tablo_Guncelle = true,
                        Tarih          = DateTime.Now
                    };
                    _taskListService.sp_AddTaskList(taskList3);
                    TaskList taskList2 = new TaskList
                    {
                        Deneme_Sayisi  = 1,
                        Durum_Kodu     = (int)PanelStatusCode.Beklemede,
                        Gorev_Kodu     = (int)CommandConstants.CMD_SND_GENERALSETTINGS_2,
                        IntParam_1     = (int)Panel,
                        Kullanici_Adi  = user.Kullanici_Adi,
                        Panel_No       = Panel,
                        Tablo_Guncelle = true,
                        Tarih          = DateTime.Now
                    };
                    _taskListService.sp_AddTaskList(taskList2);
                    TaskList taskList1 = new TaskList
                    {
                        Deneme_Sayisi  = 1,
                        Durum_Kodu     = (int)PanelStatusCode.Beklemede,
                        Gorev_Kodu     = (int)CommandConstants.CMD_SND_GENERALSETTINGS_1,
                        IntParam_1     = (int)Panel,
                        Kullanici_Adi  = user.Kullanici_Adi,
                        Panel_No       = Panel,
                        Tablo_Guncelle = true,
                        Tarih          = DateTime.Now
                    };
                    _taskListService.sp_AddTaskList(taskList1);
                }

                #endregion

                _accessDatasService.AddOperatorLog(134, user.Kullanici_Adi, 0, 0, Panel, 0);
            }
            catch (Exception)
            {
                throw new Exception("Upss! Yanlış Giden Birşeyler Var.");
            }
            return(RedirectToAction("ReaderList", new { @PanelID = Panel }));
        }