Ejemplo n.º 1
0
        public ActionResult Edit(CVECAROLEntity objCVECAROL)
        {
            if (ModelState.IsValid)
            {
                objCVECAROL.BaseRemoteIp = RemoteIp;
                objCVECAROL.BaseIdUser   = LoggedUserName;
                int result = proxy.UpdateCVECAROL(objCVECAROL);
                if (result == -1)
                {
                    CVECAROLEntity objCVECAROLOld = proxy.GetCVECAROL(objCVECAROL.Clv_Colonia);

                    AssingMessageScript("El CVECAROL ya existe en el sistema, .", "error", "Error", true);
                    CheckNotify();
                    return(View(objCVECAROL));
                }
                if (result > 0)
                {
                    AssingMessageScript("El CVECAROL se modifico en el sistema.", "success", "Éxito", true);
                    CheckNotify();
                    return(RedirectToAction("Index"));
                }
                return(RedirectToAction("Index"));
            }
            return(View(objCVECAROL));
        }
Ejemplo n.º 2
0
        public ActionResult Details(int id = 0)
        {
            CVECAROLEntity objCVECAROL = proxy.GetCVECAROL(id);

            if (objCVECAROL == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(objCVECAROL));
        }
Ejemplo n.º 3
0
        public ActionResult Edit(int id = 0)
        {
            PermisosAccesoDeniedEdit("CVECAROL");
            ViewBag.CustomScriptsPageValid = BuildScriptPageValid();
            CVECAROLEntity objCVECAROL = proxy.GetCVECAROL(id);

            if (objCVECAROL == null)
            {
                return(HttpNotFound());
            }
            return(View(objCVECAROL));
        }
Ejemplo n.º 4
0
        public static CVECAROLEntity GetOneDeep(int?Clv_Calle, int?Clv_Colonia)
        {
            CVECAROLEntity result = ProviderSoftv.CVECAROL.GetCVECAROLById(Clv_Colonia);

            if (result.Clv_Calle != null)
            {
                result.CALLES = ProviderSoftv.CALLE.GetCALLEById(result.Clv_Calle);
            }

            if (result.Clv_Colonia != null)
            {
                result.COLONIA = ProviderSoftv.COLONIA.GetCOLONIAById(result.Clv_Colonia);
            }

            return(result);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Edits a CVECAROL
        ///</summary>
        /// <param name="CVECAROL"> Objeto CVECAROL a editar </param>
        public override int EditCVECAROL(CVECAROLEntity entity_CVECAROL)
        {
            int result = 0;

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

                AssingParameter(comandoSql, "@Clv_Calle", entity_CVECAROL.Clv_Calle);

                AssingParameter(comandoSql, "@Clv_Colonia", entity_CVECAROL.Clv_Colonia);

                AssingParameter(comandoSql, "@NumCasas", entity_CVECAROL.NumCasas);

                AssingParameter(comandoSql, "@NumNegocios", entity_CVECAROL.NumNegocios);

                AssingParameter(comandoSql, "@NumBaldios", entity_CVECAROL.NumBaldios);

                AssingParameter(comandoSql, "@Sector", entity_CVECAROL.Sector);

                AssingParameter(comandoSql, "@Troncal", entity_CVECAROL.Troncal);

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

                    result = int.Parse(ExecuteNonQuery(comandoSql).ToString());
                }
                catch (Exception ex)
                {
                    throw new Exception("Error updating CVECAROL " + ex.Message, ex);
                }
                finally
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 6
0
        public override CVECAROLEntity GetCVECAROLByCalle(int?Clv_Calle)
        {
            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.CVECAROL.ConnectionString))
            {
                SqlCommand     comandoSql      = CreateCommand("Softv_", connection);
                CVECAROLEntity entity_CVECAROL = null;


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


                IDataReader rd = null;
                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }
                    rd = ExecuteReader(comandoSql, CommandBehavior.SingleRow);
                    if (rd.Read())
                    {
                        entity_CVECAROL = GetCVECAROLFromReader(rd);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception("Error getting data CVECAROL " + ex.Message, ex);
                }
                finally
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                    if (rd != null)
                    {
                        rd.Close();
                    }
                }
                return(entity_CVECAROL);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        ///</summary>
        /// <param name="CVECAROL"> Object CVECAROL added to List</param>
        public override int AddCVECAROL(CVECAROLEntity entity_CVECAROL)
        {
            int result = 0;

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

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

                AssingParameter(comandoSql, "@Clv_Calle", entity_CVECAROL.Clv_Calle);

                AssingParameter(comandoSql, "@NumCasas", entity_CVECAROL.NumCasas);

                AssingParameter(comandoSql, "@NumNegocios", entity_CVECAROL.NumNegocios);

                AssingParameter(comandoSql, "@NumBaldios", entity_CVECAROL.NumBaldios);

                AssingParameter(comandoSql, "@Sector", entity_CVECAROL.Sector);

                AssingParameter(comandoSql, "@Troncal", entity_CVECAROL.Troncal);

                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }
                    result = ExecuteNonQuery(comandoSql);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error adding CVECAROL " + ex.Message, ex);
                }
                finally
                {
                    connection.Close();
                }
                result = (int)comandoSql.Parameters["@Clv_Colonia"].Value;
            }
            return(result);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Converts data from reader to entity
        /// </summary>
        protected virtual CVECAROLEntity GetCVECAROLFromReader(IDataReader reader)
        {
            CVECAROLEntity entity_CVECAROL = null;

            try
            {
                entity_CVECAROL             = new CVECAROLEntity();
                entity_CVECAROL.Clv_Calle   = (int?)(GetFromReader(reader, "Clv_Calle"));
                entity_CVECAROL.Clv_Colonia = (int?)(GetFromReader(reader, "Clv_Colonia"));
                entity_CVECAROL.NumCasas    = (int?)(GetFromReader(reader, "NumCasas"));
                entity_CVECAROL.NumNegocios = (int?)(GetFromReader(reader, "NumNegocios"));
                entity_CVECAROL.NumBaldios  = (int?)(GetFromReader(reader, "NumBaldios"));
                entity_CVECAROL.Sector      = (char)(GetFromReader(reader, "Sector"));
                entity_CVECAROL.Troncal     = (char)(GetFromReader(reader, "Troncal"));
            }
            catch (Exception ex)
            {
                throw new Exception("Error converting CVECAROL data to entity", ex);
            }
            return(entity_CVECAROL);
        }
Ejemplo n.º 9
0
 public ActionResult Create(CVECAROLEntity objCVECAROL)
 {
     if (ModelState.IsValid)
     {
         objCVECAROL.BaseRemoteIp = RemoteIp;
         objCVECAROL.BaseIdUser   = LoggedUserName;
         int result = proxy.AddCVECAROL(objCVECAROL);
         if (result == -1)
         {
             AssingMessageScript("El CVECAROL ya existe en el sistema.", "error", "Error", true);
             CheckNotify();
             return(View(objCVECAROL));
         }
         if (result > 0)
         {
             AssingMessageScript("Se dio de alta el CVECAROL en el sistema.", "success", "Éxito", true);
             return(RedirectToAction("Index"));
         }
     }
     return(View(objCVECAROL));
 }
Ejemplo n.º 10
0
        public ActionResult QuickIndex(int?page, int?pageSize, int?Clv_Colonia)
        {
            int pageNumber = (page ?? 1);
            int pSize      = pageSize ?? SoftvMVC.Properties.Settings.Default.pagnum;
            SoftvList <CVECAROLEntity> listResult     = null;
            List <CVECAROLEntity>      listCVECAROL   = new List <CVECAROLEntity>();
            CVECAROLEntity             objCVECAROL    = new CVECAROLEntity();
            CVECAROLEntity             objGetCVECAROL = new CVECAROLEntity();


            if ((Clv_Colonia != null))
            {
                objCVECAROL.Clv_Colonia = Clv_Colonia;
            }



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

            var CVECAROLAsIPagedList = new StaticPagedList <CVECAROLEntity>(listCVECAROL, pageNumber, pSize, listResult.totalCount);

            if (CVECAROLAsIPagedList.Count > 0)
            {
                return(PartialView(CVECAROLAsIPagedList));
            }
            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));
            }
        }
Ejemplo n.º 11
0
        public static int Edit(CVECAROLEntity objCVECAROL)
        {
            int result = ProviderSoftv.CVECAROL.EditCVECAROL(objCVECAROL);

            return(result);
        }
Ejemplo n.º 12
0
        public static int Add(CVECAROLEntity objCVECAROL)
        {
            int result = ProviderSoftv.CVECAROL.AddCVECAROL(objCVECAROL);

            return(result);
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Abstract method to update CVECAROL
 /// </summary>
 public abstract int EditCVECAROL(CVECAROLEntity entity_CVECAROL);
Ejemplo n.º 14
0
 /// <summary>
 /// Abstract method to add CVECAROL
 ///  /summary>
 /// <param name="CVECAROL"></param>
 /// <returns></returns>
 public abstract int AddCVECAROL(CVECAROLEntity entity_CVECAROL);
Ejemplo n.º 15
0
 public int UpdateCVECAROL(CVECAROLEntity objCVECAROL)
 {
     return(CVECAROL.Edit(objCVECAROL));
 }
Ejemplo n.º 16
0
 public int AddCVECAROL(CVECAROLEntity objCVECAROL)
 {
     return(CVECAROL.Add(objCVECAROL));
 }