예제 #1
0
        public ActionResult Pdh(Pdh modelo)
        {
            if (ModelState.IsValid)
            {
                var vc = new Clases.VisitasDao();

                var usuario = Session["Usuario"].ToString();

                modelo.StrEmail = usuario;


                var res = vc.AddPdh(modelo, out _strMensaje);

                if (res)
                {
                    ViewBag.mensaje = _strMensaje;
                    return(View());
                }
                else
                {
                    ViewBag.Error = _strMensaje;
                    return(View());
                }
            }
            else
            {
                ViewBag.Error = "Los datos no estan completos";
                return(View());
            }
        }
예제 #2
0
        public static PdhCounter AddCounter(this PdhQuery query, string path)
        {
            Pdh
            .PdhAddEnglishCounter(query, path, IntPtr.Zero, out var counter)
            .EnsureSuccess(nameof(Pdh.PdhAddEnglishCounter));

            return(counter);
        }
예제 #3
0
        public static unsafe int EstimateFormattedCounterArraySize(this PdhCounter counter)
        {
            var size   = 0;
            var status = Pdh.PdhGetFormattedCounterArray(counter, DefaultFmt, ref size, out _, null);

            if (status != PdhStatus.PDH_CSTATUS_VALID_DATA && status != PdhStatus.PDH_MORE_DATA)
            {
                FailWithError(PdhStatus.PDH_MORE_DATA, nameof(Pdh.PdhGetFormattedCounterArray));
            }
            return(size);
        }
예제 #4
0
        public bool AddPdh(Pdh model, out string strMensaje)
        {
            try
            {
                var parametros = new List <SqlParameter>()
                {
                    new SqlParameter("@strEmail", model.StrEmail),
                    new SqlParameter("@idTipoVisita", TpVisitas.Pdh),
                    new SqlParameter("@strNombre", model.StrNombre),
                    new SqlParameter("@strObservacion", model.StrObservacion)
                };

                var mensaje = new SqlParameter("@strMensaje", SqlDbType.VarChar, 100)
                {
                    Direction = ParameterDirection.Output
                };
                var respuesta = new SqlParameter("@logRespuesta", SqlDbType.Bit)
                {
                    Direction = ParameterDirection.Output
                };
                var id = new SqlParameter("@numCodigo", SqlDbType.BigInt)
                {
                    Direction = ParameterDirection.Output
                };
                parametros.Add(mensaje);
                parametros.Add(respuesta);
                parametros.Add(id);

                var res = _datahelper.EjecutarSp <bool>("sp_vtAddVisitasMobil", parametros);

                if (res)
                {
                    strMensaje = mensaje.Value.ToString();
                    return(Convert.ToBoolean(respuesta.Value));
                }
                else
                {
                    strMensaje = "No hay conexion con el servidor";
                    return(false);
                }
            }
            catch (Exception ex)
            {
                strMensaje = ex.Message;
                return(false);
            }
        }
예제 #5
0
 protected override bool ReleaseHandle()
 => Pdh.PdhCloseQuery(handle) == PdhStatus.PDH_CSTATUS_VALID_DATA;
예제 #6
0
 public static PdhQuery OpenRealtimeQuery()
 {
     Pdh.PdhOpenQuery(null, IntPtr.Zero, out var pdhQuery).EnsureSuccess(nameof(Pdh.PdhOpenQuery));
     return(pdhQuery);
 }
예제 #7
0
 public static unsafe PdhStatus GetFormattedCounterArray(this PdhCounter counter, ref int bufferSize,
                                                         out int itemCount, PDH_FMT_COUNTERVALUE_ITEM *buffer) =>
 Pdh.PdhGetFormattedCounterArray(counter, DefaultFmt, ref bufferSize, out itemCount, buffer);
예제 #8
0
 public static unsafe PdhStatus GetRawCounterArray(this PdhCounter counter, ref int bufferSize,
                                                   out int itemCount, PDH_RAW_COUNTER_ITEM *buffer) =>
 Pdh.PdhGetRawCounterArray(counter, ref bufferSize, out itemCount, buffer);
예제 #9
0
 public static PdhStatus GetFormattedValue(this PdhCounter counter, out PDH_FMT_COUNTERVALUE value)
 => Pdh.PdhGetFormattedCounterValue(
     counter,
     DefaultFmt,
     out _,
     out value);
예제 #10
0
 public static PdhStatus CollectQueryData(this PdhQuery query) => Pdh.PdhCollectQueryData(query);
 private void Init()
 {
     Pdh.PdhOpenQuery(null, IntPtr.Zero, out pdhQuery).EnsureSuccess(nameof(Pdh.PdhOpenQuery));
     pdhCounter = pdhQuery.AddCounter(path);
 }