private clsGestionVM GestionFind(int gestionId) { clsGestion oGestion = new clsGestion(clsAppInfo.Connection); clsGestionVM oGestionVM = new clsGestionVM(); try { oGestion.VM.GestionId = gestionId; if (oGestion.FindByPK()) { oGestionVM = oGestion.VM; return(oGestionVM); } return(null); } catch (Exception exp) { throw exp; } finally { oGestion.Dispose(); } return(oGestionVM); }
public ActionResult DeleteConfirmed(int id) { try { if (ReferenceEquals(id, null)) { return(RedirectToAction("httpErrorMsg", "Error", new { MessageErr = "Índice nulo o no encontrado" })); } clsGestion oGestion = new clsGestion(clsAppInfo.Connection); oGestion.WhereFilter = clsGestion.WhereFilters.PrimaryKey; oGestion.VM.GestionId = id; if (oGestion.Delete()) { return(RedirectToAction("Index")); } return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } catch (Exception exp) { return(RedirectToAction("httpErrorMsg", "Error", new { MessageErr = exp.Message })); } }
//--------------------- private void DataMove(clsGestionVM oGestionVM, clsGestion oGestion, bool boolEditing) { if (boolEditing) { oGestion.VM.GestionId = SysData.ToLong(oGestionVM.GestionId); } oGestion.VM.GestionNro = SysData.ToInteger(oGestionVM.GestionNro); oGestion.VM.GestionFecIni = SysData.ToDate(oGestionVM.GestionFecIni); oGestion.VM.GestionFecFin = SysData.ToDate(oGestionVM.GestionFecFin); oGestion.VM.EstadoId = SysData.ToLong(oGestionVM.EstadoId); }
public ActionResult Create(clsGestionVM oGestionVM) { try { String error = null; if (ModelState.IsValid) { clsGestion oGestion = new clsGestion(clsAppInfo.Connection); int gestionIni = oGestionVM.GestionFecIni.Year; int gestionFin = oGestionVM.GestionFecFin.Year; if (oGestionVM.GestionNro != gestionIni) { error = "El nro gestion debe coincidir con las fechas"; } if (SysData.FechaMayor(oGestionVM.GestionFecIni, oGestionVM.GestionFecFin) == cFecha.Mayor || SysData.FechaMayor(oGestionVM.GestionFecIni, oGestionVM.GestionFecFin) == cFecha.Igual) { error = error + " - La fecha inicio debe ser menor a la fecha fin"; } if (String.IsNullOrEmpty(error)) { DataMove(oGestionVM, oGestion, false); if (oGestion.Insert()) { return(RedirectToAction("Index")); } } } ViewBag.MessageErr = error; return(View(oGestionVM)); } catch (Exception exp) { ViewBag.MessageErr = exp.Message; return(View(oGestionVM)); } }
public List <clsGestionVM> GestionList() { clsGestion oGestion = new clsGestion(clsAppInfo.Connection); List <clsGestionVM> oGestionVM = new List <clsGestionVM>(); try { oGestion.SelectFilter = clsGestion.SelectFilters.Grid; oGestion.WhereFilter = clsGestion.WhereFilters.Grid; oGestion.OrderByFilter = clsGestion.OrderByFilters.Grid; if (oGestion.Open()) { foreach (DataRow dr in oGestion.DataSet.Tables[oGestion.TableName].Rows) { oGestionVM.Add(new clsGestionVM() { GestionId = SysData.ToLong(dr[clsGestionVM._GestionId]), GestionNro = SysData.ToInteger(dr[clsGestionVM._GestionNro]), GestionFecIni = SysData.ToDate(dr[clsGestionVM._GestionFecIni]), GestionFecFin = SysData.ToDate(dr[clsGestionVM._GestionFecFin]), EstadoDes = SysData.ToStr(dr[clsGestionVM._EstadoDes]) }); } } return(oGestionVM); } catch (Exception exp) { throw exp; } finally { oGestion.Dispose(); } return(oGestionVM); }
public static List <clsGestionVM> GestionList() { clsGestion oGestion = new clsGestion(clsAppInfo.Connection); List <clsGestionVM> oGestionVM = new List <clsGestionVM>(); try { DateTime date = DateTime.Today; oGestion.SelectFilter = clsGestion.SelectFilters.Grid; oGestion.WhereFilter = clsGestion.WhereFilters.Grid; if (oGestion.Open()) { foreach (DataRow dr in oGestion.DataSet.Tables[oGestion.TableName].Rows) { oGestionVM.Add(new clsGestionVM() { GestionId = SysData.ToLong(dr["GestionId"]), GestionNro = SysData.ToInteger(dr["GestionNro"]), GestionFecIni = SysData.ToDate(dr["GestionFecIni"]), GestionFecFin = SysData.ToDate(dr["GestionFecFin"]) }); } } return(oGestionVM); } catch (Exception exp) { throw exp; } finally { oGestion.Dispose(); } return(oGestionVM); }