예제 #1
0
        public ActionResult Edit(DatoFiscalEntity objDatoFiscal)
        {
            if (ModelState.IsValid)
            {
                objDatoFiscal.BaseRemoteIp = RemoteIp;
                objDatoFiscal.BaseIdUser   = LoggedUserName;
                int result = proxy.UpdateDatoFiscal(objDatoFiscal);
                if (result == -1)
                {
                    DatoFiscalEntity objDatoFiscalOld = proxy.GetDatoFiscal(objDatoFiscal.Contrato);

                    AssingMessageScript("El DatoFiscal ya existe en el sistema, .", "error", "Error", true);
                    CheckNotify();
                    return(View(objDatoFiscal));
                }
                if (result > 0)
                {
                    AssingMessageScript("El DatoFiscal se modifico en el sistema.", "success", "Éxito", true);
                    CheckNotify();
                    return(RedirectToAction("Index"));
                }
                return(RedirectToAction("Index"));
            }
            return(View(objDatoFiscal));
        }
예제 #2
0
        /// <summary>
        /// Converts data from reader to entity
        /// </summary>
        protected virtual DatoFiscalEntity GetDatoFiscalFromReader(IDataReader reader)
        {
            DatoFiscalEntity entity_DatoFiscal = null;

            try
            {
                entity_DatoFiscal               = new DatoFiscalEntity();
                entity_DatoFiscal.Contrato      = (long?)(GetFromReader(reader, "Contrato"));
                entity_DatoFiscal.IVADESGLOSADO = (byte?)(GetFromReader(reader, "IVADESGLOSADO"));
                entity_DatoFiscal.RAZON_SOCIAL  = (String)(GetFromReader(reader, "RAZON_SOCIAL", IsString: true));
                entity_DatoFiscal.RFC           = (String)(GetFromReader(reader, "RFC", IsString: true));
                entity_DatoFiscal.CALLE_RS      = (String)(GetFromReader(reader, "CALLE_RS", IsString: true));
                entity_DatoFiscal.NUMERO_RS     = (String)(GetFromReader(reader, "NUMERO_RS", IsString: true));
                entity_DatoFiscal.ENTRECALLES   = (String)(GetFromReader(reader, "ENTRECALLES", IsString: true));
                entity_DatoFiscal.COLONIA_RS    = (String)(GetFromReader(reader, "COLONIA_RS", IsString: true));
                entity_DatoFiscal.CIUDAD_RS     = (String)(GetFromReader(reader, "CIUDAD_RS", IsString: true));
                entity_DatoFiscal.ESTADO_RS     = (String)(GetFromReader(reader, "ESTADO_RS", IsString: true));
                entity_DatoFiscal.CP_RS         = (String)(GetFromReader(reader, "CP_RS", IsString: true));
                entity_DatoFiscal.TELEFONO_RS   = (String)(GetFromReader(reader, "TELEFONO_RS", IsString: true));
                entity_DatoFiscal.FAX_RS        = (String)(GetFromReader(reader, "FAX_RS", IsString: true));
                entity_DatoFiscal.TIPO          = (char)(GetFromReader(reader, "TIPO"));
                entity_DatoFiscal.IDENTIFICADOR = (Decimal?)(GetFromReader(reader, "IDENTIFICADOR"));
                entity_DatoFiscal.CURP          = (String)(GetFromReader(reader, "CURP", IsString: true));
                entity_DatoFiscal.id_asociado   = (int?)(GetFromReader(reader, "id_asociado"));
            }
            catch (Exception ex)
            {
                throw new Exception("Error converting DatoFiscal data to entity", ex);
            }
            return(entity_DatoFiscal);
        }
예제 #3
0
        public ActionResult Details(int id = 0)
        {
            DatoFiscalEntity objDatoFiscal = proxy.GetDatoFiscal(id);

            if (objDatoFiscal == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(objDatoFiscal));
        }
예제 #4
0
        public ActionResult Edit(int id = 0)
        {
            PermisosAccesoDeniedEdit("DatoFiscal");
            ViewBag.CustomScriptsPageValid = BuildScriptPageValid();
            DatoFiscalEntity objDatoFiscal = proxy.GetDatoFiscal(id);

            if (objDatoFiscal == null)
            {
                return(HttpNotFound());
            }
            return(View(objDatoFiscal));
        }
예제 #5
0
        public ActionResult GetDetalleFiscal(int contrato, int plaza)
        {
            ConexionController    c = new ConexionController();
            SqlCommand            comandoSql;
            DatoFiscalEntity      datos       = new DatoFiscalEntity();
            List <CLIENTEEntity2> lista       = new List <CLIENTEEntity2>();
            SqlConnection         conexionSQL = new SqlConnection(c.DameConexion(plaza));

            try
            {
                conexionSQL.Open();
            }
            catch
            { }
            comandoSql = new SqlCommand("exec ConsultarDatosFiscales " + contrato);


            comandoSql.Connection = conexionSQL;
            SqlDataReader reader = comandoSql.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    datos.Contrato      = Int32.Parse(reader[0].ToString());
                    datos.RAZON_SOCIAL  = reader[2].ToString();
                    datos.RFC           = reader[3].ToString();
                    datos.CALLE_RS      = reader[4].ToString();
                    datos.NUMERO_RS     = reader[5].ToString();
                    datos.ENTRECALLES   = reader[6].ToString();
                    datos.COLONIA_RS    = reader[7].ToString();
                    datos.CIUDAD_RS     = reader[8].ToString();
                    datos.ESTADO_RS     = reader[9].ToString();
                    datos.CP_RS         = reader[10].ToString();
                    datos.TELEFONO_RS   = reader[11].ToString();
                    datos.FAX_RS        = reader[12].ToString();
                    datos.IDENTIFICADOR = Int32.Parse(reader[14].ToString());
                    datos.CURP          = reader[15].ToString();
                    datos.id_asociado   = Int32.Parse(reader[16].ToString());
                    datos.Email         = reader[17].ToString();
                    datos.Pais          = reader[18].ToString();
                }
            }

            return(Json(datos, JsonRequestBehavior.AllowGet));
        }
        public ActionResult UpdateCliente(CLIENTEEntity2 cliente, DatoFiscalEntity fiscales)
        {
            ConexionController c = new ConexionController();
            SqlCommand         comandoSql;
            SqlCommand         comandoSql2;
            SqlConnection      conexionSQL = new SqlConnection(c.DameConexion(cliente.conexion));
            int result = 0;

            try
            {
                conexionSQL.Open();
            }
            catch
            { }
            try
            {
                comandoSql            = new SqlCommand(@"UPDATE CLIENTES SET Nombre=@nombre,Clv_Calle=@calle,Numero=@numero,EntreCalles=@calles,Clv_Colonia=@colonia,CodigoPostal=@cp,Telefono=@telefono,Celular=@celular,Clv_Ciudad=@cuidad,Email=@email where contrato=" + cliente.CONTRATO);
                comandoSql.Connection = conexionSQL;
                comandoSql.Parameters.AddWithValue("@nombre", cliente.NOMBRE);
                comandoSql.Parameters.AddWithValue("@calle", cliente.Clv_Calle);
                comandoSql.Parameters.AddWithValue("@numero", cliente.NUMERO);
                comandoSql.Parameters.AddWithValue("@calles", cliente.ENTRECALLES);
                comandoSql.Parameters.AddWithValue("@colonia", cliente.Clv_Colonia);
                comandoSql.Parameters.AddWithValue("@cp", cliente.CodigoPostal);
                comandoSql.Parameters.AddWithValue("@telefono", cliente.TELEFONO);
                comandoSql.Parameters.AddWithValue("@celular", cliente.CELULAR);
                comandoSql.Parameters.AddWithValue("@cuidad", cliente.Clv_Ciudad);
                comandoSql.Parameters.AddWithValue("@email", cliente.Email);
                comandoSql.ExecuteNonQuery();
                result = 1;
            }
            catch { }

            try
            {
                comandoSql2            = new SqlCommand("UPDATE DatosFiscales set Razon_Social=" + fiscales.RAZON_SOCIAL + ",RFC=" + fiscales.RFC + ",Calle_RS=" + fiscales.CALLE_RS + ",Numero_RS=" + fiscales.NUMERO_RS + ",EntreCalles=" + fiscales.ENTRECALLES + ",Colonia_RS=" + fiscales.COLONIA_RS + ",Ciudad_RS=" + fiscales.CIUDAD_RS + ",Estado_RS=" + fiscales.ESTADO_RS + ",CP_RS=" + fiscales.CP_RS + ",Telefono_RS=" + fiscales.TELEFONO_RS + ",Fax_RS=" + fiscales.FAX_RS + ",CURP=" + fiscales.CURP + " where contrato=" + cliente.CONTRATO);
                comandoSql2.Connection = conexionSQL;

                comandoSql2.ExecuteNonQuery();
            }
            catch { }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
예제 #7
0
 public ActionResult Create(DatoFiscalEntity objDatoFiscal)
 {
     if (ModelState.IsValid)
     {
         objDatoFiscal.BaseRemoteIp = RemoteIp;
         objDatoFiscal.BaseIdUser   = LoggedUserName;
         int result = proxy.AddDatoFiscal(objDatoFiscal);
         if (result == -1)
         {
             AssingMessageScript("El DatoFiscal ya existe en el sistema.", "error", "Error", true);
             CheckNotify();
             return(View(objDatoFiscal));
         }
         if (result > 0)
         {
             AssingMessageScript("Se dio de alta el DatoFiscal en el sistema.", "success", "Éxito", true);
             return(RedirectToAction("Index"));
         }
     }
     return(View(objDatoFiscal));
 }
예제 #8
0
        /// <summary>
        /// Gets DatoFiscal by
        ///</summary>
        public override DatoFiscalEntity GetDatoFiscalById(long?Contrato)
        {
            using (SqlConnection connection = new SqlConnection(SoftvSettings.Settings.DatoFiscal.ConnectionString))
            {
                SqlCommand       comandoSql        = CreateCommand("Softv_DatoFiscalGetById", connection);
                DatoFiscalEntity entity_DatoFiscal = null;

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

                IDataReader rd = null;
                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }
                    rd = ExecuteReader(comandoSql, CommandBehavior.SingleRow);
                    if (rd.Read())
                    {
                        entity_DatoFiscal = GetDatoFiscalFromReader(rd);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception("Error getting data DatoFiscal " + ex.Message, ex);
                }
                finally
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                    if (rd != null)
                    {
                        rd.Close();
                    }
                }
                return(entity_DatoFiscal);
            }
        }
예제 #9
0
        public static DatoFiscalEntity GetOne(long?Contrato)
        {
            DatoFiscalEntity result = ProviderSoftv.DatoFiscal.GetDatoFiscalById(Contrato);

            return(result);
        }
예제 #10
0
        public static int Edit(DatoFiscalEntity objDatoFiscal)
        {
            int result = ProviderSoftv.DatoFiscal.EditDatoFiscal(objDatoFiscal);

            return(result);
        }
예제 #11
0
 public int UpdateDatoFiscal(DatoFiscalEntity objDatoFiscal)
 {
     return(DatoFiscal.Edit(objDatoFiscal));
 }
예제 #12
0
 public int AddDatoFiscal(DatoFiscalEntity objDatoFiscal)
 {
     return(DatoFiscal.Add(objDatoFiscal));
 }
예제 #13
0
 /// <summary>
 /// Abstract method to update DatoFiscal
 /// </summary>
 public abstract int EditDatoFiscal(DatoFiscalEntity entity_DatoFiscal);
예제 #14
0
 /// <summary>
 /// Abstract method to add DatoFiscal
 ///  /summary>
 /// <param name="DatoFiscal"></param>
 /// <returns></returns>
 public abstract int AddDatoFiscal(DatoFiscalEntity entity_DatoFiscal);
예제 #15
0
        /// <summary>
        ///</summary>
        /// <param name="DatoFiscal"> Object DatoFiscal added to List</param>
        public override int AddDatoFiscal(DatoFiscalEntity entity_DatoFiscal)
        {
            int result = 0;

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

                AssingParameter(comandoSql, "@Contrato", entity_DatoFiscal.Contrato);

                AssingParameter(comandoSql, "@IVADESGLOSADO", entity_DatoFiscal.IVADESGLOSADO);

                AssingParameter(comandoSql, "@RAZON_SOCIAL", entity_DatoFiscal.RAZON_SOCIAL);

                AssingParameter(comandoSql, "@RFC", entity_DatoFiscal.RFC);

                AssingParameter(comandoSql, "@CALLE_RS", entity_DatoFiscal.CALLE_RS);

                AssingParameter(comandoSql, "@NUMERO_RS", entity_DatoFiscal.NUMERO_RS);

                AssingParameter(comandoSql, "@ENTRECALLES", entity_DatoFiscal.ENTRECALLES);

                AssingParameter(comandoSql, "@COLONIA_RS", entity_DatoFiscal.COLONIA_RS);

                AssingParameter(comandoSql, "@CIUDAD_RS", entity_DatoFiscal.CIUDAD_RS);

                AssingParameter(comandoSql, "@ESTADO_RS", entity_DatoFiscal.ESTADO_RS);

                AssingParameter(comandoSql, "@CP_RS", entity_DatoFiscal.CP_RS);

                AssingParameter(comandoSql, "@TELEFONO_RS", entity_DatoFiscal.TELEFONO_RS);

                AssingParameter(comandoSql, "@FAX_RS", entity_DatoFiscal.FAX_RS);

                AssingParameter(comandoSql, "@TIPO", entity_DatoFiscal.TIPO);

                AssingParameter(comandoSql, "@IDENTIFICADOR", entity_DatoFiscal.IDENTIFICADOR);

                AssingParameter(comandoSql, "@CURP", entity_DatoFiscal.CURP);

                AssingParameter(comandoSql, "@id_asociado", entity_DatoFiscal.id_asociado);

                try
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }
                    result = ExecuteNonQuery(comandoSql);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error adding DatoFiscal " + ex.Message, ex);
                }
                finally
                {
                    connection.Close();
                }
                result = (int)comandoSql.Parameters["@IdDatoFiscal"].Value;
            }
            return(result);
        }
예제 #16
0
        public ActionResult QuickIndex(int?page, int?pageSize, long?Contrato, byte?IVADESGLOSADO, String RAZON_SOCIAL, String RFC, String CALLE_RS, String NUMERO_RS, String ENTRECALLES, String COLONIA_RS, String CIUDAD_RS, String ESTADO_RS, String CP_RS, String TELEFONO_RS, String FAX_RS, char TIPO, Decimal?IDENTIFICADOR, String CURP, int?id_asociado)
        {
            int pageNumber = (page ?? 1);
            int pSize      = pageSize ?? SoftvMVC.Properties.Settings.Default.pagnum;
            SoftvList <DatoFiscalEntity> listResult       = null;
            List <DatoFiscalEntity>      listDatoFiscal   = new List <DatoFiscalEntity>();
            DatoFiscalEntity             objDatoFiscal    = new DatoFiscalEntity();
            DatoFiscalEntity             objGetDatoFiscal = new DatoFiscalEntity();


            if ((Contrato != null))
            {
                objDatoFiscal.Contrato = Contrato;
            }

            if ((IVADESGLOSADO != null))
            {
                objDatoFiscal.IVADESGLOSADO = IVADESGLOSADO;
            }

            if ((RAZON_SOCIAL != null && RAZON_SOCIAL.ToString() != ""))
            {
                objDatoFiscal.RAZON_SOCIAL = RAZON_SOCIAL;
            }

            if ((RFC != null && RFC.ToString() != ""))
            {
                objDatoFiscal.RFC = RFC;
            }

            if ((CALLE_RS != null && CALLE_RS.ToString() != ""))
            {
                objDatoFiscal.CALLE_RS = CALLE_RS;
            }

            if ((NUMERO_RS != null && NUMERO_RS.ToString() != ""))
            {
                objDatoFiscal.NUMERO_RS = NUMERO_RS;
            }

            if ((ENTRECALLES != null && ENTRECALLES.ToString() != ""))
            {
                objDatoFiscal.ENTRECALLES = ENTRECALLES;
            }

            if ((COLONIA_RS != null && COLONIA_RS.ToString() != ""))
            {
                objDatoFiscal.COLONIA_RS = COLONIA_RS;
            }

            if ((CIUDAD_RS != null && CIUDAD_RS.ToString() != ""))
            {
                objDatoFiscal.CIUDAD_RS = CIUDAD_RS;
            }

            if ((ESTADO_RS != null && ESTADO_RS.ToString() != ""))
            {
                objDatoFiscal.ESTADO_RS = ESTADO_RS;
            }

            if ((CP_RS != null && CP_RS.ToString() != ""))
            {
                objDatoFiscal.CP_RS = CP_RS;
            }

            if ((TELEFONO_RS != null && TELEFONO_RS.ToString() != ""))
            {
                objDatoFiscal.TELEFONO_RS = TELEFONO_RS;
            }

            if ((FAX_RS != null && FAX_RS.ToString() != ""))
            {
                objDatoFiscal.FAX_RS = FAX_RS;
            }


            if ((IDENTIFICADOR != null))
            {
                objDatoFiscal.IDENTIFICADOR = IDENTIFICADOR;
            }

            if ((CURP != null && CURP.ToString() != ""))
            {
                objDatoFiscal.CURP = CURP;
            }

            if ((id_asociado != null))
            {
                objDatoFiscal.id_asociado = id_asociado;
            }

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

            var DatoFiscalAsIPagedList = new StaticPagedList <DatoFiscalEntity>(listDatoFiscal, pageNumber, pSize, listResult.totalCount);

            if (DatoFiscalAsIPagedList.Count > 0)
            {
                return(PartialView(DatoFiscalAsIPagedList));
            }
            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));
            }
        }