コード例 #1
0
        public ActionResult Delete(int id = -1)
        {
            if (permissionUser.SysAdmin == false)
            {
                if (permissionUser.Grup_Islemleri == (int)SecurityCode.Sadece_Izleme || permissionUser.Grup_Islemleri == (int)SecurityCode.Yetkisiz)
                {
                    throw new Exception("Ziyaretçi silmeye yetkiniz yok!");
                }
            }


            if (id != -1)
            {
                Visitors visitor     = _visitorsService.GetById(id);
                Users    deleteUsers = _userService.GetAllUsers().FirstOrDefault(x => x.Kart_ID == visitor.Kart_ID);
                if (visitor != null)
                {
                    _visitorsService.DeleteVisitor(visitor);
                    _userService.DeleteUsers(deleteUsers);
                    foreach (var item in _reportService.PanelListesi(user))
                    {
                        TaskList taskList = new TaskList
                        {
                            Deneme_Sayisi  = 1,
                            Durum_Kodu     = (int)PanelStatusCode.Beklemede,
                            Gorev_Kodu     = (int)CommandConstants.CMD_ERS_USER,
                            IntParam_1     = id,
                            Kullanici_Adi  = user.Kullanici_Adi,
                            Panel_No       = item.Panel_ID,
                            Tablo_Guncelle = true,
                            Tarih          = DateTime.Now
                        };
                        TaskList taskListReceive = _taskListService.AddTaskList(taskList);
                    }
                    _accessDatasService.AddOperatorLog(322, permissionUser.Kullanici_Adi, visitor.Kayit_No, 0, 0, 0);
                    return(RedirectToAction("Index"));
                }
            }
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult Delete(int id = -1)
        {
            if (permissionUser.SysAdmin == false)
            {
                if (permissionUser.Grup_Islemleri == (int)SecurityCode.Sadece_Izleme || permissionUser.Grup_Islemleri == (int)SecurityCode.Yetkisiz)
                {
                    throw new Exception("Ziyaretçi silmeye yetkiniz yok!");
                }
            }


            if (id != -1)
            {
                Visitors visitor = _visitorsService.GetById(id);
                if (visitor != null)
                {
                    _visitorsService.DeleteVisitor(visitor);
                    _accessDatasService.AddOperatorLog(322, permissionUser.Kullanici_Adi, visitor.Kayit_No, 0, 0, 0);
                    return(RedirectToAction("Index"));
                }
            }
            return(RedirectToAction("Index"));
        }