protected void btnAsignarPrimero_Click(object sender, EventArgs e)
        {
            using (CobranzasDataContext db = new CobranzasDataContext())
            {
                int idAviso = Convert.ToInt32(Request["idAviso"]);
                //Entidades.Avisos Aviso = db.Avisos.Single(x => x.idAviso == idAviso);
                //Aviso.FechaCancelado = DateTime.Now;
                Int32           Lugar = ((db.Colas.Where(x => x.idOperador == Sesion.Operador.idOperador /*&& x.idPersona == Convert.ToInt32(idPersona.Value)*/).Max(x => (int?)x.Lugar) ?? 1) + 1);
                Entidades.Colas Cola  = db.Colas.SingleOrDefault(x => x.idOperador == Sesion.Operador.idOperador && x.idPersona == Convert.ToInt32(idPersona.Value));
                if (Cola == null)
                {
                    Cola = new Entidades.Colas {
                        idOperador = Sesion.Operador.idOperador, idPersona = Convert.ToInt32(idPersona.Value), Lugar = Lugar, Fecha = DateTime.Now
                    };
                    db.Colas.InsertOnSubmit(Cola);
                }
                else
                {
                    Cola.Lugar = Lugar;
                }


                try
                {
                    db.SubmitChanges();
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "ini", "window.parent.CerrarAviso();window.parent.Avisos_Actualizar();", true);
                }

                catch (Exception Ex)
                {
                    UI.Mensaje("Avisos", "Ya tiene una Prioridad activa con el mismo consignatario.", "", Page);
                }
            }
        }
Esempio n. 2
0
        protected void btnBuscar_Click(object sender, EventArgs e)
        {
            if (txtCodigo.Text == "" && txtNombre.Text == "")
            {
                return;
            }
            String CS = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=Cobranzas;Password=&&admin%%abc;Initial Catalog=milleniumv2;Data Source=SERV005";

            try
            {
                using (OleDbConnection Conn = new OleDbConnection(CS))
                {
                    Conn.Open();
                    OleDbCommand Comm = Conn.CreateCommand();
                    Comm.CommandType = CommandType.Text;
                    if (txtCodigo.Text != "")
                    {
                        Comm.CommandText = "SELECT * FROM oCliente WHERE ClienteId=?";
                        Comm.Parameters.Add("clienteid", OleDbType.Integer).Value = Convert.ToInt32(txtCodigo.Text);
                    }
                    else
                    {
                        Comm.CommandText = "SELECT * FROM oCliente WHERE clinombre like '%'+ ? +'%'";
                        Comm.Parameters.Add("clinombre", OleDbType.VarChar).Value = txtNombre.Text;
                    }
                    OleDbDataAdapter DA = new OleDbDataAdapter(Comm);
                    DataSet          DS = new DataSet();
                    DA.Fill(DS);
                    LlenarTablaResultados(DS);
                }
            }
            catch (Exception Ex) {
                UI.Mensaje(Resources.Recursos.titSystem, "Ocurrió un error al procesar su petición: Error " + Ex.Registrar().ToString(), "", Page);
            }
        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (ValidateUser(txtUsuario.Text, txtContraseña.Text))
            {
                try
                {
                    using (CobranzasDataContext db = new CobranzasDataContext())
                    {
                        //if (txtUsuario.Text != ((WindowsIdentity)User.Identity).Name.Split('\\').Last()) { Sesion.Impersonando = true; }
                        Entidades.Operadores Op = db.Operadores.Single(x => x.Login == txtUsuario.Text);
                        if (!Op.Activo)
                        {
                            UI.Mensaje("Sistema de Cobranzas", "Usuario Inactivo, diríjase a su Supervisor", "", Page);
                            return;
                        }

                        //DataTable dt = new DataTable();
                        //IPHostEntry host;
                        //string localIP = "";
                        //host = Dns.GetHostEntry(Dns.GetHostName());
                        //foreach (IPAddress ip in host.AddressList)
                        //{
                        //    if (ip.AddressFamily.ToString() == "InterNetwork")
                        //    {
                        //        localIP = ip.ToString();
                        //    }
                        //}

                        //dt = Negocios.EstadoSesion(Op.idOperador, localIP);

                        //if (int.Parse((dt.Rows[0]).ItemArray[0].ToString()) == 0)
                        //{
                        //    UI.Mensaje("Sistema de Cobranzas", "Ya hay una sesion activa con este usuario", "", Page);
                        //    return;
                        //}



                        Sesion.Llenar(Op);

                        //if (!Sesion.Impersonando)
                        //{
                        //    Sesion.Actividad("LI");
                        //}
                    }
                    Response.Redirect("Gestion.aspx", true);
                }
                catch (Exception Ex)
                {
                    //Response.Write(Ex.Message);
                    //Ex.Registrar();
                    UI.Mensaje("Sistema de Cobranzas", "No se pudo iniciar sesión, usuario incorrecto o inexistente" + Ex.InnerException, "", Page);
                }
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
 protected void btnPosponer_Click(object sender, EventArgs e)
 {
     using (CobranzasDataContext db = new CobranzasDataContext())
     {
         int idAviso            = Convert.ToInt32(Request["idAviso"]);
         Entidades.Avisos Aviso = db.Avisos.Single(x => x.idAviso == idAviso);
         Aviso.FechaAviso = DateTime.Now.AddMinutes(10);
         try
         {
             db.SubmitChanges();
             ScriptManager.RegisterStartupScript(Page, typeof(Page), "ini", "window.parent.CerrarAviso();window.parent.Avisos_Actualizar();", true);
         }
         catch (Exception Ex)
         {
             UI.Mensaje("Avisos", Ex.Message, "", Page);
         }
     }
 }
 protected void btnCancelar_Click(object sender, EventArgs e)
 {
     if (txtComentario.Text.Trim() == "")
     {
         UI.Mensaje("Avisos", "Debe especificar un comentario para cancelar el Aviso.", "", Page);
         return;
     }
     using (CobranzasDataContext db = new CobranzasDataContext())
     {
         int idAviso            = Convert.ToInt32(Request["idAviso"]);
         Entidades.Avisos Aviso = db.Avisos.Single(x => x.idAviso == idAviso);
         Aviso.FechaCancelado = DateTime.Now;
         Aviso.Comentario     = txtComentario.Text;
         try
         {
             db.SubmitChanges();
             ScriptManager.RegisterStartupScript(Page, typeof(Page), "ini", "window.parent.CerrarAviso();window.parent.Avisos_Actualizar();", true);
         }
         catch (Exception Ex)
         {
             UI.Mensaje("Avisos", Ex.Message, "", Page);
         }
     }
 }
Esempio n. 6
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (ValidateUser(txtUsuario.Text, txtContraseña.Text))
            {
                try
                {
                    using (CobranzasDataContext db = new CobranzasDataContext())
                    {
                        //if (txtUsuario.Text != ((WindowsIdentity)User.Identity).Name.Split('\\').Last()) { Sesion.Impersonando = true; }
                        Entidades.Operadores Op = db.Operadores.Single(x => x.Login == txtUsuario.Text);
                        if (!Op.Activo)
                        {
                            UI.Mensaje("Sistema de Cobranzas", "Usuario Inactivo, diríjase a su Supervisor", "", Page);
                            return;
                        }

                        Sesion.Llenar(Op);
                        if (!Sesion.Impersonando)
                        {
                            Sesion.Actividad("LI");
                        }
                    }
                    Response.Redirect("Gestion.aspx", true);
                }
                catch (Exception Ex)
                {
                    //Response.Write(Ex.Message);
                    //Ex.Registrar();
                    UI.Mensaje("Sistema de Cobranzas", "No se pudo iniciar sesión, usuario incorrecto o inexistente", "", Page);
                }
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //SqlConnection Conn = new SqlConnection("Data Source=SERV005;User ID=sa;Password=avila;Initial Catalog=milleniumv2");
            //Conn.Open();
            //Conn.Close();

            //CentralIp.VoIpConexion Conn = new CentralIp.VoIpConexion("172.17.1.102");
            //Conn.Conectar();
            //CentralIp.Respuesta Resp;

            //Resp = Conn.Login("Mberroteran", ".m4n8bds0as7");
            //Resp = Conn.GetAgentStatus("Agent/4401");
            //Resp = Conn.LoginAgent("Agent/4401", "1234", "502");
            //Conn.LLamar("04241798184");
            //Resp = Conn.LogoutAgent("Agent/4401","1234");
            //Resp = Conn.Logout();
            //Conn.Desconectar();
            //Correos Correo = new Correos();
            //Correo.Asunto = "Hola!";
            //String Prueba = General.LeerValorPropiedad(Correo, "Asunto").ToString();

            if (!IsPostBack)
            {
                if (Request["RL"] == "1")
                {
                    ClientScript.RegisterStartupScript(typeof(PageAction), "Ini", "window.parent.CerrarEmergente();", true);
                }
                if (Request["salir"] == "1")
                {
                    try
                    {
                        if (!Sesion.Impersonando)
                        {
                            Sesion.Actividad("LO");
                        }
                        Session.Abandon();
                    }
                    catch (Exception Ex)
                    {
                        UI.Mensaje("Sistema de Cobranzas", "No se pudo cerrar la sesión", "", Page);
                    }
                    Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", ""));
                    //Response.StatusCode = 401;
                }
                try
                {
                    WindowsIdentity Mi_Iden = (WindowsIdentity)User.Identity;
                    txtUsuario.Text = Mi_Iden.Name.Split('\\')[1];
                    try
                    {
                        using (CobranzasDataContext db = new CobranzasDataContext())
                        {
                            txtUsuario.Enabled = db.Operadores.Single(x => x.Login == txtUsuario.Text).Tipo.IndexOf("AD") != -1;
                        }
                    }
                    catch
                    {
                        txtUsuario.Enabled = txtUsuario.Text == "mberroteran";
                    }
                }
                catch (Exception Ex)
                {
                    Ex.Registrar();
                }
            }
            //General.Mensaje("Prueba", "Prueba", "", Page);
            //Sesion.idOperador = 4;
            //Response.Write(Mi_Iden.AuthenticationType); Response.Write("<br/>");
            //Response.Write(Mi_Iden.Groups); Response.Write("<br/>");
            //Response.Write(Mi_Iden.ImpersonationLevel); Response.Write("<br/>");
            //Response.Write(Mi_Iden.IsAnonymous); Response.Write("<br/>");
            //Response.Write(Mi_Iden.IsAuthenticated); Response.Write("<br/>");
            //Response.Write(Mi_Iden.IsGuest); Response.Write("<br/>");
            //Response.Write(Mi_Iden.IsSystem); Response.Write("<br/>");
            //Response.Write(Mi_Iden.Name); Response.Write("<br/>");
            //Response.Write(Mi_Iden.Owner); Response.Write("<br/>");
            //Response.Write(Mi_Iden.Token); Response.Write("<br/>");
            //Response.Write(Mi_Iden.User); Response.Write("<br/>");

            //System.Collections.IList visibleTables = Global.DefaultModel.VisibleTables;
            //if (visibleTables.Count == 0)
            //{
            //    throw new InvalidOperationException("No hay tablas accesibles. Asegúrese de que hay al menos un modelo de datos registrado en Global.asax y de que está habilitada la técnica scaffolding, o bien implemente páginas personalizadas.");
            //}
            //Menu1.DataSource = visibleTables;
            //Menu1.DataBind();

            /*
             * <asp:GridView ID="Menu1" runat="server" AutoGenerateColumns="false"
             * CssClass="DDGridView" RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6">
             * <Columns>
             * <asp:TemplateField HeaderText="Nombre de la tabla" SortExpression="TableName">
             *  <ItemTemplate>
             *      <asp:DynamicHyperLink ID="HyperLink1" runat="server"><%# Eval("DisplayName") %></asp:DynamicHyperLink>
             *  </ItemTemplate>
             * </asp:TemplateField>
             * </Columns>
             * </asp:GridView>
             */
        }