示例#1
0
        public ActionResult Delete(TiposFacturaModel model)
        {
            if (sesion == null)
            {
                sesion = SessionDB.start(Request, Response, false, db);
            }
            model.sesion = sesion;

            if (!sesion.permisos.havePermission(Privileges[0].Permiso))
            {
                return(Json(new { msg = Notification.notAccess() }));
            }

            try
            {
                if (model.Delete())
                {
                    Log.write(this, "Delete", LOG.BORRADO, "SQL:" + model.sql, sesion);
                    return(Json(new { msg = Notification.Succes("Tipo de Factura ELIMINADO con exito: " + model.TipoFactura) }));
                }
                else
                {
                    Log.write(this, "Delete", LOG.ERROR, "SQL:" + model.sql, sesion);
                    return(Json(new { msg = Notification.Error("Error al Eliminar el Tipo de Factura = " + model.TipoFactura) }));
                }
            }
            catch (Exception e)
            {
                return(Json(new { msg = Notification.Error(e.Message) }));
            }
        }
示例#2
0
        public ActionResult Add(TiposFacturaModel model)
        {
            if (sesion == null)
            {
                sesion = SessionDB.start(Request, Response, false, db);
            }
            model.sesion = sesion;

            if (!sesion.permisos.havePermission(Privileges[0].Permiso))
            {
                return(Json(new { msg = Notification.notAccess() }));
            }

            try
            {
                if (model.Add())
                {
                    Log.write(this, "Add", LOG.REGISTRO, "SQL:" + model.sql, sesion);
                    return(Json(new { msg = Notification.Succes("Tipo de Factura agregado con exito: " + model.TipoFactura) }));
                }
                else
                {
                    Log.write(this, "Add", LOG.ERROR, "SQL:" + model.sql, sesion);
                    return(Json(new { msg = Notification.Error(" Error al agregar:" + model.TipoFactura) }));
                }
            }
            catch (Exception e)
            {
                return(Json(new { msg = Factory.Notification.Error(e.Message) }));
            }
        }
示例#3
0
 public ActionResult Edit(TiposFacturaModel model)
 {
     if (model.Edit())
     {
         return(Json(new JavaScriptSerializer().Serialize(model)));
     }
     return(View());
 }
        public string getTiposFactura(string Tfactura = "")
        {
            TiposFacturaModel model = new TiposFacturaModel();

            SessionDB sesion = SessionDB.start(Request, Response, false, model.db, SESSION_BEHAVIOR.AJAX);

            if (sesion == null)
            {
                return("");
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("<option></option>");
            foreach (KeyValuePair <string, string> pair in model.getTiposFactura())
            {
                sb.Append("<option value=\"").Append(pair.Key).Append("\">").Append(pair.Value).Append("</option>\n");
            }
            return(sb.ToString());
        }