示例#1
0
        public JsonResult GetAreas(String idDepto)
        {
            model = (SessionModel)this.Session["SessionData"];

            DeptoHelper dh    = new DeptoHelper();
            var         Areas = dh.GetArea(int.Parse(idDepto), Convert.ToInt32(model.ProfileID));

            if (Areas == null)
            {
                logger.Info("Areas no disponibles para crear nuevo usuario." + Environment.NewLine + DateTime.Now);
                return(Json(new { success = false, data = Areas, msgError = "Areas No Disponibles para este Depto." }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { success = true, data = Areas }, JsonRequestBehavior.AllowGet));
            }
        }
示例#2
0
        public ActionResult DeleteConfirmed(int id)
        {
            User        user = db.User.Find(id);
            Profile     pr   = db.Profile.Where(p => p.idUser.Equals(id)).FirstOrDefault();
            DeptoHelper dh   = new DeptoHelper();

            int res = dh.DeleteProfileDepto(pr.idProfile);

            if (res.Equals(1))
            {
                db.Profile.Remove(pr);
                db.User.Remove(user);
                db.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
示例#3
0
        public JsonResult GetDeptos(String brand)
        {
            model = (SessionModel)this.Session["SessionData"];
            var idProfile = int.Parse(model.ProfileID);

            DeptoHelper dh               = new DeptoHelper();
            var         serializer       = new JavaScriptSerializer();
            var         serializedResult = serializer.Serialize(dh.GetDepto(brand, idProfile));

            if (serializedResult != "null")
            {
                return(Json(new { success = true, data = serializedResult }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                logger.Error("Error al intentar obtener la información de los departamentos en la db. " + Environment.NewLine + DateTime.Now);
                return(Json(new { success = false, msgError = "Ocurrio un problema, departamentos no disponibles." }, JsonRequestBehavior.AllowGet));
            }
        }
示例#4
0
        public JsonResult GetAreas(String idDepto)
        {
            model = (SessionModel)this.Session["SessionData"];
            var idProfile = int.Parse(model.ProfileID);

            DeptoHelper dh               = new DeptoHelper();
            var         serializer       = new JavaScriptSerializer();
            var         serializedResult = serializer.Serialize(dh.GetAreaDepto(int.Parse(idDepto), idProfile));

            if (serializedResult != "null")
            {
                return(Json(new { success = true, data = serializedResult }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                logger.Error("Error al intentar obtener la información de las Areas en la db. " + Environment.NewLine + DateTime.Now);
                return(Json(new { success = false, msgError = "Ocurrio un error, no se encontraron areas." }, JsonRequestBehavior.AllowGet));
            }
        }