public ActionResult DeleteCalendarPagos(EsquemasModel 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.DeleteCalendarPagos()) { Log.write(this, "Delete", LOG.BORRADO, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Succes("Esquema ELIMINADO con exito: " + model.Banco) })); } else { Log.write(this, "Delete", LOG.ERROR, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Error(" Error al Eliminar: " + model.Banco) })); } } catch (Exception e) { return(Json(new { msg = Notification.Error(e.Message) })); } }
public ActionResult Save(EsquemasModel 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.Save()) { Log.write(this, "Save", LOG.EDICION, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Succes("Esquema guardado con exito: " + model.esquema) })); } else { Log.write(this, "Save", LOG.ERROR, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Error(" Error al GUARDAR: " + model.esquema) })); } } catch (Exception e) { return(Json(new { msg = Notification.Error(e.Message) })); } }
public ActionResult Add(EsquemasModel 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()) { if (model.existe) { Log.write(this, "Add", LOG.REGISTRO, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Succes("Esquema agregado con exito: " + model.esquema), IdEsquema = model.Clave })); } else {//ya existe Log.write(this, "Add", LOG.REGISTRO, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Warning("El registro con Esquema: " + model.esquema + " y Periodo: " + model.periodos + ", Ya existe!"), IdEsquema = model.Clave })); } } else { Log.write(this, "Add", LOG.ERROR, "SQL:" + model.sql, sesion); if (model.errorMsg == "2627") { return(Json(new { msg = Notification.Error("Error al agregar, el nombre del esquema no puede repetirse: " + model.esquema) })); } else { return(Json(new { msg = Notification.Error("Error al agregar: " + model.esquema) })); } } } catch (Exception e) { return(Json(new { msg = Factory.Notification.Error(e.Message) })); } }
public ActionResult EditCalendarPagos(EsquemasModel model) { Debug.WriteLine("controller CalendarPagos"); if (model.EditCalendarPagos()) { Debug.WriteLine("controller edit2"); return(Json(new JavaScriptSerializer().Serialize(model))); } return(View()); }
string getTiposDeBloqueo(EsquemasModel model) { string html = string.Empty; int contador = 0; Dictionary <string, string> dict = model.Obtener_TipoBloqueo(); foreach (KeyValuePair <string, string> pair in dict) { html += "<div class=\"col-md-2\"> <div class=\"form-group\"><label> " + pair.Value + "</label><br><input id='TipoBloqueo_" + (contador++) + "' data-idbloqueo='" + pair.Key + "' type='checkbox' value='" + pair.Key + "'></div></div>\n"; } html += "<input type='hidden' id='TipoBloqueo_length' value='" + contador + "'>"; return(html); }
public ActionResult ConsultaPeriodos(EsquemasModel model) { Debug.WriteLine("controller ConsultaPeriodos"); if (model.Obtener_Periodos()) { return(Json(new { periodos = model.periodos })); } return(View(Factory.View.Access + "Esquemas/Start.cshtml")); }
string getTiposDeBloqueo(EsquemasModel model) { string html = string.Empty; int contador = 0; Dictionary <string, string> dict = model.Obtener_TipoBloqueo(); foreach (KeyValuePair <string, string> pair in dict) { html += "<label class='radio-inline'>\n<input id='TipoBloqueo_" + (contador++) + "' data-idbloqueo='" + pair.Key + "' type='checkbox' value='" + pair.Key + "'> " + pair.Value + "\n</label>"; } html += "<input type='hidden' id='TipoBloqueo_length' value='" + contador + "'>"; return(html); }
public ActionResult AddCalendarPagos(EsquemasModel 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.AddCalendarPagos()) { Log.write(this, "AddCalendarPagos", LOG.REGISTRO, "SQL:" + model.sql, sesion); if (model.msg.Trim() == "EXCEDIDO") { return(Json(new { msg = Notification.Warning("No se puede agregar el pago, ya que el numero Maximo de pagos para este esquema es: " + model.npagos), })); } else { return(Json(new { msg = Notification.Succes("Calendario_de_Pagos agregado con exito: " + model.conceptoPago), idPagosF = model.idPagosF })); } } else { Log.write(this, "AddCalendarPagos", LOG.ERROR, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Error("Error al agregar: " + model.conceptoPago) })); } } catch (Exception e) { return(Json(new { msg = Factory.Notification.Error(e.Message) })); } }
// GET: Esquemas public ActionResult Start() { if ((sesion = SessionDB.start(Request, Response, false, db)) == null) { return(Content("-1")); } Main view = new Main(); ViewBag.MainUser = view.CreateMenuInfoUser(sesion); ViewBag.Main = view.createMenu("Esquemas de Pago", "Esquemas", sesion); ViewBag.sedes = view.createSelectSedes("Sedes", sesion); ViewBag.DataTable = CreateDataTable(10, 1, null, "FECHAINICIO", "ASC"); ViewBag.DataTableCalendarPago = CreateDataTableCalendarP(10, 1, null, "ID_ESQUEMA", "ASC"); ViewBag.Scripts = Scripts.addScript() + Scripts.setPrivileges(Privileges, sesion); //Intercom ViewBag.User = sesion.nickName.ToString(); ViewBag.Email = sesion.nickName.ToString(); ViewBag.FechaReg = DateTime.Today; if (!sesion.permisos.havePermission(Privileges[0].Permiso)) { return(View(Factory.View.NotAccess)); } Log.write(this, "Esquemas de pago Start", LOG.CONSULTA, "Ingresa pantalla Esquema", sesion); ViewBag.sede = view.createLevels(sesion, "sedes"); EsquemasModel model = new EsquemasModel(); // comboTipoContarto model.Obtener_TipoContrato(); ViewBag.TIPO_CONTRATO = model.tipocontrato; //Combo CONCEPTO PAGO model.Obtener_ConceptoPago(); ViewBag.CONCEPTO_PAGO = model.conceptoPago; //Combo TipoBloqueo ViewBag.TIPO_BLOQUEO = getTiposDeBloqueo(model); return(View(Factory.View.Access + "EsquemasdePago/Start.cshtml")); }
public ActionResult updateEdoCtaCalendarPagos(EsquemasModel 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.ExisteEsquema_FechaPago_Edit()) //{ if (model.UpdateEdoCtaCalendarPagos()) { Log.write(this, "Save", LOG.EDICION, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Succes("Se han modificado las fechas de pago con éxito, para el concepto de pago: " + model.conceptoPago) })); } else { Log.write(this, "Save", LOG.ERROR, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Error(" Error al MODIFICAR: " + model.conceptoPago) })); } //} //else //{ // Log.write(this, "ExisteEsquema_FechaPago_Edit", LOG.CONSULTA, "SQL:" + model.sql, sesion); // return Json(new { msg = Notification.Warning("Ya existe en el esquema la fecha de pago: " + model.fechaPago) }); //} } catch (Exception e) { return(Json(new { msg = Notification.Error(e.Message) })); } }
public ActionResult AddCalendarPagosECP(EsquemasModel 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.AddCalendarPagosEC()) { Log.write(this, "AddCalendarPagos", LOG.REGISTRO, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Succes("Calendario_de_Pagos agregado con exito: " + model.conceptoPago), idPagosF = model.idPagosF })); } else { Log.write(this, "AddCalendarPagos", LOG.ERROR, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Error("Error al agregar: " + model.conceptoPago) })); } } catch (Exception e) { return(Json(new { msg = Factory.Notification.Error(e.Message) })); } }