public ActionResult Edit(NoClienteEntity objNoCliente) { if (ModelState.IsValid) { objNoCliente.BaseRemoteIp = RemoteIp; objNoCliente.BaseIdUser = LoggedUserName; int result = proxy.UpdateNoCliente(objNoCliente); if (result == -1) { NoClienteEntity objNoClienteOld = proxy.GetNoCliente(objNoCliente.Id); AssingMessageScript("El NoCliente ya existe en el sistema, .", "error", "Error", true); CheckNotify(); return(View(objNoCliente)); } if (result > 0) { AssingMessageScript("El NoCliente se modifico en el sistema.", "success", "Éxito", true); CheckNotify(); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); } return(View(objNoCliente)); }
public ActionResult Details(int id = 0) { NoClienteEntity objNoCliente = proxy.GetNoCliente(id); if (objNoCliente == null) { return(HttpNotFound()); } return(PartialView(objNoCliente)); }
public ActionResult Edit(int id = 0) { PermisosAccesoDeniedEdit("NoCliente"); ViewBag.CustomScriptsPageValid = BuildScriptPageValid(); NoClienteEntity objNoCliente = proxy.GetNoCliente(id); if (objNoCliente == null) { return(HttpNotFound()); } return(View(objNoCliente)); }
/// <summary> /// Edits a NoCliente ///</summary> /// <param name="NoCliente"> Objeto NoCliente a editar </param> public override int EditNoCliente(NoClienteEntity entity_NoCliente) { int result = 0; using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.NoCliente.ConnectionString)) { SqlCommand comandoSql = CreateCommand("Softv_NoClienteEdit", connection); AssingParameter(comandoSql, "@Id", entity_NoCliente.Id); AssingParameter(comandoSql, "@IdLlamada", entity_NoCliente.IdLlamada); AssingParameter(comandoSql, "@Nombre", entity_NoCliente.Nombre); AssingParameter(comandoSql, "@Direccion", entity_NoCliente.Direccion); AssingParameter(comandoSql, "@Telefono", entity_NoCliente.Telefono); AssingParameter(comandoSql, "@Celular", entity_NoCliente.Celular); AssingParameter(comandoSql, "@Email", entity_NoCliente.Email); try { if (connection.State == ConnectionState.Closed) { connection.Open(); } result = int.Parse(ExecuteNonQuery(comandoSql).ToString()); } catch (Exception ex) { throw new Exception("Error updating NoCliente " + ex.Message, ex); } finally { if (connection != null) { connection.Close(); } } } return(result); }
/// <summary> ///</summary> /// <param name="NoCliente"> Object NoCliente added to List</param> public override int AddNoCliente(NoClienteEntity entity_NoCliente) { int result = 0; using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.NoCliente.ConnectionString)) { SqlCommand comandoSql = CreateCommand("Softv_NoClienteAdd", connection); AssingParameter(comandoSql, "@Id", null, pd: ParameterDirection.Output, IsKey: true); AssingParameter(comandoSql, "@IdLlamada", entity_NoCliente.IdLlamada); AssingParameter(comandoSql, "@Nombre", entity_NoCliente.Nombre); AssingParameter(comandoSql, "@Direccion", entity_NoCliente.Direccion); AssingParameter(comandoSql, "@Telefono", entity_NoCliente.Telefono); AssingParameter(comandoSql, "@Celular", entity_NoCliente.Celular); AssingParameter(comandoSql, "@Email", entity_NoCliente.Email); try { if (connection.State == ConnectionState.Closed) { connection.Open(); } result = ExecuteNonQuery(comandoSql); } catch (Exception ex) { throw new Exception("Error adding NoCliente " + ex.Message, ex); } finally { connection.Close(); } result = (int)comandoSql.Parameters["@Id"].Value; } return(result); }
/// <summary> /// Gets NoCliente by ///</summary> public override NoClienteEntity GetNoClienteById(int?Id) { using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.NoCliente.ConnectionString)) { SqlCommand comandoSql = CreateCommand("Softv_NoClienteGetById", connection); NoClienteEntity entity_NoCliente = null; AssingParameter(comandoSql, "@Id", Id); IDataReader rd = null; try { if (connection.State == ConnectionState.Closed) { connection.Open(); } rd = ExecuteReader(comandoSql, CommandBehavior.SingleRow); if (rd.Read()) { entity_NoCliente = GetNoClienteFromReader(rd); } } catch (Exception ex) { throw new Exception("Error getting data NoCliente " + ex.Message, ex); } finally { if (connection != null) { connection.Close(); } if (rd != null) { rd.Close(); } } return(entity_NoCliente); } }
public ActionResult Create(NoClienteEntity objNoCliente) { if (ModelState.IsValid) { objNoCliente.BaseRemoteIp = RemoteIp; objNoCliente.BaseIdUser = LoggedUserName; int result = proxy.AddNoCliente(objNoCliente); if (result == -1) { AssingMessageScript("El NoCliente ya existe en el sistema.", "error", "Error", true); CheckNotify(); return(View(objNoCliente)); } if (result > 0) { AssingMessageScript("Se dio de alta el NoCliente en el sistema.", "success", "Éxito", true); return(RedirectToAction("Index")); } } return(View(objNoCliente)); }
/// <summary> /// Converts data from reader to entity /// </summary> protected virtual NoClienteEntity GetNoClienteFromReader(IDataReader reader) { NoClienteEntity entity_NoCliente = null; try { entity_NoCliente = new NoClienteEntity(); entity_NoCliente.Id = (int?)(GetFromReader(reader, "Id")); entity_NoCliente.IdLlamada = (int?)(GetFromReader(reader, "IdLlamada")); entity_NoCliente.Nombre = (String)(GetFromReader(reader, "Nombre", IsString: true)); entity_NoCliente.Direccion = (String)(GetFromReader(reader, "Direccion", IsString: true)); entity_NoCliente.Telefono = (String)(GetFromReader(reader, "Telefono", IsString: true)); entity_NoCliente.Celular = (String)(GetFromReader(reader, "Celular", IsString: true)); entity_NoCliente.Email = (String)(GetFromReader(reader, "Email", IsString: true)); entity_NoCliente.MotivoLlamada = (int?)(GetFromReader(reader, "MotivoLlamada")); } catch (Exception ex) { throw new Exception("Error converting NoCliente data to entity", ex); } return(entity_NoCliente); }
public ActionResult QuickIndex(int?page, int?pageSize, int?IdLlamada, String Nombre, String Direccion, String Telefono, String Celular, String Email) { int pageNumber = (page ?? 1); int pSize = pageSize ?? SoftvMVC.Properties.Settings.Default.pagnum; SoftvList <NoClienteEntity> listResult = null; List <NoClienteEntity> listNoCliente = new List <NoClienteEntity>(); NoClienteEntity objNoCliente = new NoClienteEntity(); NoClienteEntity objGetNoCliente = new NoClienteEntity(); if ((IdLlamada != null)) { objNoCliente.IdLlamada = IdLlamada; } if ((Nombre != null && Nombre.ToString() != "")) { objNoCliente.Nombre = Nombre; } if ((Direccion != null && Direccion.ToString() != "")) { objNoCliente.Direccion = Direccion; } if ((Telefono != null && Telefono.ToString() != "")) { objNoCliente.Telefono = Telefono; } if ((Celular != null && Celular.ToString() != "")) { objNoCliente.Celular = Celular; } if ((Email != null && Email.ToString() != "")) { objNoCliente.Email = Email; } pageNumber = pageNumber == 0 ? 1 : pageNumber; listResult = proxy.GetNoClientePagedListXml(pageNumber, pSize, Globals.SerializeTool.Serialize(objNoCliente)); if (listResult.Count == 0) { int tempPageNumber = (int)(listResult.totalCount / pSize); pageNumber = (int)(listResult.totalCount / pSize) == 0 ? 1 : tempPageNumber; listResult = proxy.GetNoClientePagedListXml(pageNumber, pSize, Globals.SerializeTool.Serialize(objNoCliente)); } listResult.ToList().ForEach(x => listNoCliente.Add(x)); var NoClienteAsIPagedList = new StaticPagedList <NoClienteEntity>(listNoCliente, pageNumber, pSize, listResult.totalCount); if (NoClienteAsIPagedList.Count > 0) { return(PartialView(NoClienteAsIPagedList)); } 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)); } }
public static NoClienteEntity GetOne(int? Id) { NoClienteEntity result = ProviderSoftv.NoCliente.GetNoClienteById(Id); return(result); }
public static int Edit(NoClienteEntity objNoCliente) { int result = ProviderSoftv.NoCliente.EditNoCliente(objNoCliente); return(result); }
/// <summary> /// Abstract method to update NoCliente /// </summary> public abstract int EditNoCliente(NoClienteEntity entity_NoCliente);
/// <summary> /// Abstract method to add NoCliente /// /summary> /// <param name="NoCliente"></param> /// <returns></returns> public abstract int AddNoCliente(NoClienteEntity entity_NoCliente);