Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var modal = Request.QueryString.Get("modal"); bool isModal = !string.IsNullOrEmpty(modal) && modal.Equals("true"); (Master as SiteMaster).BackgroundContent(isModal);
            }
            string idArc = Request.QueryString.Get("Mensaje");

            BasesDatos   DB = new BasesDatos("");
            DbDataReader DR;
            string       mensaje        = "";
            string       mensajeTecnico = "";

            DB = new BasesDatos((Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE"));
            DB.Conectar();
            DB.CrearComando(@"select mensaje, MensajeTecnico from Log_Archivos where id_Archivo = @id_Archivo");
            DB.AsignarParametroCadena("@id_Archivo", idArc);
            DR = DB.EjecutarConsulta();
            while (DR.Read())
            {
                mensaje        = DR[0].ToString().Trim();
                mensajeTecnico = DR[1].ToString().Trim();
            }
            DB.Desconectar();

            tbMensaje.Text        = mensaje;
            tbMensajeTecnico.Text = mensajeTecnico;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["IDENTEMI"] != null)
            {
                if (Session["errorTimbres"] != null && Convert.ToBoolean(Session["errorTimbres"]))
                {
                    Response.Redirect("~/CantidadTimbres.aspx", true);
                    return;
                }
                else if (Session["errorCertificado"] != null && Convert.ToBoolean(Session["errorCertificado"]))
                {
                    Response.Redirect("~/LicExpirada.aspx", true);
                    return;
                }
                _dbe = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
                _dbr = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE", "Recepcion");
                _log = new Control.Log(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");

                if (Session["idUser"] != null)
                {
                    SqlDataTiposProveedor.ConnectionString      = _dbr.CadenaConexion;
                    SqlDataSourceTProveedor.ConnectionString    = _dbr.CadenaConexion;
                    SqlDataSourceGValidation.ConnectionString   = _dbr.CadenaConexion;
                    SqlDataSourceGroupValidate.ConnectionString = _dbr.CadenaConexion;
                    SqlDataSourceEstructura.ConnectionString    = _dbr.CadenaConexion;
                    _idUser = Session["idUser"].ToString();
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["IDENTEMI"] != null)
            {
                if (Session["errorTimbres"] != null && Convert.ToBoolean(Session["errorTimbres"]))
                {
                    Response.Redirect("~/CantidadTimbres.aspx", true);
                    return;
                }
                else if (Session["errorCertificado"] != null && Convert.ToBoolean(Session["errorCertificado"]))
                {
                    Response.Redirect("~/LicExpirada.aspx", true);
                    return;
                }
                _db  = new BasesDatos(Session["IDENTEMI"].ToString());
                _log = new Log(Session["IDENTEMI"].ToString());

                if (Session["idUser"] != null)
                {
                    _idUser = Session["idUser"].ToString();
                    if (!Page.IsPostBack)
                    {
                        Session["_bytesCargados"] = null;
                        Session["_dtFacturas"]    = null;
                    }
                }
            }
            else
            {
                Response.Redirect("~/Cerrar.aspx");
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            _dbe = new BasesDatos(Session["IDENTEMI"].ToString());
            SqlDataRFC.ConnectionString       = _dbe.CadenaConexion;
            SqlDataSourceRfc.ConnectionString = _dbe.CadenaConexion;

            if (Session["IDENTEMI"] != null)
            {
                if (Session["errorTimbres"] != null && Convert.ToBoolean(Session["errorTimbres"]))
                {
                    Response.Redirect("~/CantidadTimbres.aspx", true);
                    return;
                }
                else if (Session["errorCertificado"] != null && Convert.ToBoolean(Session["errorCertificado"]))
                {
                    Response.Redirect("~/LicExpirada.aspx", true);
                    return;
                }
                _dbe = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
                _dbr = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE", "Recepcion");
                _log = new Log(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");

                if (Session["idUser"] != null)
                {
                    _idUser = Session["idUser"].ToString();
                }
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["IDENTEMI"] != null)
     {
         _db  = new BasesDatos(Session["IDENTEMI"].ToString());
         _log = new Log(Session["IDENTEMI"].ToString());
         SqlDataCertificados.ConnectionString = _db.CadenaConexion;
         SqlDataCertificados.SelectCommand    = queryCertificados + (Session["idUser"].ToString().Equals("1") ? "" : " WHERE c.invisible = 'False'");
         if (Session["idUser"] != null)
         {
             _idUser = Session["idUser"].ToString();
         }
     }
     if (!IsPostBack)
     {
         _postedCer = null;
         _postedCer = null;
         _idEditar  = null;
         var sql = @"SELECT dircertificados, dirllaves FROM Par_ParametrosSistema";
         _db.Conectar();
         _db.CrearComando(sql);
         var dr = _db.EjecutarConsulta();
         while (dr.Read())
         {
             _rutaCertificados = dr["dircertificados"].ToString();
             _rutaLlaves       = dr["dirllaves"].ToString();
         }
         _db.Desconectar();
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     _db = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
     SqlDataSourcePtoEmi.ConnectionString     = _db.CadenaConexion;
     SqlDataSourceTipDoc.ConnectionString     = _db.CadenaConexion;
     SqlDataSourceEmisor.ConnectionString     = _db.CadenaConexion;
     SqlDataSourceReceptor.ConnectionString   = _db.CadenaConexion;
     SqlDataSourceRepTickets.ConnectionString = _db.CadenaConexion;
     if (Session["idUser"] != null)
     {
         if (!IsPostBack)
         {
             ddlTipDoc.DataBind();
             if (Session["IDGIRO"] != null)
             {
                 if (Session["IDGIRO"].ToString().Contains("1"))
                 {
                     #region Hotel
                     var toRemove = from i in ddlTipDoc.Items.Cast <ListItem>() where (!i.Value.Equals("01") && !i.Value.Equals("04") && !i.Value.Equals("0")) select i;
                     var lista    = toRemove.ToList();
                     foreach (var item in lista)
                     {
                         ddlTipDoc.Items.Remove(item);
                     }
                     #endregion
                 }
             }
         }
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     _db = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
     SqlDataSource3.ConnectionString  = _db.CadenaConexion;
     SqlDataTipo.ConnectionString     = _db.CadenaConexion;
     SqlDataImpuesto.ConnectionString = _db.CadenaConexion;
 }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var modal = Request.QueryString.Get("modal"); bool isModal = !string.IsNullOrEmpty(modal) && modal.Equals("true"); (Master as SiteMaster).BackgroundContent(isModal);
            }

            string       file = Request.QueryString.Get("Trama");
            BasesDatos   DB   = new BasesDatos("");
            DbDataReader DR;
            string       trama = "";

            DB = new BasesDatos((Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE"));
            DB.Conectar();
            DB.CrearComando(@"select trama from Log_Archivos where id_Archivo = @id_Archivo");
            DB.AsignarParametroCadena("@id_Archivo", file);
            DR = DB.EjecutarConsulta();
            while (DR.Read())
            {
                trama = DR[0].ToString().Trim();
            }
            DB.Desconectar();

            trama = trama.Replace("/r", "\r");
            trama = trama.Replace("/n", "\n");

            tbTrama.Text = trama;
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["IDENTEMI"] == null)
     {
         Response.Redirect("~/Cerrar.aspx", true);
         return;
     }
     if (!Page.IsPostBack)
     {
         _db = new BasesDatos(Session["IDENTEMI"].ToString());
         _db.Conectar();
         _db.CrearComando("SELECT DISTINCT TOP 1 servidorSMTP,puertoSMTP,sslSMTP,userSMTP,passSMTP,emailEnvio,emailNotificacion,emailOpera,emailRecepcion,emailFmensual,emailBcc,emailAltaUsers,emailRecepBcc FROM Par_ParametrosSistema");
         var dr = _db.EjecutarConsulta();
         if (dr.Read())
         {
             tbServidor.Text          = dr["servidorSMTP"].ToString();
             tbPuerto.Text            = dr["puertoSMTP"].ToString();
             cbSSL.Checked            = Convert.ToBoolean(dr["sslSMTP"]);
             tbUsuario.Text           = dr["userSMTP"].ToString();
             tbPassword.Text          = dr["passSMTP"].ToString();
             tbEmailEnvio.Text        = dr["emailEnvio"].ToString();
             tbEmailNotificacion.Text = dr["emailNotificacion"].ToString();
             tbEmailOpera.Text        = dr["emailOpera"].ToString();
             tbEmailRecepcion.Text    = dr["emailRecepcion"].ToString();
             tbEmailFolios.Text       = dr["emailFmensual"].ToString();
             tbBcc.Text           = dr["emailBcc"].ToString();
             tbEmailUsers.Text    = dr["emailAltaUsers"].ToString();
             tbEmailRecepBcc.Text = dr["emailRecepBcc"].ToString();
         }
         _db.Desconectar();
     }
 }
Ejemplo n.º 10
0
    private void GuardarBd()
    {
        BasesDatos bd          = null;
        var        fueExistosa = Status == 3 && !string.IsNullOrEmpty(IdFactura);

        try
        {
            if (fueExistosa)
            {
                bd = new BasesDatos();
                bd.Conectar();
                bd.CrearComando(@"UPDATE RetencionFactura SET estado = @estado WHERE idRetencion = @ID");
                bd.AsignarParametroEntero("@estado", Status);
                bd.AsignarParametroCadena("@ID", IdFactura);
                bd.EjecutarConsulta1();
            }
        }
        catch
        {
            // ignored
        }
        finally
        {
            if (bd != null)
            {
                bd.Desconectar();
            }
        }
    }
Ejemplo n.º 11
0
 /// <summary>
 ///     Inicia las validaciones
 /// </summary>
 public Validations()
 {
     _db          = new BasesDatos();
     _failRecords = new List <KeyValuePair <OracleRecord, string> >();
     _dbRecords   = new Dictionary <string, List <string> >();
     _reporte     = new OutputInterface();
     GetDataFromDataBase();
 }
Ejemplo n.º 12
0
 /// <summary>
 ///     Inicializa el Timbrado con los valores que se van a agregar en la base de datos
 /// </summary>
 /// <param name="db"></param>
 /// <param name="serie">Serie del emisor</param>
 /// <param name="rfcEmisor">RFC del emisor</param>
 /// <param name="rfcReceptor">RFC del receptor</param>
 public Timbrado(BasesDatos db, string serie, string rfcEmisor, string rfcReceptor)
 {
     _db          = db;
     _serie       = serie;
     _rfcEmisor   = rfcEmisor;
     _rfcReceptor = rfcReceptor;
     Log("Se inicializo con serie=" + serie + ",rfcEmisor=" + _rfcEmisor + ",rfcReceptor=" + _rfcReceptor);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     _db = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
     SqlDataTramas.ConnectionString     = _db.CadenaConexion;
     SqlDataTipoTramas.ConnectionString = _db.CadenaConexion;
     if (!IsPostBack)
     {
         Buscar();
     }
 }
Ejemplo n.º 14
0
        /// <summary>
        /// /
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void GenerarReporte_Click(object sender, EventArgs e)
        {
            var Reporte = new FacturaGlobalWeb.FacturaGlobalWeb();

            _fechacreacion = Localization.Now.ToString("yyyyMMddHHmmss");
            Ex             = null;
            _db            = new BasesDatos((Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE"));
            var _connectionString = _db.CadenaConexion.ToString();

            if (string.IsNullOrEmpty(tbsucursal.Text))
            {
                (Master as SiteMaster).MostrarAlerta(this, "Inserte la serie de la sucursal", 4, null);
                return;
            }

            if (!string.IsNullOrEmpty(tbFecha.Text) || !string.IsNullOrEmpty(FechaFin.Text) || !string.IsNullOrEmpty(tbsucursal.Text))
            {
                var where = "";
                var sql     = @"SELECT Trama from log_trama";
                var fechain = tbFecha.Text + "-" + FechaFin.Text;
                if (!string.IsNullOrEmpty(tbsucursal.Text))
                {
                    where += (!string.IsNullOrEmpty(where) ? " AND " : " WHERE ") + "serie = " + "'" + tbsucursal.Text + "'";
                }
                where += (!string.IsNullOrEmpty(where) ? " AND " : " WHERE ") + " Trama like '%" + fechain.ToString() + "%'" + " AND " + " observaciones = " + "'ExtranetOK'" + " AND " + "tipo= " + "4";
                _db.Conectar();
                _db.CrearComando(sql + where);
                var dr  = _db.EjecutarConsulta();
                var val = new List <string[]>();
                while (dr.Read())
                {
                    string[] valor = new string[3];
                    valor[0] = dr[0].ToString();
                    val.Add(valor);
                }
                _db.Desconectar();
                var directorio = AppDomain.CurrentDomain.BaseDirectory;
                var rfc        = Session["IDENTEMI"].ToString();
                var cfdi       = Session["CfdiVersion"].ToString();
                if (val.Count > 0)
                {
                    new System.Threading.Thread(() =>
                    {
                        Reporte.GenerarReporteAsync(tbFecha.Text, FechaFin.Text, tbsucursal.Text, rfc.ToString(), cfdi, directorio);
                    }).Start();
                }
                else
                {
                    (Master as SiteMaster).MostrarAlerta(this, "No se encontraron registros", 4, null);
                    return;
                }
                gvFacGlobWeb.DataBind();
                (Master as SiteMaster).MostrarAlerta(this, "El reporte se está generando, favor de actualizar los registros nuevamente en unos minutos", 4);
            }
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["IDENTEMI"] != null)
     {
         _db = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
         SqlDataSource1.ConnectionString = _db.CadenaConexion;
     }
     if (!Page.IsPostBack)
     {
     }
 }
Ejemplo n.º 16
0
        //private Boolean bcrearCliente;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var modal = Request.QueryString.Get("modal"); bool isModal = !string.IsNullOrEmpty(modal) && modal.Equals("true"); (Master as SiteMaster).BackgroundContent(isModal);
            }
            if (Session["IDENTEMI"] != null)
            {
                DB = new BasesDatos((Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE"));
            }
            //log = new Log((Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE"));
            if (!Page.IsPostBack)
            {
                if (Session["idUser"] != null)
                {
                    idRol = Request.QueryString.Get("id");
                    DB.Conectar();
                    DB.CrearComandoProcedimiento("PA_consulta_rol");
                    DB.AsignarParametroProcedimiento("@idRol", System.Data.DbType.String, idRol);
                    DbDataReader DR = DB.EjecutarConsulta();
                    if (DR.Read())
                    {
                        tbRol.Text = DR[1].ToString();
                        cbConsultarPropia.Checked       = Convert.ToBoolean(DR[2].ToString());
                        cbConsultarTodas.Checked        = Convert.ToBoolean(DR[3].ToString());
                        tbComprobantes.Text             = Convert.ToString(DR[4].ToString());
                        tbComprobantesCNS.Text          = Convert.ToString(DR[5].ToString());
                        cbConsultarPropiaPtoEmi.Checked = Convert.ToBoolean(DR[6].ToString());
                        cbEditComp.Checked        = Convert.ToBoolean(DR[9].ToString());
                        cbReportesGeneral.Checked = Convert.ToBoolean(DR[10].ToString());
                        cbClientes.Checked        = Convert.ToBoolean(DR[11].ToString());
                        cbEmpleado.Checked        = Convert.ToBoolean(DR[12].ToString());
                        cbRol.Checked             = Convert.ToBoolean(DR[13].ToString());
                        cbEditEmi.Checked         = Convert.ToBoolean(DR[14].ToString());
                        cbEditEstab.Checked       = Convert.ToBoolean(DR[15].ToString());
                        cbEditPtoEmi.Checked      = Convert.ToBoolean(DR[16].ToString());
                        cbEditInfoGeneral.Checked = Convert.ToBoolean(DR[17].ToString());
                        cbEditSmtp.Checked        = Convert.ToBoolean(DR[18].ToString());
                        cbEditMensaje.Checked     = Convert.ToBoolean(DR[19].ToString());
                        cbEditUserOpera.Checked   = Convert.ToBoolean(DR[20].ToString());
                        cbLimpiarLogs.Checked     = Convert.ToBoolean(DR[21].ToString());
                        cbEditPerfil.Checked      = Convert.ToBoolean(DR[22].ToString());
                        cbEnvioEmail.Checked      = Convert.ToBoolean(DR[23].ToString());
                        tbTOPComp.Text            = Convert.ToString(DR[25].ToString());
                        cbRecepcion.Checked       = Convert.ToBoolean(DR[26].ToString());
                        cbVisible.Checked         = Convert.ToBoolean(DR[27].ToString());
                        //ddlFacturas.SelectedValue = DR[16].ToString();
                        //cbNC.Checked = Convert.ToBoolean(DR[17].ToString());
                    }
                    DB.Desconectar();
                }
            }
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         _db = new BasesDatos(Session["IDENTEMI"]?.ToString() ?? "CORE");
         ScriptManager.RegisterStartupScript(this, GetType(), "_showPerfilesActive", "resaltar('liSeguridad');", true);
     }
     SqlDataPerfiles.ConnectionString = _db.CadenaConexion;
     if (Session["descRol"] != null && Session["descRol"].ToString().Equals("delatam", StringComparison.OrdinalIgnoreCase))
     {
         SqlDataPerfiles.SelectCommand = SqlDataPerfiles.SelectCommand.Replace(" AND visible = 'True'", "");
     }
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["IDENTEMI"] != null)
     {
         _db = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
         SqlDataSourceEmpleados.ConnectionString = _db.CadenaConexion;
         SqlDataReceptores.ConnectionString      = _db.CadenaConexion;
         if (!IsPostBack)
         {
             _idEditar = "";
         }
     }
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["IDENTEMI"] != null)
     {
         _db = new BasesDatos((Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE"));
         SqlDataSource1.ConnectionString = _db.CadenaConexion;
     }
     if (!IsPostBack)
     {
         DataBindEventos();
         gvEventos.Sort("fecha", SortDirection.Descending);
     }
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     _db  = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
     _dbr = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE", "Recepcion");
     SqlDataSourceTipDoc.ConnectionString   = _dbr.CadenaConexion;
     SqlDataSourceEmisor.ConnectionString   = _dbr.CadenaConexion;
     SqlDataSourceReceptor.ConnectionString = _dbr.CadenaConexion;
     Session["_isWorkflow"] = IsWorkflow(); //Usage: Convert.ToBoolean(Session["_isWorkflow"])
     if (Session["idUser"] != null)
     {
         if (!IsPostBack)
         {
             ddlTipDoc.DataBind();
             if (Session["IDGIRO"] != null)
             {
                 if (Session["IDGIRO"].ToString().Contains("1"))
                 {
                     #region Hotel
                     var toRemove = from i in ddlTipDoc.Items.Cast <ListItem>() where (!i.Value.Equals("01") && !i.Value.Equals("04") && !i.Value.Equals("0")) select i;
                     var lista    = toRemove.ToList();
                     foreach (var item in lista)
                     {
                         ddlTipDoc.Items.Remove(item);
                     }
                     #endregion
                 }
             }
             if (Session["USERNAME"].ToString().StartsWith("PROVE"))
             {
                 ddlEmisor.DataBind();
                 try
                 {
                     var rfc  = Session["rfcCliente"].ToString();
                     var item = ddlEmisor.Items.FindByText(rfc);
                     ddlEmisor.SelectedValue = item.Value;
                     ddlEmisor.Enabled       = false;
                 }
                 catch { }
                 //ddlReceptor.DataBind();
                 //try
                 //{
                 //    var rfc = Session["IDENTEMI"].ToString();
                 //    var item = ddlReceptor.Items.FindByText(rfc);
                 //    ddlReceptor.SelectedValue = item.Value;
                 //    ddlReceptor.Enabled = false;
                 //}
                 //catch { }
             }
         }
     }
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Guarda la interfaz en disco y en la base de datos
        /// </summary>
        /// <param name="fileName">Nombre del archivo (sin ruta)</param>
        /// <param name="logFileName">Nombre del archivo log (con ruta)</param>
        /// <param name="storeDb">Guardar registro en la base de datos</param>
        /// <returns></returns>
        public bool Save(string fileName, string logFileName = null, bool storeDb = true)
        {
            var saved = true;
            var db    = new BasesDatos();

            try
            {
                //Close();
                var directory = ConfigurationManager.AppSettings.Get("writeDirectory");
                Directory.CreateDirectory(directory);
                var file = new FileInfo(directory + @"\" + fileName);
                _file = file;
                var csv = ListToCsv();
                File.WriteAllText(file.FullName, csv);
                //_package.SaveAs(file);
                saved = file.Exists;
                if (storeDb)
                {
                    db.Conectar();
                    db.CrearComando(@"INSERT INTO interfazOracle(fechaEjecucion,tipo,nombreArc,numRegistros,rutaArcInterfaz,rutaArcLog) OUTPUT inserted.idInterfaz VALUES (@fechaEjecucion,@tipo,@nombreArc,@numRegistros,@rutaArcInterfaz,@rutaArcLog)");
                    db.AsignarParametroCadena("@fechaEjecucion", DateTime.Now.ToString("s"));
                    db.AsignarParametroCadena("@tipo", "Oracle");
                    db.AsignarParametroCadena("@nombreArc", file.Name);
                    db.AsignarParametroCadena("@numRegistros", ((_rowNumber.ToString()))); //> 0 ? _rowNumber - 1 : _rowNumber).ToString()));
                    db.AsignarParametroCadena("@rutaArcInterfaz", @"InterfacesOracle\" + file.Name);
                    db.AsignarParametroCadena("@rutaArcLog", !string.IsNullOrEmpty(logFileName) ? (@"InterfacesOracle\log Oracle\" + logFileName) : "");
                    var dr = db.EjecutarConsulta();
                    if (dr.Read())
                    {
                        _idInterface = dr[0].ToString();
                    }
                    else
                    {
                        throw new Exception("No se pudo guardar en la BD");
                    }
                    db.Desconectar();
                }
                saved = true;
            }
            catch (Exception)
            {
                if (db != null)
                {
                    db.Desconectar();
                }
                saved = false;
            }
            return(saved);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            _db = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
            if (Session["idUser"] != null)
            {
                _idUser = Session["idUser"].ToString();
                SqlDataReceptores.ConnectionString = _db.CadenaConexion;
                SqlDataContactos.ConnectionString  = _db.CadenaConexion;
                SqlDataMetodoPago.ConnectionString = _db.CadenaConexion;
                SqlDataMetodoPago.SelectCommand    = SqlDataMetodoPago.SelectCommand.Replace("@tipoCatalogo", Session["CfdiVersion"].ToString().Equals("3.3") ? "MetodoPagoCfdi33" : "MetodoPago");
                if (!Page.IsPostBack)
                {
                    #region Giro Empresarial

                    if (Session["IDGIRO"] != null)
                    {
                        if (Session["IDGIRO"].ToString().Contains("1") || Session["IDGIRO"].ToString().Contains("2"))
                        {
                            trDenom.Visible     = false;
                            trCurp.Visible      = false;
                            rowDenomBus.Visible = false;
                        }
                        else
                        {
                            trDenom.Visible     = true;
                            trCurp.Visible      = true;
                            rowDenomBus.Visible = true;
                        }
                    }

                    #endregion
                    _db.Conectar();
                    _db.CrearComando("DELETE FROM Cat_Mx_Contactos_Temp");
                    _db.EjecutarConsulta1();
                    _db.Desconectar();
                    Buscar();
                    RequiredFieldValidator14.Enabled = !Session["CfdiVersion"].ToString().Equals("3.3");
                    RequiredFieldValidator16.Enabled = !Session["CfdiVersion"].ToString().Equals("3.3");
                    RequiredFieldValidator23.Enabled = !Session["CfdiVersion"].ToString().Equals("3.3");
                    if (Session["IDENTEMI"].ToString().Equals("OHC070227M80") || Session["IDENTEMI"].ToString().Equals("OPL000131DL3"))
                    {
                        lblTitulo.Text          = "CLIENTES";
                        bNuevo.Text             = "Nuevo Cliente";
                        lblBuscarReceptor.Text  = "Buscar Cliente";
                        lblAgregarReceptor.Text = "Agregar/Editar Cliente";
                    }
                }
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["errorTimbres"] != null && Convert.ToBoolean(Session["errorTimbres"]))
            {
                Response.Redirect("~/CantidadTimbres.aspx", true);
                return;
            }
            else if (Session["errorCertificado"] != null && Convert.ToBoolean(Session["errorCertificado"]))
            {
                Response.Redirect("~/LicExpirada.aspx", true);
                return;
            }
            _db  = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
            _log = new Log(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
            SqlDataRFC.ConnectionString    = _db.CadenaConexion;
            SqlDataSeries.ConnectionString = _db.CadenaConexion;

            if (Session["idUser"] != null)
            {
                _idUser = Session["idUser"].ToString();
                if (!Page.IsPostBack)
                {
                    SqlDataRFC.DataBind();
                    ddlRFC.DataBind();
                    foreach (ListItem item in ddlRFC.Items)
                    {
                        if (item.Text.Equals(Session["rfcSucursal"].ToString()))
                        {
                            item.Selected = true;
                            break;
                        }
                    }
                    ddlSerie.DataBind();
                    ddlSerie.SelectedIndex = 0;
                    ddlSerie_SelectedIndexChanged(null, null);

                    SqlConnection  con = new SqlConnection(_db.CadenaConexion);
                    SqlCommand     cmd = new SqlCommand("SELECT clave, descripcion FROM Cat_UsoCfdi", con);
                    SqlDataAdapter da  = new SqlDataAdapter(cmd);
                    DataTable      dt  = new DataTable();
                    da.Fill(dt);
                    ddlUsoCFDI.DataTextField  = "descripcion";
                    ddlUsoCFDI.DataValueField = "clave";
                    ddlUsoCFDI.DataSource     = dt;
                    ddlUsoCFDI.DataBind();
                    ddlUsoCFDI.SelectedValue = "G02";
                }
            }
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["IDENTEMI"] != null)
     {
         if (!IsPostBack)
         {
             _db = new BasesDatos(Session["IDENTEMI"].ToString());
         }
         reglasDataSource.ConnectionString = _db.CadenaConexion;
     }
     else
     {
         Response.Redirect("~/Seguridad.aspx");
     }
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     _db = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
     if (Session["idUser"] != null)
     {
         _idUser = Session["idUser"].ToString();
         SqlDataSource3.ConnectionString    = _db.CadenaConexion;
         SqlDataCategorias.ConnectionString = _db.CadenaConexion;
     }
     if (!IsPostBack)
     {
         BindConceptos();
         BindCategorias();
     }
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["IDENTEMI"] != null)
     {
         _db = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
         SqlDataSource1.ConnectionString     = _db.CadenaConexion;
         SqlDataAmbiente.ConnectionString    = _db.CadenaConexion;
         SqlDataComprobante.ConnectionString = _db.CadenaConexion;
         SqlDataTipoRecep.ConnectionString   = _db.CadenaConexion;
         if (!Page.IsPostBack)
         {
             LimpiarBusqueda();
         }
     }
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["IDENTEMI"] == null)
     {
         Response.Redirect("~/Cerrar.aspx", true);
     }
     _db = new BasesDatos(Session["IDENTEMI"].ToString());
     if (!Page.IsPostBack)
     {
         _idUser      = Session["idUser"].ToString();
         _isCliente   = Session["IsCliente"] != null && Convert.ToBoolean(Session["IsCliente"]);
         _isProveedor = Session["IsProveedor"] != null && Convert.ToBoolean(Session["IsProveedor"]);
         _isEmpleado  = !_isCliente && !_isProveedor;
         Clean();
     }
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["IDENTEMI"] != null)
     {
         _db     = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
         _dbR    = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE", "Recepcion");
         schemaE = _db.DatabaseSchema + ".dbo";
         schemaR = _dbR.DatabaseSchema + ".dbo";
         SqlDataSourceEmpleados.ConnectionString = _db.CadenaConexion;
         //SqlDataReceptores.ConnectionString = _dbR.CadenaConexion;
         if (!IsPostBack)
         {
             _idEditar = "";
         }
     }
 }
Ejemplo n.º 29
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _db  = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
     _log = new Log(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
     if (Session["idUser"] != null)
     {
         _idUser = Session["idUser"].ToString();
         SqlDataSourceBancos.ConnectionString = _db.CadenaConexion;
     }
     else
     {
         Response.Redirect("~/Cerrar.aspx", false);
     }
     if (!IsPostBack)
     {
     }
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     _db = new BasesDatos(Session["IDENTEMI"] != null ? Session["IDENTEMI"].ToString() : "CORE");
     if (Session["idUser"] != null)
     {
         _idUser = Session["idUser"].ToString();
         SqlDataEmisores.ConnectionString = _db.CadenaConexion;
         SqlDataSource2.ConnectionString  = _db.CadenaConexion;
     }
     if (!Page.IsPostBack)
     {
         Buscar();
         RequiredFieldValidator10.Enabled = !Session["CfdiVersion"].ToString().Equals("3.3");
         RequiredFieldValidator17.Enabled = !Session["CfdiVersion"].ToString().Equals("3.3");
         RequiredFieldValidator18.Enabled = !Session["CfdiVersion"].ToString().Equals("3.3");
         RequiredFieldValidator19.Enabled = !Session["CfdiVersion"].ToString().Equals("3.3");
     }
 }