Пример #1
0
        public ActionResult EditSemanas(int id)
        {
            var   semBLL = new MesBLL();
            tblMe objsem = semBLL.RetrieveMesByID(id);

            return(View(objsem));
        }
Пример #2
0
        //public tblAnio RetrieveByAnioTexto(int anio)
        //{
        //    tblAnio Result = null;
        //    using (var r = new Repository<tblAnio>())
        //    {
        //        Result = r.Retrieve(p => p.anio == anio);
        //    }
        //    return Result;
        //}


        public tblMe RetrieveMesByID(int id)
        {
            tblMe Result = null;

            using (var r = new Repository <tblMe>())
            {
                Result = r.Retrieve(p => p.idMes == id);
            }
            return(Result);
        }
Пример #3
0
        public JsonResult DeleteSemanas(int id)
        {
            var          semBLL  = new MesBLL();
            wmJsonResult objJson = new wmJsonResult();

            try
            {
                tblMe semana = semBLL.RetrieveMesByID(id);

                if (semana != null)
                {
                    var            citaBLL    = new CitaBLL();
                    List <tblCita> listaCitas = citaBLL.RetrieveCitasSemanaByID(id);

                    if (listaCitas.Count() >= 0)
                    {
                        //Tiene Citas
                    }

                    bool banderita = semBLL.Delete(id);

                    if (banderita == true)
                    {
                        objJson.bandera = true;
                        objJson.mensaje = "La semana se eliminó correctamente";
                    }
                    else
                    {
                        objJson.bandera = false;
                        objJson.mensaje = "La semana NO se eliminó correctamente";
                    }
                }
                else
                {
                    objJson.bandera = false;
                    objJson.mensaje = "La semana no se encontró";
                }
            }
            catch
            {
                objJson.bandera = false;
                objJson.mensaje = "Ocurrio una excepcion al eliminar la semana";
            }

            return(Json(objJson, JsonRequestBehavior.AllowGet));
        }
Пример #4
0
        public bool Delete(int id)
        {
            bool  Result = false;
            tblMe obj    = RetrieveMesByID(id);

            if (obj != null)
            {
                using (var r = new Repository <tblMe>())
                {
                    Result = r.Delete(obj);
                }
            }
            else
            {
                throw (new Exception("El mes seleccionada no se pudo eliminar."));
            }

            return(Result);
        }
Пример #5
0
        public ActionResult EditSemanas(tblMe semana)
        {
            var          semBLL = new MesBLL();
            ActionResult Result = null;

            try
            {
                if (ModelState.IsValid)
                {
                    semBLL.Update(semana);
                    Result = RedirectToAction("IndexSemanas");
                }
            }
            catch
            {
                return(View());
            }

            return(Result);
        }
Пример #6
0
        public bool Update(tblMe t)
        {
            bool Result = false;

            using (var r = new Repository <tblMe>())
            {
                tblMe ba = r.Retrieve(p => p.Mes == t.Mes &&
                                      p.fechaInicial == t.fechaInicial &&
                                      p.fechaFinal == t.fechaFinal &&
                                      p.idAnioMes == t.idAnioMes);

                if (ba == null)
                {
                    Result = r.Update(t);
                }
                else
                {
                    throw (new Exception("No se pudo actualizar el mes seleccionado."));
                }
            }
            return(Result);
        }
Пример #7
0
        public tblMe Create(tblMe t)
        {
            tblMe Result = null;

            using (var r = new Repository <tblMe>())
            {
                tblMe ba = r.Retrieve(p => p.idMes == t.idMes &&
                                      p.fechaInicial == t.fechaInicial &&
                                      p.fechaFinal == t.fechaFinal &&
                                      p.idAnioMes == t.idAnioMes);

                if (ba == null)
                {
                    Result = r.Create(t);
                }
                else
                {
                    throw (new Exception("El mes ya existe."));
                }
            }
            return(Result);
        }