public ActionResult GenerarTodo(ActualizacionPAModel model) { var mensaje = ""; var mensaje2 = ""; var exito = true; var exito2 = true; if (sesion == null) { sesion = SessionDB.start(Request, Response, false, db); } model.sesion = sesion; try { if (model.GenerarTodo(Convert.ToString(sesion.pkUser))) { Log.write(this, "GenerarTodo", LOG.EDICION, "Se han importado todos los registros", model.sesion); mensaje = "Los datos se ha actualizado satisfactoriamente."; exito = true; } else { mensaje = "No se ha podido hacer la Generación completa."; exito = false; } if (model.EliminaPA(Convert.ToString(sesion.pkUser))) { Log.write(this, "EliminaPA", LOG.EDICION, "Se han eliminado los registros", model.sesion); mensaje2 = "Se han eliminado los registros de la Programación Académica en la base de datos de Pago a Profesores"; exito2 = true; model.ReInsertaNomina(); // acomodarlo de una mejor manera model.ReInsertaEstadoCuenta(); // acomodarlo de una mejor manera } else { mensaje2 = "No se han podido eliminar los registros de la Programación Académica."; exito2 = false; } if (exito == true && exito2 == true) { return(Json(new { msg = Notification.Succes(mensaje + "\n" + mensaje2) })); } else if ((exito == true && exito2 == false) || (exito == false && exito2 == true)) { return(Json(new { msg = Notification.Warning(mensaje + "\n" + mensaje2) })); } else// if (exito == false && exito2 == false) { return(Json(new { msg = Notification.Error(mensaje + "\n" + mensaje2) })); } } catch (Exception e) { return(Json(new { msg = Notification.Error(e.Message) })); } }
public ActionResult Start() { ActualizacionPAModel model = new ActualizacionPAModel(); if (sesion == null) { sesion = SessionDB.start(Request, Response, false, db); } model.sesion = sesion; Main view = new Main(); ViewBag.MainUser = view.CreateMenuInfoUser(sesion); ViewBag.sedes = view.createSelectSedes("Sedes", sesion); ViewBag.Main = view.createMenu("Pagos", "Actualización de la PA", sesion); //Intercom ViewBag.User = sesion.nickName.ToString(); ViewBag.Email = sesion.nickName.ToString(); ViewBag.FechaReg = DateTime.Today; sesion.vdata["TABLE_PA"] = "PA_TMP"; sesion.saveSession(); ViewBag.BlockingPanel_1 = Main.createBlockingPanel("blocking-panel-1"); ViewBag.BlockingPanel_2 = Main.createBlockingPanel("blocking-panel-2", false, ""); model.CleanPersona(); model.CleanPA(); ViewBag.DataTable = CreateDataTable(10, 1, null, "NRC", "ASC", sesion); //ViewBag.DataTable = CreateDataTable(10, 1, null, "IdPA", "ASC", sesion); ViewBag.COMBO_CAMPUSPA = getCampusPA(); ViewBag.Scripts = Scripts.addScript() + Scripts.setPrivileges(Privileges, sesion); if (!sesion.permisos.havePermission(Privileges[0].Permiso)) { return(View(Factory.View.NotAccess)); } Log.write(this, "PA Start", LOG.CONSULTA, "Ingresa pantalla PA", sesion); return(View(Factory.View.Access + "Pagos/ActualizacionPA/Start.cshtml")); }
public ActionResult actualizaNomina(ActualizacionPAModel model) { //if (sesion == null) { sesion = SessionDB.start(Request, Response, false, db); } //model.sesion = sesion; try { if (model.ActualizaNomina()) { Log.write(this, "ActualizaNomina: Insertar nomina", LOG.EDICION, "SP", sesion); return(Json(new { msg = Notification.Succes("Los datos se ha actualizado satisfactoriamente.") })); } else { Log.write(this, "ActualizaNomina: Insertar nomina", LOG.EDICION, "SP", sesion); return(Json(new { msg = Notification.Error("No se han podido realizar los cálculos.") })); } } catch (Exception e) { return(Json(new { msg = Notification.Error(e.Message) })); } }
public ActionResult generarEdoCta(ActualizacionPAModel model) { if (sesion == null) { sesion = SessionDB.start(Request, Response, false, db); } Debug.WriteLine("controller ActualizacionPA"); try { //if (model.insertaEntregaContratosXEsquemaPago()) //{ // Log.write(this, "(Re) Generación de estado de cuenta: Insertar entrega de contratos", LOG.EDICION, "SQL:" + model.sql, sesion); if (model.calculaEstadocuentaXRegistroNomina(sesion.pkUser.ToString())) { Log.write(this, "(Re) Generación de estado de cuenta: Cálculo estado de cuenta", LOG.EDICION, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Succes("Se ha generado la entrega de contratos y se han realizado los cálculos para el estado de cuenta.") })); } else { Log.write(this, "(Re) Generación de estado de cuenta: Cálculo estado de cuenta", LOG.EDICION, "SQL:" + model.sql + ", IdPersona: " + model.IdPersona, sesion); return(Json(new { msg = Notification.Error("Se ha realizado el registro de entrega de contratos, pero el cálculo de estado de cuenta no se generó. IdPersona: " + model.IdPersona) })); } //} //else //{ // Log.write(this, "(Re) Generación de estado de cuenta: Insertar entrega de contratos", LOG.EDICION, "SQL:" + model.sql, sesion); // return Json(new { msg = Notification.Error("Hubo un error al generar la entrega de contratos") }); //} } catch (Exception e) { return(Json(new { msg = Notification.Error(e.Message) })); } }
//GET CREATE DATATABLE public string CreateDataTable(int show, int pg, string search, string orderby, string sort, SessionDB sesion, string periodo = "", string partePeriodo = "", string opcionPago = "", string campusVPDI = "", string campusPA = "", string Escuela = "") { if (sesion == null) { sesion = SessionDB.start(Request, Response, false, db); } ActualizacionPAModel model = new ActualizacionPAModel(); model.cleanPAExcelTMP(sesion); DataTableCompare table = new DataTableCompare(); //string CheckIcon = "<i class=\"fa fa-check\"></i>"; table.TABLE = sesion.vdata["TABLE_PA"]; string[] columnas = { "Estatus", "IDSIU", "Docente(NOMBRE)", "Docente(Apellido)", "Campus", "Escuela", "NRC", "Materia", "Curso" , "Nombre de Materia", "Fecha Inicio", "Fecha Fin", "Tipo de Curso", "Metodo de Instrucción" , "Status", "Inscritos", "Parte del periodo", "Descripción de parte del periodo" , "Tipo de Docente", "Máximo Grado Académico", "Horas Semanales", "Horas Programadas" , "% de Responsabilidad", "Horas a Pagar", "Opción de Pago", "Tabulador", "Indicador de sesión", "Periodo" }; string[] campos = { "IP", "IDSIU", "NOMBRE", "APELLIDOS", "CAMPUS_INB", "ESCUELA", "NRC", "MATERIA", "CURSO" , "NOMBREMATERIA", "FECHAINICIAL", "FECHAFINAL", "TIPODECURSO", "METODODEINSTRUCCION" , "STATUS", "INSCRITOS", "PARTEDELPERIODO", "PARTEDELPERIODODESC", "TIPODEDOCENTE" , "MAXIMOGRADOACADEMICO", "HORASSEMANALES", "HORASPROGRAMADAS", "RESPONSABILIDAD", "HORASAPAGAR" , "OPCIONDEPAGO", "TABULADOR", "INDICADORDESESION", "PERIODO", "USUARIO" , "CVE_ESCUELA", "CVE_TIPODEDOCENTE", "CVE_OPCIONDEPAGO" }; string[] campossearch = { "CAMPUS_INB", "ESCUELA", "MATERIA", "NRC", "CURSO" , "NOMBREMATERIA", "FECHAINICIAL", "FECHAFINAL", "TIPODECURSO", "METODODEINSTRUCCION" , "STATUS", "INSCRITOS", "PARTEDELPERIODO", "PARTEDELPERIODODESC", "IDSIU","APELLIDOS", "NOMBRE", "TIPODEDOCENTE" , "MAXIMOGRADOACADEMICO", "HORASSEMANALES", "HORASPROGRAMADAS", "RESPONSABILIDAD", "HORASAPAGAR" , "OPCIONDEPAGO", "TABULADOR", "INDICADORDESESION", "PERIODO" }; string[] camposhidden = { "USUARIO", "CVE_ESCUELA", "CVE_TIPODEDOCENTE", "CVE_OPCIONDEPAGO" }; //table.dictColumnFormat["REGISTRADO"] = delegate (string str, ResultSet res) { return str == "True" ? CheckIcon : ""; }; //table.dictColumnFormat.Add("IdPA", delegate (string value, ResultSet res) //{ // return "<div style=\"width:120px;\">" + value + "</div>"; //}); //table.dictColumnFormat.Add("NOMBRE", delegate (string value, ResultSet res) //{ // return "<div style=\"width:120px;\">" + value + "</div>"; //}); //TiposPagosController tp = new TiposPagosController(); //opcionPago = tp.getTiposPagoV(); table.CAMPOS = campos; table.COLUMNAS = columnas; table.CAMPOSSEARCH = campossearch; table.orderby = orderby; table.sort = sort; table.show = show; table.pg = pg; table.search = search; table.field_id = "IDSIU"; table.CAMPOSHIDDEN = camposhidden; table.enabledButtonControls = false; table.TABLECONDICIONSQL = "USUARIO =" + sesion.pkUser; //if (opcionPago != "" && opcionPago != null) //{ // switch (opcionPago) // { // case "A": // opcionPago = "ADI"; // break; // case "H": // opcionPago = "HDI"; // break; // default: // opcionPago = "-X1"; //No existe está opción de pago // break; // } //} var sql = " PERIODO = '" + periodo + "'"; if (partePeriodo != "" && partePeriodo != null) { sql += " AND PARTEDELPERIODO = '" + partePeriodo + "'"; } if (opcionPago != "" && opcionPago != null) { sql += " AND CVE_TIPODEPAGO = '" + opcionPago + "'"; } if (Escuela != "" && Escuela != null) { sql += " AND CVE_ESCUELA = '" + Escuela + "'"; } sql += " AND CVE_SEDE = '" + campusVPDI + "'"; table.TABLECONDICIONSQL2 = sql; table.USUARIO = sesion.pkUser.ToString(); table.ESCUELA = Escuela; table.PERIODO = periodo; table.SEDE = campusVPDI; table.CAMPUS_INB = campusPA; table.PARTEDELPERIODO = partePeriodo; table.OPCIONDEPAGO = opcionPago; return(table.CreateDataTable(sesion)); }
public string Consultar(string Periodo, string TipoDeContrato, string TipoPago, string Escuela, string Campus, string CampusPA, string TipoDocente, string PartePeriodo, string Opc) { if (sesion == null) { sesion = SessionDB.start(Request, Response, false, db); } TipoDocenteController td = new TipoDocenteController(); TipoDocente = td.getTipoDocente(); TiposPagosController tp = new TiposPagosController(); TipoPago = tp.getTiposPagoV(); string paURL = ConfigurationManager.AppSettings["xURL"]; string paUser = ConfigurationManager.AppSettings["xUser"]; string paSecret = ConfigurationManager.AppSettings["xSecret"]; string paFormat = ConfigurationManager.AppSettings["xFormat"]; ConnectUrlToken.ConnectUrlToken con = new ConnectUrlToken.ConnectUrlToken(paURL, paUser, paSecret, paFormat); JavaScriptSerializer serializer = new JavaScriptSerializer(); string str_json = serializer.Serialize( new srvDatosProgramacionAcademica { periodo = Periodo, escuela = Escuela, tipoContrato = TipoDeContrato, tipoDocente = TipoDocente, campusPA = CampusPA, campusVPDI = Campus, tipoPago = TipoPago, partePeriodo = PartePeriodo, }); Token token = con.getToken(); int maxDatos = 0; int agregados = 0; try { ActualizacionPAModel aux = new ActualizacionPAModel(); aux.sesion = sesion; (aux as IPersona).CleanPersona(); (aux as IPA).CleanPA(); sesion.vdata["sesion_periodo"] = Periodo; ActualizacionPAModel[] models = con.connectX <ActualizacionPAModel[]>(token, "srvDatosProgramacionAcademica", str_json); maxDatos = models.Length; agregados = ActualizacionPAModel.Consultar(models, sesion); sesion.vdata["TABLE_PA"] = "PA_TMP"; sesion.saveSession(); if (models.Length > 0) { if (models.Length == agregados) { return(Notification.Succes("Datos consultados: " + agregados + " / " + maxDatos)); } else { return(Notification.Warning("Datos consultados: " + agregados + " / " + maxDatos)); } } else { return(Notification.Warning("No se han encontrado datos con los filtros especificados.")); } } catch (Exception ex) { Debug.WriteLine("Error." + ex.Message); } //return "-1";// CreateDataTable(10, 1, null, "IDSIU","ASC",sesion); return(Notification.Error("Ocurrio un error al consultar la informacion. Registros consultados: " + agregados + " / " + maxDatos)); }