public ActionResult Edit(MotivoCancelacionEntity objMotivoCancelacion) { if (ModelState.IsValid) { objMotivoCancelacion.BaseRemoteIp = RemoteIp; objMotivoCancelacion.BaseIdUser = LoggedUserName; int result = proxy.UpdateMotivoCancelacion(objMotivoCancelacion); if (result == -1) { MotivoCancelacionEntity objMotivoCancelacionOld = proxy.GetMotivoCancelacion(objMotivoCancelacion.Clv_MOTCAN); AssingMessageScript("El MotivoCancelacion ya existe en el sistema, .", "error", "Error", true); CheckNotify(); return(View(objMotivoCancelacion)); } if (result > 0) { AssingMessageScript("El MotivoCancelacion se modifico en el sistema.", "success", "Éxito", true); CheckNotify(); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); } return(View(objMotivoCancelacion)); }
/// <summary> /// Edits a MotivoCancelacion ///</summary> /// <param name="MotivoCancelacion"> Objeto MotivoCancelacion a editar </param> public override int EditMotivoCancelacion(MotivoCancelacionEntity entity_MotivoCancelacion) { int result = 0; using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.MotivoCancelacion.ConnectionString)) { SqlCommand comandoSql = CreateCommand("Softv_MotivoCancelacionEdit", connection); AssingParameter(comandoSql, "@Clv_MOTCAN", entity_MotivoCancelacion.Clv_MOTCAN); AssingParameter(comandoSql, "@MOTCAN", entity_MotivoCancelacion.MOTCAN); try { if (connection.State == ConnectionState.Closed) { connection.Open(); } result = int.Parse(ExecuteNonQuery(comandoSql).ToString()); } catch (Exception ex) { throw new Exception("Error updating MotivoCancelacion " + ex.Message, ex); } finally { if (connection != null) { connection.Close(); } } } return(result); }
/// <summary> ///</summary> /// <param name="MotivoCancelacion"> Object MotivoCancelacion added to List</param> public override int AddMotivoCancelacion(MotivoCancelacionEntity entity_MotivoCancelacion) { int result = 0; using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.MotivoCancelacion.ConnectionString)) { SqlCommand comandoSql = CreateCommand("Softv_MotivoCancelacionAdd", connection); AssingParameter(comandoSql, "@Clv_MOTCAN", null, pd: ParameterDirection.Output, IsKey: true); AssingParameter(comandoSql, "@MOTCAN", entity_MotivoCancelacion.MOTCAN); try { if (connection.State == ConnectionState.Closed) { connection.Open(); } result = ExecuteNonQuery(comandoSql); } catch (Exception ex) { throw new Exception("Error adding MotivoCancelacion " + ex.Message, ex); } finally { connection.Close(); } result = (int)comandoSql.Parameters["@Clv_MOTCAN"].Value; } return(result); }
public ActionResult Details(int id = 0) { MotivoCancelacionEntity objMotivoCancelacion = proxy.GetMotivoCancelacion(id); if (objMotivoCancelacion == null) { return(HttpNotFound()); } return(PartialView(objMotivoCancelacion)); }
public ActionResult Edit(int id = 0) { PermisosAccesoDeniedEdit("MotivoCancelacion"); ViewBag.CustomScriptsPageValid = BuildScriptPageValid(); MotivoCancelacionEntity objMotivoCancelacion = proxy.GetMotivoCancelacion(id); if (objMotivoCancelacion == null) { return(HttpNotFound()); } return(View(objMotivoCancelacion)); }
/// <summary> /// Converts data from reader to entity /// </summary> protected virtual MotivoCancelacionEntity GetMotivoCancelacionFromReader(IDataReader reader) { MotivoCancelacionEntity entity_MotivoCancelacion = null; try { entity_MotivoCancelacion = new MotivoCancelacionEntity(); entity_MotivoCancelacion.Clv_MOTCAN = (int?)(GetFromReader(reader, "Clv_MOTCAN")); entity_MotivoCancelacion.MOTCAN = (String)(GetFromReader(reader, "MOTCAN", IsString: true)); } catch (Exception ex) { throw new Exception("Error converting MotivoCancelacion data to entity", ex); } return(entity_MotivoCancelacion); }
/// <summary> /// Gets MotivoCancelacion by ///</summary> public override MotivoCancelacionEntity GetMotivoCancelacionById(int?Clv_MOTCAN) { using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.MotivoCancelacion.ConnectionString)) { SqlCommand comandoSql = CreateCommand("Softv_MotivoCancelacionGetById", connection); MotivoCancelacionEntity entity_MotivoCancelacion = null; AssingParameter(comandoSql, "@Clv_MOTCAN", Clv_MOTCAN); IDataReader rd = null; try { if (connection.State == ConnectionState.Closed) { connection.Open(); } rd = ExecuteReader(comandoSql, CommandBehavior.SingleRow); if (rd.Read()) { entity_MotivoCancelacion = GetMotivoCancelacionFromReader(rd); } } catch (Exception ex) { throw new Exception("Error getting data MotivoCancelacion " + ex.Message, ex); } finally { if (connection != null) { connection.Close(); } if (rd != null) { rd.Close(); } } return(entity_MotivoCancelacion); } }
public ActionResult Create(MotivoCancelacionEntity objMotivoCancelacion) { if (ModelState.IsValid) { objMotivoCancelacion.BaseRemoteIp = RemoteIp; objMotivoCancelacion.BaseIdUser = LoggedUserName; int result = proxy.AddMotivoCancelacion(objMotivoCancelacion); if (result == -1) { AssingMessageScript("El MotivoCancelacion ya existe en el sistema.", "error", "Error", true); CheckNotify(); return(View(objMotivoCancelacion)); } if (result > 0) { AssingMessageScript("Se dio de alta el MotivoCancelacion en el sistema.", "success", "Éxito", true); return(RedirectToAction("Index")); } } return(View(objMotivoCancelacion)); }
public ActionResult QuickIndex(int?page, int?pageSize, String MOTCAN) { int pageNumber = (page ?? 1); int pSize = pageSize ?? SoftvMVC.Properties.Settings.Default.pagnum; SoftvList <MotivoCancelacionEntity> listResult = null; List <MotivoCancelacionEntity> listMotivoCancelacion = new List <MotivoCancelacionEntity>(); MotivoCancelacionEntity objMotivoCancelacion = new MotivoCancelacionEntity(); MotivoCancelacionEntity objGetMotivoCancelacion = new MotivoCancelacionEntity(); if ((MOTCAN != null && MOTCAN.ToString() != "")) { objMotivoCancelacion.MOTCAN = MOTCAN; } pageNumber = pageNumber == 0 ? 1 : pageNumber; listResult = proxy.GetMotivoCancelacionPagedListXml(pageNumber, pSize, Globals.SerializeTool.Serialize(objMotivoCancelacion)); if (listResult.Count == 0) { int tempPageNumber = (int)(listResult.totalCount / pSize); pageNumber = (int)(listResult.totalCount / pSize) == 0 ? 1 : tempPageNumber; listResult = proxy.GetMotivoCancelacionPagedListXml(pageNumber, pSize, Globals.SerializeTool.Serialize(objMotivoCancelacion)); } listResult.ToList().ForEach(x => listMotivoCancelacion.Add(x)); var MotivoCancelacionAsIPagedList = new StaticPagedList <MotivoCancelacionEntity>(listMotivoCancelacion, pageNumber, pSize, listResult.totalCount); if (MotivoCancelacionAsIPagedList.Count > 0) { return(PartialView(MotivoCancelacionAsIPagedList)); } 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 MotivoCancelacionEntity GetOne(int?Clv_MOTCAN) { MotivoCancelacionEntity result = ProviderSoftv.MotivoCancelacion.GetMotivoCancelacionById(Clv_MOTCAN); return(result); }
public static int Edit(MotivoCancelacionEntity objMotivoCancelacion) { int result = ProviderSoftv.MotivoCancelacion.EditMotivoCancelacion(objMotivoCancelacion); return(result); }
public int UpdateMotivoCancelacion(MotivoCancelacionEntity objMotivoCancelacion) { return(MotivoCancelacion.Edit(objMotivoCancelacion)); }
public int AddMotivoCancelacion(MotivoCancelacionEntity objMotivoCancelacion) { return(MotivoCancelacion.Add(objMotivoCancelacion)); }
/// <summary> /// Abstract method to update MotivoCancelacion /// </summary> public abstract int EditMotivoCancelacion(MotivoCancelacionEntity entity_MotivoCancelacion);