예제 #1
0
    protected string Grabar(string sSegMesProy, string sAvanceProd)
    {
        string sResul           = "";
        bool   bErrorControlado = false;

        #region apertura de conexión y transacción
        try
        {
            oConn = Conexion.Abrir();
            tr    = Conexion.AbrirTransaccionSerializable(oConn);
        }
        catch (Exception ex)
        {
            sResul = "Error@#@" + Errores.mostrarError("Error al abrir la conexión", ex);
            return(sResul);
        }
        #endregion

        try
        {
            if (Session["ADMINISTRADOR_PC_ACTUAL"].ToString() != "SA")
            {
                SEGMESPROYECTOSUBNODO oSMPSN = SEGMESPROYECTOSUBNODO.Obtener(tr, int.Parse(sSegMesProy), null);
                if (oSMPSN.t325_estado == "C")
                {
                    bErrorControlado = true;
                    throw (new Exception("Durante su intervención en la pantalla, otro usuario ha cerrado el mes en curso."));
                }
            }
            SEGMESPROYECTOSUBNODO.UpdateConsumoPeriodificacion(tr, int.Parse(sSegMesProy), decimal.Parse(sAvanceProd));
            Conexion.CommitTransaccion(tr);
            sResul = "OK@#@";
        }
        catch (Exception ex)
        {
            Conexion.CerrarTransaccion(tr);
            if (!bErrorControlado)
            {
                sResul = "Error@#@" + Errores.mostrarError("Error al grabar los consumos de periodificación.", ex);
            }
            else
            {
                sResul = "Error@#@Operación rechazada.\n\n" + ex.Message;
            }
        }
        finally
        {
            Conexion.Cerrar(oConn);
        }
        return(sResul);
    }