/// <summary> ///</summary> /// <param name="TipServ"> Object TipServ added to List</param> public override int AddTipServ(TipServEntity entity_TipServ) { int result = 0; using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.TipServ.ConnectionString)) { SqlCommand comandoSql = CreateCommand("Softv_TipServAdd", connection); AssingParameter(comandoSql, "@Clv_TipSer", null, pd: ParameterDirection.Output, IsKey: true); AssingParameter(comandoSql, "@Concepto", entity_TipServ.Concepto); AssingParameter(comandoSql, "@Habilitar", entity_TipServ.Habilitar); try { if (connection.State == ConnectionState.Closed) { connection.Open(); } result = ExecuteNonQuery(comandoSql); } catch (Exception ex) { throw new Exception("Error adding TipServ " + ex.Message, ex); } finally { connection.Close(); } result = (int)comandoSql.Parameters["@IdTipServ"].Value; } return(result); }
public ActionResult getTipoServicio(int IdPlaza) { ConexionController c = new ConexionController(); SqlCommand comandoSql; List <TipServEntity> lista_servicio = new List <TipServEntity>(); SqlConnection conexionSQL = new SqlConnection(c.DameConexion(IdPlaza)); try { conexionSQL.Open(); } catch { } try { comandoSql = new SqlCommand("select * from TipServ where Habilitar=0"); comandoSql.Connection = conexionSQL; SqlDataReader reader = comandoSql.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { TipServEntity servicio = new TipServEntity(); servicio.Clv_TipSer = Int32.Parse(reader[0].ToString()); servicio.Concepto = reader[1].ToString(); lista_servicio.Add(servicio); } } } catch { } return(Json(lista_servicio, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(TipServEntity objTipServ) { if (ModelState.IsValid) { objTipServ.BaseRemoteIp = RemoteIp; objTipServ.BaseIdUser = LoggedUserName; int result = proxy.UpdateTipServ(objTipServ); if (result == -1) { TipServEntity objTipServOld = proxy.GetTipServ(objTipServ.Clv_TipSer); AssingMessageScript("El TipServ ya existe en el sistema, .", "error", "Error", true); CheckNotify(); return(View(objTipServ)); } if (result > 0) { AssingMessageScript("El TipServ se modifico en el sistema.", "success", "Éxito", true); CheckNotify(); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); } return(View(objTipServ)); }
public ActionResult Details(int id = 0) { TipServEntity objTipServ = proxy.GetTipServ(id); if (objTipServ == null) { return(HttpNotFound()); } return(PartialView(objTipServ)); }
public static TipServEntity GetOne(int?Clv_TipSer) { TipServEntity result = ProviderSoftv.TipServ.GetTipServById(Clv_TipSer); if (result.Clv_TipSer != null) { result.Llamada = ProviderSoftv.Llamada.GetLlamadaById(result.Clv_TipSer); } return(result); }
public ActionResult Edit(int id = 0) { PermisosAccesoDeniedEdit("TipServ"); ViewBag.CustomScriptsPageValid = BuildScriptPageValid(); TipServEntity objTipServ = proxy.GetTipServ(id); if (objTipServ == null) { return(HttpNotFound()); } return(View(objTipServ)); }
/// <summary> /// Converts data from reader to entity /// </summary> protected virtual TipServEntity GetTipServFromReader(IDataReader reader) { TipServEntity entity_TipServ = null; try { entity_TipServ = new TipServEntity(); entity_TipServ.Clv_TipSer = (int?)(GetFromReader(reader, "Clv_TipSer")); entity_TipServ.Concepto = (String)(GetFromReader(reader, "Concepto", IsString: true)); entity_TipServ.Habilitar = (short?)(GetFromReader(reader, "Habilitar")); } catch (Exception ex) { throw new Exception("Error converting TipServ data to entity", ex); } return(entity_TipServ); }
public ActionResult QuickIndex(int?page, int?pageSize, String Concepto, short?Habilitar) { int pageNumber = (page ?? 1); int pSize = pageSize ?? SoftvMVC.Properties.Settings.Default.pagnum; SoftvList <TipServEntity> listResult = null; List <TipServEntity> listTipServ = new List <TipServEntity>(); TipServEntity objTipServ = new TipServEntity(); TipServEntity objGetTipServ = new TipServEntity(); if ((Concepto != null && Concepto.ToString() != "")) { objTipServ.Concepto = Concepto; } if ((Habilitar != null)) { objTipServ.Habilitar = Habilitar; } pageNumber = pageNumber == 0 ? 1 : pageNumber; listResult = proxy.GetTipServPagedListXml(pageNumber, pSize, Globals.SerializeTool.Serialize(objTipServ)); if (listResult.Count == 0) { int tempPageNumber = (int)(listResult.totalCount / pSize); pageNumber = (int)(listResult.totalCount / pSize) == 0 ? 1 : tempPageNumber; listResult = proxy.GetTipServPagedListXml(pageNumber, pSize, Globals.SerializeTool.Serialize(objTipServ)); } listResult.ToList().ForEach(x => listTipServ.Add(x)); var TipServAsIPagedList = new StaticPagedList <TipServEntity>(listTipServ, pageNumber, pSize, listResult.totalCount); if (TipServAsIPagedList.Count > 0) { return(PartialView(TipServAsIPagedList)); } 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 TipServ by ///</summary> public override TipServEntity GetTipServById(int?Clv_TipSer) { using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.TipServ.ConnectionString)) { SqlCommand comandoSql = CreateCommand("Softv_TipServGetById", connection); TipServEntity entity_TipServ = null; AssingParameter(comandoSql, "@Clv_TipSer", Clv_TipSer); IDataReader rd = null; try { if (connection.State == ConnectionState.Closed) { connection.Open(); } rd = ExecuteReader(comandoSql, CommandBehavior.SingleRow); if (rd.Read()) { entity_TipServ = GetTipServFromReader(rd); } } catch (Exception ex) { throw new Exception("Error getting data TipServ " + ex.Message, ex); } finally { if (connection != null) { connection.Close(); } if (rd != null) { rd.Close(); } } return(entity_TipServ); } }
public ActionResult Create(TipServEntity objTipServ) { if (ModelState.IsValid) { objTipServ.BaseRemoteIp = RemoteIp; objTipServ.BaseIdUser = LoggedUserName; int result = proxy.AddTipServ(objTipServ); if (result == -1) { AssingMessageScript("El TipServ ya existe en el sistema.", "error", "Error", true); CheckNotify(); return(View(objTipServ)); } if (result > 0) { AssingMessageScript("Se dio de alta el TipServ en el sistema.", "success", "Éxito", true); return(RedirectToAction("Index")); } } return(View(objTipServ)); }
/// <summary> /// Edits a TipServ ///</summary> /// <param name="TipServ"> Objeto TipServ a editar </param> public override int EditTipServ(TipServEntity entity_TipServ) { int result = 0; using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.TipServ.ConnectionString)) { SqlCommand comandoSql = CreateCommand("Softv_TipServEdit", connection); AssingParameter(comandoSql, "@Clv_TipSer", entity_TipServ.Clv_TipSer); AssingParameter(comandoSql, "@Concepto", entity_TipServ.Concepto); AssingParameter(comandoSql, "@Habilitar", entity_TipServ.Habilitar); try { if (connection.State == ConnectionState.Closed) { connection.Open(); } result = int.Parse(ExecuteNonQuery(comandoSql).ToString()); } catch (Exception ex) { throw new Exception("Error updating TipServ " + ex.Message, ex); } finally { if (connection != null) { connection.Close(); } } } return(result); }
/// <summary> /// Abstract method to update TipServ /// </summary> public abstract int EditTipServ(TipServEntity entity_TipServ);
/// <summary> /// Abstract method to add TipServ /// /summary> /// <param name="TipServ"></param> /// <returns></returns> public abstract int AddTipServ(TipServEntity entity_TipServ);
public int AddTipServ(TipServEntity objTipServ) { return(TipServ.Add(objTipServ)); }
public int UpdateTipServ(TipServEntity objTipServ) { return(TipServ.Edit(objTipServ)); }
public static int Edit(TipServEntity objTipServ) { int result = ProviderSoftv.TipServ.EditTipServ(objTipServ); return(result); }
public static int Add(TipServEntity objTipServ) { int result = ProviderSoftv.TipServ.AddTipServ(objTipServ); return(result); }