Пример #1
0
        public UUser subirNota(string alumno, string materia, string curso, string nota1, string nota2, string nota3, int selIdioma, string sesion)
        {
            DMReg       datos      = new DMReg();
            UUser       enc        = new UUser();
            UIdioma     encId      = new UIdioma();
            Nota        not        = new Nota();
            LMIdioma    idioma     = new LMIdioma();
            DMSeguridad dmseg      = new DMSeguridad();
            MEncNota    mencnota   = new MEncNota();
            Int32       FORMULARIO = 39;


            encId = idioma.obtIdioma(FORMULARIO, selIdioma);

            enc.Mensaje = " ";

            if (alumno == "0" || materia == "0" || curso == "0")
            {
                enc.Mensaje = encId.CompIdioma["L_Falta_Selec"].ToString(); //"Falta seleccionar";
            }
            else
            {
                enc.Id_estudiante = alumno;
                enc.Materia       = materia;
                enc.Curso         = curso;
                List <Nota> registros = datos.obtenerNota(enc);
                //DataTable registros = datos.obtenerNota(enc);
                foreach (Nota no in registros)
                {
                    enc.IdNota  = no.id_nota.ToString();
                    not.id_nota = no.id_nota;
                }

                Double n1 = Convert.ToDouble(nota1);
                Double n2 = Convert.ToDouble(nota2);
                Double n3 = Convert.ToDouble(nota3);

                Double nd = (n1 + n2 + n3) / 3.0;

                enc.Nota1 = n1.ToString();
                enc.Nota2 = n2.ToString();
                enc.Nota3 = n3.ToString();

                enc.Notadef = nd.ToString();

                not.nota1 = n1;
                not.nota2 = n2;
                not.nota3 = n3;

                not.notadef = nd;
                datos.insertarNota(not);
                mencnota.nota1_nuevo   = not.nota1.ToString();
                mencnota.nota2_nuevo   = not.nota2.ToString();
                mencnota.nota3_nuevo   = nota3.ToString();
                mencnota.notadef_nuevo = not.notadef.ToString();
                dmseg.fiel_auditoria_registro_nota("INSERT", sesion, mencnota);
            }
            return(enc);
        }
        public void fiel_auditoria_registro_nota(string _accion, string sesion, MEncNota enc)
        {
            Auditoria au = new Auditoria();

            au.fecha   = DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second;
            au.accion  = _accion;
            au.schema  = "registro";
            au.tabla   = "nota";
            au.pk      = "1";
            au.session = sesion;
            au.user_bd = "postgres";
            if (_accion == "INSERT")
            {
                au.data = JsonConvert.SerializeObject(enc);
                using (var db = new Mapeo("public"))
                {
                    db.auditoria.Add(au);
                    db.SaveChanges();
                }
            }
        }