/// <summary> ///</summary> /// <param name="CatalogoPeriodosCorte"> Object CatalogoPeriodosCorte added to List</param> public override int AddCatalogoPeriodosCorte(CatalogoPeriodosCorteEntity entity_CatalogoPeriodosCorte) { int result = 0; using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.CatalogoPeriodosCorte.ConnectionString)) { SqlCommand comandoSql = CreateCommand("Softv_CatalogoPeriodosCorteAdd", connection); AssingParameter(comandoSql, "@Clv_Periodo", null, pd: ParameterDirection.Output, IsKey: true); AssingParameter(comandoSql, "@Descripcion", entity_CatalogoPeriodosCorte.Descripcion); AssingParameter(comandoSql, "@Habilitar", entity_CatalogoPeriodosCorte.Habilitar); try { if (connection.State == ConnectionState.Closed) { connection.Open(); } result = ExecuteNonQuery(comandoSql); } catch (Exception ex) { throw new Exception("Error adding CatalogoPeriodosCorte " + ex.Message, ex); } finally { connection.Close(); } result = (int)comandoSql.Parameters["@Clv_Periodo"].Value; } return(result); }
public ActionResult Edit(CatalogoPeriodosCorteEntity objCatalogoPeriodosCorte) { if (ModelState.IsValid) { objCatalogoPeriodosCorte.BaseRemoteIp = RemoteIp; objCatalogoPeriodosCorte.BaseIdUser = LoggedUserName; int result = proxy.UpdateCatalogoPeriodosCorte(objCatalogoPeriodosCorte); if (result == -1) { CatalogoPeriodosCorteEntity objCatalogoPeriodosCorteOld = proxy.GetCatalogoPeriodosCorte(objCatalogoPeriodosCorte.Clv_Periodo); AssingMessageScript("El CatalogoPeriodosCorte ya existe en el sistema, .", "error", "Error", true); CheckNotify(); return(View(objCatalogoPeriodosCorte)); } if (result > 0) { AssingMessageScript("El CatalogoPeriodosCorte se modifico en el sistema.", "success", "Éxito", true); CheckNotify(); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); } return(View(objCatalogoPeriodosCorte)); }
public ActionResult Details(int id = 0) { CatalogoPeriodosCorteEntity objCatalogoPeriodosCorte = proxy.GetCatalogoPeriodosCorte(id); if (objCatalogoPeriodosCorte == null) { return(HttpNotFound()); } return(PartialView(objCatalogoPeriodosCorte)); }
public ActionResult Edit(int id = 0) { PermisosAccesoDeniedEdit("CatalogoPeriodosCorte"); ViewBag.CustomScriptsPageValid = BuildScriptPageValid(); CatalogoPeriodosCorteEntity objCatalogoPeriodosCorte = proxy.GetCatalogoPeriodosCorte(id); if (objCatalogoPeriodosCorte == null) { return(HttpNotFound()); } return(View(objCatalogoPeriodosCorte)); }
/// <summary> /// Converts data from reader to entity /// </summary> protected virtual CatalogoPeriodosCorteEntity GetCatalogoPeriodosCorteFromReader(IDataReader reader) { CatalogoPeriodosCorteEntity entity_CatalogoPeriodosCorte = null; try { entity_CatalogoPeriodosCorte = new CatalogoPeriodosCorteEntity(); entity_CatalogoPeriodosCorte.Clv_Periodo = (int?)(GetFromReader(reader, "Clv_Periodo")); entity_CatalogoPeriodosCorte.Descripcion = (String)(GetFromReader(reader, "Descripcion", IsString: true)); entity_CatalogoPeriodosCorte.Habilitar = (int?)(GetFromReader(reader, "Habilitar")); } catch (Exception ex) { throw new Exception("Error converting CatalogoPeriodosCorte data to entity", ex); } return(entity_CatalogoPeriodosCorte); }
public ActionResult QuickIndex(int?page, int?pageSize, String Descripcion, int?Habilitar) { int pageNumber = (page ?? 1); int pSize = pageSize ?? SoftvMVC.Properties.Settings.Default.pagnum; SoftvList <CatalogoPeriodosCorteEntity> listResult = null; List <CatalogoPeriodosCorteEntity> listCatalogoPeriodosCorte = new List <CatalogoPeriodosCorteEntity>(); CatalogoPeriodosCorteEntity objCatalogoPeriodosCorte = new CatalogoPeriodosCorteEntity(); CatalogoPeriodosCorteEntity objGetCatalogoPeriodosCorte = new CatalogoPeriodosCorteEntity(); if ((Descripcion != null && Descripcion.ToString() != "")) { objCatalogoPeriodosCorte.Descripcion = Descripcion; } if ((Habilitar != null)) { objCatalogoPeriodosCorte.Habilitar = Habilitar; } pageNumber = pageNumber == 0 ? 1 : pageNumber; listResult = proxy.GetCatalogoPeriodosCortePagedListXml(pageNumber, pSize, Globals.SerializeTool.Serialize(objCatalogoPeriodosCorte)); if (listResult.Count == 0) { int tempPageNumber = (int)(listResult.totalCount / pSize); pageNumber = (int)(listResult.totalCount / pSize) == 0 ? 1 : tempPageNumber; listResult = proxy.GetCatalogoPeriodosCortePagedListXml(pageNumber, pSize, Globals.SerializeTool.Serialize(objCatalogoPeriodosCorte)); } listResult.ToList().ForEach(x => listCatalogoPeriodosCorte.Add(x)); var CatalogoPeriodosCorteAsIPagedList = new StaticPagedList <CatalogoPeriodosCorteEntity>(listCatalogoPeriodosCorte, pageNumber, pSize, listResult.totalCount); if (CatalogoPeriodosCorteAsIPagedList.Count > 0) { return(PartialView(CatalogoPeriodosCorteAsIPagedList)); } else { var result = new { tipomsj = "warning", titulomsj = "Aviso", Success = "False", Message = "No se encontraron registros con los criterios de búsqueda ingresados." }; return(Json(result, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// Gets CatalogoPeriodosCorte by ///</summary> public override CatalogoPeriodosCorteEntity GetCatalogoPeriodosCorteById(int?Clv_Periodo) { using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.CatalogoPeriodosCorte.ConnectionString)) { SqlCommand comandoSql = CreateCommand("Softv_CatalogoPeriodosCorteGetById", connection); CatalogoPeriodosCorteEntity entity_CatalogoPeriodosCorte = null; AssingParameter(comandoSql, "@Clv_Periodo", Clv_Periodo); IDataReader rd = null; try { if (connection.State == ConnectionState.Closed) { connection.Open(); } rd = ExecuteReader(comandoSql, CommandBehavior.SingleRow); if (rd.Read()) { entity_CatalogoPeriodosCorte = GetCatalogoPeriodosCorteFromReader(rd); } } catch (Exception ex) { throw new Exception("Error getting data CatalogoPeriodosCorte " + ex.Message, ex); } finally { if (connection != null) { connection.Close(); } if (rd != null) { rd.Close(); } } return(entity_CatalogoPeriodosCorte); } }
public ActionResult Create(CatalogoPeriodosCorteEntity objCatalogoPeriodosCorte) { if (ModelState.IsValid) { objCatalogoPeriodosCorte.BaseRemoteIp = RemoteIp; objCatalogoPeriodosCorte.BaseIdUser = LoggedUserName; int result = proxy.AddCatalogoPeriodosCorte(objCatalogoPeriodosCorte); if (result == -1) { AssingMessageScript("El CatalogoPeriodosCorte ya existe en el sistema.", "error", "Error", true); CheckNotify(); return(View(objCatalogoPeriodosCorte)); } if (result > 0) { AssingMessageScript("Se dio de alta el CatalogoPeriodosCorte en el sistema.", "success", "Éxito", true); return(RedirectToAction("Index")); } } return(View(objCatalogoPeriodosCorte)); }
/// <summary> /// Edits a CatalogoPeriodosCorte ///</summary> /// <param name="CatalogoPeriodosCorte"> Objeto CatalogoPeriodosCorte a editar </param> public override int EditCatalogoPeriodosCorte(CatalogoPeriodosCorteEntity entity_CatalogoPeriodosCorte) { int result = 0; using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.CatalogoPeriodosCorte.ConnectionString)) { SqlCommand comandoSql = CreateCommand("Softv_CatalogoPeriodosCorteEdit", connection); AssingParameter(comandoSql, "@Clv_Periodo", entity_CatalogoPeriodosCorte.Clv_Periodo); AssingParameter(comandoSql, "@Descripcion", entity_CatalogoPeriodosCorte.Descripcion); AssingParameter(comandoSql, "@Habilitar", entity_CatalogoPeriodosCorte.Habilitar); try { if (connection.State == ConnectionState.Closed) { connection.Open(); } result = int.Parse(ExecuteNonQuery(comandoSql).ToString()); } catch (Exception ex) { throw new Exception("Error updating CatalogoPeriodosCorte " + ex.Message, ex); } finally { if (connection != null) { connection.Close(); } } } return(result); }
public static CatalogoPeriodosCorteEntity GetOne(int?Clv_Periodo) { CatalogoPeriodosCorteEntity result = ProviderSoftv.CatalogoPeriodosCorte.GetCatalogoPeriodosCorteById(Clv_Periodo); return(result); }
public static int Edit(CatalogoPeriodosCorteEntity objCatalogoPeriodosCorte) { int result = ProviderSoftv.CatalogoPeriodosCorte.EditCatalogoPeriodosCorte(objCatalogoPeriodosCorte); return(result); }
/// <summary> /// Abstract method to update CatalogoPeriodosCorte /// </summary> public abstract int EditCatalogoPeriodosCorte(CatalogoPeriodosCorteEntity entity_CatalogoPeriodosCorte);
public int UpdateCatalogoPeriodosCorte(CatalogoPeriodosCorteEntity objCatalogoPeriodosCorte) { return(CatalogoPeriodosCorte.Edit(objCatalogoPeriodosCorte)); }
public int AddCatalogoPeriodosCorte(CatalogoPeriodosCorteEntity objCatalogoPeriodosCorte) { return(CatalogoPeriodosCorte.Add(objCatalogoPeriodosCorte)); }