public zones GetSingleZonesInfo(string id, int view)
        {
            zones send = new zones();
            int   nId  = Convert.ToInt32(id);

            if (dict.ContainsKey(nId))
            {
                send = dict[nId].Clone();
            }

            if (view == 0)
            {
                send.lstdev = null;
                send.lstzon = null;
            }
            else if (view == 1)
            {
                send.lstdev = null;
            }
            else if (view == 2)
            {
                send.lstzon = null;
            }

            return(send);
        }
 public ActionResult Edit([Bind(Include = "ID,title,local,secured,remote,netmask,isweb")] zones zone)
 {
     //TODO: This action need to be deeply reviewed
     if (ModelState.IsValid)
     {
         db.Entry(zone).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(zone));
 }
        public ActionResult Create([Bind(Include = "ID,title,local,secured,remote,netmask,isweb")] zones zone)
        {
            //1. Convert the entry to Db Model
            if (ModelState.IsValid == true)
            {
                //TODO: This action need to be deeply reviewed
                db.zones.Add(zone);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(zone));
        }
        // GET: zones/Delete/5
        public ActionResult Delete(int?id)
        {
            //TODO: This action need to be deeply reviewed
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            zones zone = db.zones.Find(id);

            if (zone == null)
            {
                return(HttpNotFound());
            }
            return(View(zone));
        }
        public BaseTran <devices> GetZoneDevList(string id)
        {
            BaseTran <devices> send = new BaseTran <devices>();
            List <devices>     lst  = new List <devices>();

            zones data = new zones();
            int   nId  = Convert.ToInt32(id);

            if (dict.ContainsKey(nId))
            {
                data = dict[nId].Clone();
            }

            lst = data.lstdev;

            send.total = lst.Count;
            send.msg   = "ok";
            send.data  = lst;

            return(send);
        }
        public BaseTran <zones> GetzonesList(string struc)
        {
            BaseTran <zones> send = new BaseTran <zones>();
            List <zones>     lst  = new List <zones>();


            foreach (var item in dict)
            {
                zones data = new zones();
                data        = item.Value.Clone();
                data.lstdev = null;
                data.lstzon = null;
                lst.Add(data);
            }

            send.total = lst.Count;
            send.msg   = "ok";
            send.data  = lst;

            return(send);
        }
예제 #7
0
        public static ZonesSimple Zones2ZonesSimple(zones theZone)
        {
            ZonesSimple zs = new ZonesSimple();

            string md5 = StringHelper.CalculateMD5Hash(theZone.zone + ".").ToLower();

            zs.id = md5;
            if (theZone.zone != theZone.rzone)
            {
                md5 = StringHelper.CalculateMD5Hash(theZone.rzone + ".").ToLower();
            }
            zs.userid      = Convert.ToInt32(theZone.userid);
            zs.domain      = theZone.zone + ".";
            zs.rrcol       = md5.Substring(0, 1);
            zs.level       = Convert.ToInt32(theZone.level);
            zs.nsstate     = theZone.nsstate;
            zs.is_stop     = theZone.active == "Y" ? "N" : "Y";
            zs.force_stop  = theZone.forcestop;
            zs.rdomain     = theZone.rzone + ".";
            zs.loadonstart = 0;
            return(zs);
        }