コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            try
            {
                if (ReferenceEquals(id, null))
                {
                    return(RedirectToAction("httpErrorMsg", "Error", new { MessageErr = "Índice nulo o no encontrado" }));
                }

                clsPlan oPlan = new clsPlan(clsAppInfo.Connection);

                oPlan.WhereFilter = clsPlan.WhereFilters.PrimaryKey;
                oPlan.VM.PlanId   = id;

                if (oPlan.Delete())
                {
                    return(RedirectToAction("Index"));
                }

                return(RedirectToAction("httpErrorMsg", "Error", new { MessageErr = "Error al Eliminar el Registro" }));
            }

            catch (Exception exp)
            {
                return(RedirectToAction("httpErrorMsg", "Error", new { MessageErr = exp.Message }));
            }
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            string  strMsg = string.Empty;
            clsPlan oPlan  = new clsPlan(clsAppInfo.Connection);

            oPlan.WhereFilter = clsPlan.WhereFilters.PrimaryKey;
            oPlan.VM.PlanId   = id;

            try
            {
                if (ReferenceEquals(id, null))
                {
                    return(RedirectToAction("httpErrorMsg", "Error", new { MessageErr = "Índice nulo o no encontrado" }));
                }

                oPlan.FindByPK();

                long idPadre = oPlan.VM.PlanPadreId;
                strMsg += CheckPlanDeletePost(oPlan.VM);

                if (String.IsNullOrEmpty(strMsg))
                {
                    if (oPlan.Delete())
                    {
                        return(RedirectToAction("Index", new { idPlan = SysData.ToLong(idPadre) }));
                    }
                }

                return(RedirectToAction("Delete", new { id = oPlan.VM.PlanId, mensajeError = " Error al eliminar Plan" }));
            }

            catch (Exception exp)
            {
                ViewBag.MessageErr = exp.Message;
                return(View(oPlan.VM.PlanId));
            }
        }