Exemplo n.º 1
0
        /// <summary>
        ///</summary>
        /// <param name="CVECOLCIU"> Object CVECOLCIU added to List</param>
        public override int AddCVECOLCIU(CVECOLCIUEntity entity_CVECOLCIU)
        {
            int result = 0;

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

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

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

                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }
                    result = ExecuteNonQuery(comandoSql);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error adding CVECOLCIU " + ex.Message, ex);
                }
                finally
                {
                    connection.Close();
                }
                result = (int)comandoSql.Parameters["@IdCVECOLCIU"].Value;
            }
            return(result);
        }
Exemplo n.º 2
0
        public ActionResult Edit(CVECOLCIUEntity objCVECOLCIU)
        {
            if (ModelState.IsValid)
            {
                objCVECOLCIU.BaseRemoteIp = RemoteIp;
                objCVECOLCIU.BaseIdUser   = LoggedUserName;
                int result = proxy.UpdateCVECOLCIU(objCVECOLCIU);
                if (result == -1)
                {
                    CVECOLCIUEntity objCVECOLCIUOld = proxy.GetCVECOLCIU(objCVECOLCIU.Clv_Ciudad);

                    AssingMessageScript("El CVECOLCIU ya existe en el sistema, .", "error", "Error", true);
                    CheckNotify();
                    return(View(objCVECOLCIU));
                }
                if (result > 0)
                {
                    AssingMessageScript("El CVECOLCIU se modifico en el sistema.", "success", "Éxito", true);
                    CheckNotify();
                    return(RedirectToAction("Index"));
                }
                return(RedirectToAction("Index"));
            }
            return(View(objCVECOLCIU));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Edits a CVECOLCIU
        ///</summary>
        /// <param name="CVECOLCIU"> Objeto CVECOLCIU a editar </param>
        public override int EditCVECOLCIU(CVECOLCIUEntity entity_CVECOLCIU)
        {
            int result = 0;

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

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

                AssingParameter(comandoSql, "@Clv_Ciudad", entity_CVECOLCIU.Clv_Ciudad);

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

                    result = int.Parse(ExecuteNonQuery(comandoSql).ToString());
                }
                catch (Exception ex)
                {
                    throw new Exception("Error updating CVECOLCIU " + ex.Message, ex);
                }
                finally
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                }
            }
            return(result);
        }
Exemplo n.º 4
0
        public ActionResult Details(int id = 0)
        {
            CVECOLCIUEntity objCVECOLCIU = proxy.GetCVECOLCIU(id);

            if (objCVECOLCIU == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(objCVECOLCIU));
        }
Exemplo n.º 5
0
        public ActionResult Edit(int id = 0)
        {
            PermisosAccesoDeniedEdit("CVECOLCIU");
            ViewBag.CustomScriptsPageValid = BuildScriptPageValid();
            CVECOLCIUEntity objCVECOLCIU = proxy.GetCVECOLCIU(id);

            if (objCVECOLCIU == null)
            {
                return(HttpNotFound());
            }
            return(View(objCVECOLCIU));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Converts data from reader to entity
        /// </summary>
        protected virtual CVECOLCIUEntity GetCVECOLCIUFromReader(IDataReader reader)
        {
            CVECOLCIUEntity entity_CVECOLCIU = null;

            try
            {
                entity_CVECOLCIU             = new CVECOLCIUEntity();
                entity_CVECOLCIU.Clv_Colonia = (int?)(GetFromReader(reader, "Clv_Colonia"));
                entity_CVECOLCIU.Clv_Ciudad  = (int?)(GetFromReader(reader, "Clv_Ciudad"));
            }
            catch (Exception ex)
            {
                throw new Exception("Error converting CVECOLCIU data to entity", ex);
            }
            return(entity_CVECOLCIU);
        }
Exemplo n.º 7
0
        public static CVECOLCIUEntity GetOneDeep(int?Clv_Colonia, int?Clv_Ciudad)
        {
            CVECOLCIUEntity result = ProviderSoftv.CVECOLCIU.GetCVECOLCIUById(Clv_Ciudad);

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

            if (result.Clv_Ciudad != null)
            {
                result.CIUDAD = ProviderSoftv.CIUDAD.GetCIUDADById(result.Clv_Ciudad);
            }

            return(result);
        }
Exemplo n.º 8
0
        public override CVECOLCIUEntity GetCVECOLCIUByCiudad(int?Clv_Ciudad)
        {
            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.CVECOLCIU.ConnectionString))
            {
                SqlCommand      comandoSql       = CreateCommand("Softv_", connection);
                CVECOLCIUEntity entity_CVECOLCIU = null;


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

                IDataReader rd = null;
                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }
                    rd = ExecuteReader(comandoSql, CommandBehavior.SingleRow);
                    if (rd.Read())
                    {
                        entity_CVECOLCIU = GetCVECOLCIUFromReader(rd);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception("Error getting data CVECOLCIU " + ex.Message, ex);
                }
                finally
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                    if (rd != null)
                    {
                        rd.Close();
                    }
                }
                return(entity_CVECOLCIU);
            }
        }
Exemplo n.º 9
0
 public ActionResult Create(CVECOLCIUEntity objCVECOLCIU)
 {
     if (ModelState.IsValid)
     {
         objCVECOLCIU.BaseRemoteIp = RemoteIp;
         objCVECOLCIU.BaseIdUser   = LoggedUserName;
         int result = proxy.AddCVECOLCIU(objCVECOLCIU);
         if (result == -1)
         {
             AssingMessageScript("El CVECOLCIU ya existe en el sistema.", "error", "Error", true);
             CheckNotify();
             return(View(objCVECOLCIU));
         }
         if (result > 0)
         {
             AssingMessageScript("Se dio de alta el CVECOLCIU en el sistema.", "success", "Éxito", true);
             return(RedirectToAction("Index"));
         }
     }
     return(View(objCVECOLCIU));
 }
Exemplo n.º 10
0
        public ActionResult QuickIndex(int?page, int?pageSize, int?Clv_Ciudad)
        {
            int pageNumber = (page ?? 1);
            int pSize      = pageSize ?? SoftvMVC.Properties.Settings.Default.pagnum;
            SoftvList <CVECOLCIUEntity> listResult      = null;
            List <CVECOLCIUEntity>      listCVECOLCIU   = new List <CVECOLCIUEntity>();
            CVECOLCIUEntity             objCVECOLCIU    = new CVECOLCIUEntity();
            CVECOLCIUEntity             objGetCVECOLCIU = new CVECOLCIUEntity();


            if ((Clv_Ciudad != null && Clv_Ciudad.ToString() != ""))
            {
                objCVECOLCIU.Clv_Ciudad = Clv_Ciudad;
            }



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

            var CVECOLCIUAsIPagedList = new StaticPagedList <CVECOLCIUEntity>(listCVECOLCIU, pageNumber, pSize, listResult.totalCount);

            if (CVECOLCIUAsIPagedList.Count > 0)
            {
                return(PartialView(CVECOLCIUAsIPagedList));
            }
            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));
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Abstract method to update CVECOLCIU
 /// </summary>
 public abstract int EditCVECOLCIU(CVECOLCIUEntity entity_CVECOLCIU);
Exemplo n.º 12
0
 /// <summary>
 /// Abstract method to add CVECOLCIU
 ///  /summary>
 /// <param name="CVECOLCIU"></param>
 /// <returns></returns>
 public abstract int AddCVECOLCIU(CVECOLCIUEntity entity_CVECOLCIU);
Exemplo n.º 13
0
        public static int Edit(CVECOLCIUEntity objCVECOLCIU)
        {
            int result = ProviderSoftv.CVECOLCIU.EditCVECOLCIU(objCVECOLCIU);

            return(result);
        }
Exemplo n.º 14
0
 public int UpdateCVECOLCIU(CVECOLCIUEntity objCVECOLCIU)
 {
     return(CVECOLCIU.Edit(objCVECOLCIU));
 }
Exemplo n.º 15
0
 public int AddCVECOLCIU(CVECOLCIUEntity objCVECOLCIU)
 {
     return(CVECOLCIU.Add(objCVECOLCIU));
 }