Example #1
0
        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));
        }
Example #2
0
        /// <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);
        }
Example #3
0
        /// <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);
        }
Example #4
0
        public ActionResult Details(int id = 0)
        {
            MotivoCancelacionEntity objMotivoCancelacion = proxy.GetMotivoCancelacion(id);

            if (objMotivoCancelacion == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(objMotivoCancelacion));
        }
Example #5
0
        public ActionResult Edit(int id = 0)
        {
            PermisosAccesoDeniedEdit("MotivoCancelacion");
            ViewBag.CustomScriptsPageValid = BuildScriptPageValid();
            MotivoCancelacionEntity objMotivoCancelacion = proxy.GetMotivoCancelacion(id);

            if (objMotivoCancelacion == null)
            {
                return(HttpNotFound());
            }
            return(View(objMotivoCancelacion));
        }
Example #6
0
        /// <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);
        }
Example #7
0
        /// <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);
            }
        }
Example #8
0
 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));
 }
Example #9
0
        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));
            }
        }
Example #10
0
        public static MotivoCancelacionEntity GetOne(int?Clv_MOTCAN)
        {
            MotivoCancelacionEntity result = ProviderSoftv.MotivoCancelacion.GetMotivoCancelacionById(Clv_MOTCAN);

            return(result);
        }
Example #11
0
        public static int Edit(MotivoCancelacionEntity objMotivoCancelacion)
        {
            int result = ProviderSoftv.MotivoCancelacion.EditMotivoCancelacion(objMotivoCancelacion);

            return(result);
        }
Example #12
0
 public int UpdateMotivoCancelacion(MotivoCancelacionEntity objMotivoCancelacion)
 {
     return(MotivoCancelacion.Edit(objMotivoCancelacion));
 }
Example #13
0
 public int AddMotivoCancelacion(MotivoCancelacionEntity objMotivoCancelacion)
 {
     return(MotivoCancelacion.Add(objMotivoCancelacion));
 }
Example #14
0
 /// <summary>
 /// Abstract method to update MotivoCancelacion
 /// </summary>
 public abstract int EditMotivoCancelacion(MotivoCancelacionEntity entity_MotivoCancelacion);