public ActionResult Edit(MotAtenTelEntity objMotAtenTel)
        {
            if (ModelState.IsValid)
            {
                objMotAtenTel.BaseRemoteIp = RemoteIp;
                objMotAtenTel.BaseIdUser   = LoggedUserName;
                int result = proxy.UpdateMotAtenTel(objMotAtenTel);
                if (result == -1)
                {
                    MotAtenTelEntity objMotAtenTelOld = proxy.GetMotAtenTel(objMotAtenTel.Clv_Motivo);

                    AssingMessageScript("El MotAtenTel ya existe en el sistema, .", "error", "Error", true);
                    CheckNotify();
                    return(View(objMotAtenTel));
                }
                if (result > 0)
                {
                    AssingMessageScript("El MotAtenTel se modifico en el sistema.", "success", "Éxito", true);
                    CheckNotify();
                    return(RedirectToAction("Index"));
                }
                return(RedirectToAction("Index"));
            }
            return(View(objMotAtenTel));
        }
Beispiel #2
0
        /// <summary>
        ///</summary>
        /// <param name="MotAtenTel"> Object MotAtenTel added to List</param>
        public override int AddMotAtenTel(MotAtenTelEntity entity_MotAtenTel)
        {
            int result = 0;

            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.MotAtenTel.ConnectionString))
            {
                SqlCommand comandoSql = CreateCommand("Softv_MotAtenTelAdd", connection);

                AssingParameter(comandoSql, "@Clv_Motivo", null, pd: ParameterDirection.Output, IsKey: true);

                AssingParameter(comandoSql, "@Descripcion", entity_MotAtenTel.Descripcion);

                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }
                    result = ExecuteNonQuery(comandoSql);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error adding MotAtenTel " + ex.Message, ex);
                }
                finally
                {
                    connection.Close();
                }
                result = (int)comandoSql.Parameters["@Clv_Motivo"].Value;
            }
            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Edits a MotAtenTel
        ///</summary>
        /// <param name="MotAtenTel"> Objeto MotAtenTel a editar </param>
        public override int EditMotAtenTel(MotAtenTelEntity entity_MotAtenTel)
        {
            int result = 0;

            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.MotAtenTel.ConnectionString))
            {
                SqlCommand comandoSql = CreateCommand("Softv_MotAtenTelEdit", connection);

                AssingParameter(comandoSql, "@Clv_Motivo", entity_MotAtenTel.Clv_Motivo);

                AssingParameter(comandoSql, "@Descripcion", entity_MotAtenTel.Descripcion);

                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }

                    result = int.Parse(ExecuteNonQuery(comandoSql).ToString());
                }
                catch (Exception ex)
                {
                    throw new Exception("Error updating MotAtenTel " + ex.Message, ex);
                }
                finally
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                }
            }
            return(result);
        }
        public ActionResult Details(int id = 0)
        {
            MotAtenTelEntity objMotAtenTel = proxy.GetMotAtenTel(id);

            if (objMotAtenTel == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(objMotAtenTel));
        }
        public ActionResult Edit(int id = 0)
        {
            PermisosAccesoDeniedEdit("MotAtenTel");
            ViewBag.CustomScriptsPageValid = BuildScriptPageValid();
            MotAtenTelEntity objMotAtenTel = proxy.GetMotAtenTel(id);

            if (objMotAtenTel == null)
            {
                return(HttpNotFound());
            }
            return(View(objMotAtenTel));
        }
        /// <summary>
        /// Converts data from reader to entity
        /// </summary>
        protected virtual MotAtenTelEntity GetMotAtenTelFromReader(IDataReader reader)
        {
            MotAtenTelEntity entity_MotAtenTel = null;

            try
            {
                entity_MotAtenTel             = new MotAtenTelEntity();
                entity_MotAtenTel.Clv_Motivo  = (int?)(GetFromReader(reader, "Clv_Motivo"));
                entity_MotAtenTel.Descripcion = (String)(GetFromReader(reader, "Descripcion", IsString: true));
            }
            catch (Exception ex)
            {
                throw new Exception("Error converting MotAtenTel data to entity", ex);
            }
            return(entity_MotAtenTel);
        }
Beispiel #7
0
        /// <summary>
        /// Gets MotAtenTel by
        ///</summary>
        public override MotAtenTelEntity GetMotAtenTelById(int?Clv_Motivo)
        {
            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.MotAtenTel.ConnectionString))
            {
                SqlCommand       comandoSql        = CreateCommand("Softv_MotAtenTelGetById", connection);
                MotAtenTelEntity entity_MotAtenTel = null;


                AssingParameter(comandoSql, "@Clv_Motivo", Clv_Motivo);

                IDataReader rd = null;
                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }
                    rd = ExecuteReader(comandoSql, CommandBehavior.SingleRow);
                    if (rd.Read())
                    {
                        entity_MotAtenTel = GetMotAtenTelFromReader(rd);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception("Error getting data MotAtenTel " + ex.Message, ex);
                }
                finally
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                    if (rd != null)
                    {
                        rd.Close();
                    }
                }
                return(entity_MotAtenTel);
            }
        }
 public ActionResult Create(MotAtenTelEntity objMotAtenTel)
 {
     if (ModelState.IsValid)
     {
         objMotAtenTel.BaseRemoteIp = RemoteIp;
         objMotAtenTel.BaseIdUser   = LoggedUserName;
         int result = proxy.AddMotAtenTel(objMotAtenTel);
         if (result == -1)
         {
             AssingMessageScript("El MotAtenTel ya existe en el sistema.", "error", "Error", true);
             CheckNotify();
             return(View(objMotAtenTel));
         }
         if (result > 0)
         {
             AssingMessageScript("Se dio de alta el MotAtenTel en el sistema.", "success", "Éxito", true);
             return(RedirectToAction("Index"));
         }
     }
     return(View(objMotAtenTel));
 }
        public ActionResult QuickIndex(int?page, int?pageSize, String Descripcion)
        {
            int pageNumber = (page ?? 1);
            int pSize      = pageSize ?? SoftvMVC.Properties.Settings.Default.pagnum;
            SoftvList <MotAtenTelEntity> listResult       = null;
            List <MotAtenTelEntity>      listMotAtenTel   = new List <MotAtenTelEntity>();
            MotAtenTelEntity             objMotAtenTel    = new MotAtenTelEntity();
            MotAtenTelEntity             objGetMotAtenTel = new MotAtenTelEntity();


            if ((Descripcion != null && Descripcion.ToString() != ""))
            {
                objMotAtenTel.Descripcion = Descripcion;
            }

            pageNumber = pageNumber == 0 ? 1 : pageNumber;
            listResult = proxy.GetMotAtenTelPagedListXml(pageNumber, pSize, Globals.SerializeTool.Serialize(objMotAtenTel));
            if (listResult.Count == 0)
            {
                int tempPageNumber = (int)(listResult.totalCount / pSize);
                pageNumber = (int)(listResult.totalCount / pSize) == 0 ? 1 : tempPageNumber;
                listResult = proxy.GetMotAtenTelPagedListXml(pageNumber, pSize, Globals.SerializeTool.Serialize(objMotAtenTel));
            }
            listResult.ToList().ForEach(x => listMotAtenTel.Add(x));

            var MotAtenTelAsIPagedList = new StaticPagedList <MotAtenTelEntity>(listMotAtenTel, pageNumber, pSize, listResult.totalCount);

            if (MotAtenTelAsIPagedList.Count > 0)
            {
                return(PartialView(MotAtenTelAsIPagedList));
            }
            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));
            }
        }
Beispiel #10
0
        public static MotAtenTelEntity GetOne(int? Clv_Motivo)
        {
            MotAtenTelEntity result = ProviderSoftv.MotAtenTel.GetMotAtenTelById(Clv_Motivo);

            return(result);
        }
Beispiel #11
0
        public static int Edit(MotAtenTelEntity objMotAtenTel)
        {
            int result = ProviderSoftv.MotAtenTel.EditMotAtenTel(objMotAtenTel);

            return(result);
        }
 /// <summary>
 /// Abstract method to update MotAtenTel
 /// </summary>
 public abstract int EditMotAtenTel(MotAtenTelEntity entity_MotAtenTel);
 /// <summary>
 /// Abstract method to add MotAtenTel
 ///  /summary>
 /// <param name="MotAtenTel"></param>
 /// <returns></returns>
 public abstract int AddMotAtenTel(MotAtenTelEntity entity_MotAtenTel);