protected void rgNoComercial_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                Response.Redirect("~/Security/frmCerrar.aspx");
            }

            try
            {
                if (e.CommandName == "Eliminar")
                {
                    decimal codigo        = Convert.ToDecimal(e.CommandArgument);
                    int     IdEmpresa     = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa;
                    int     CodigoUsuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario;

                    DocumentoWCFClient cliente = new DocumentoWCFClient();
                    cliente.EliminarDocumentoFamilia(IdEmpresa, CodigoUsuario, codigo);
                }
            }
            catch (Exception ex)
            {
                lblmensaje.Text = ex.Message;
            }
            finally
            {
                RefrescarDocumentos();
                RefrescarGrillas();
            }
        }
Exemplo n.º 2
0
        private void TipoDocumento_ComboBox()
        {
            DocumentoWCFClient    objDocumentoWCF;
            VBG00716Result        objDocumento;
            List <VBG00716Result> lstDocumentos;

            try
            {
                objDocumentoWCF = new DocumentoWCFClient();
                objDocumento    = new VBG00716Result();

                objDocumento.Nombre = "Todos";
                objDocumento.ID     = -1;
                lstDocumentos       = objDocumentoWCF.Documento_ListarDocVenta(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                               ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario).ToList();
                lstDocumentos.Insert(0, objDocumento);

                cboTipoDocumento.DataSource     = lstDocumentos;
                cboTipoDocumento.DataTextField  = "Nombre";
                cboTipoDocumento.DataValueField = "ID";
                cboTipoDocumento.DataBind();

                if (cboTipoDocumento.Items.Count > 0)
                {
                    cboTipoDocumento.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        private void Documento_ListarTipoCompra()
        {
            DocumentoWCFClient objDocumentoWCF;

            try {
                objDocumentoWCF             = new DocumentoWCFClient();
                cboTipoDocumento.DataSource = objDocumentoWCF.Documento_ListarDocCompra(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                        ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario);
                cboTipoDocumento.DataTextField  = "Nombre";
                cboTipoDocumento.DataValueField = "ID";
                cboTipoDocumento.DataBind();

                cboTipoDocumento.SelectedValue = "1";
            }
            catch (Exception ex) {
                throw ex;
            }
        }
        private void RefrescarDocumentos()
        {
            List <ListarDocumentosResult> Lista = new List <ListarDocumentosResult>();

            try {
                DocumentoWCFClient cliente = new DocumentoWCFClient();
                int IdEmpresa     = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa;
                int CodigoUsuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario;

                Lista = cliente.ListarDocumentos(IdEmpresa, CodigoUsuario).ToList();

                this.lstDocumentos.DataSource = Lista;
                this.DataBind();
            }
            catch (Exception ex) {
                throw ex;
            }
        }
        protected void btnNoComercial_Click(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                Response.Redirect("~/Security/frmCerrar.aspx");
            }

            try
            {
                if (lstDocumentos.CheckedItems.Count == 0)
                {
                    this.lblmensaje.Text = "No ha seleccionado ningun documento";
                    return;
                }
                else
                {
                    this.lblmensaje.Text = "";
                }

                DocumentoWCFClient cliente = new DocumentoWCFClient();

                int IdEmpresa     = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa;
                int CodigoUsuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario;

                //Recorrer la lista

                List <RadListBoxItem> seleccionado = this.lstDocumentos.CheckedItems.ToList();

                foreach (RadListBoxItem item in seleccionado)
                {
                    cliente.RegistrarDocumentoFamilia(IdEmpresa, CodigoUsuario, 0, Convert.ToInt32(item.Value));
                }

                //cliente.RegistrarDocumentoFamilia(IdEmpresa, CodigoUsuario, 0, 0);

                //this.lblmensaje.Text = "Enviado desde el servidor";
                RefrescarDocumentos();
                RefrescarGrillas();
            }
            catch (Exception ex)
            {
                this.lblmensaje.Text = ex.Message;
            }
        }
Exemplo n.º 6
0
        public static AutoCompleteBoxData Documento_ListarTipoCompra(object context)
        {
            AutoCompleteBoxData res = new AutoCompleteBoxData();
            string searchString     = ((Dictionary <string, object>)context)["Text"].ToString();

            if (searchString.Length > 2)
            {
                DocumentoWCFClient objDocumentoWCF       = new DocumentoWCFClient();
                gsDocumento_ListarTipoCompraResult[] lst = objDocumentoWCF.Documento_ListarDocCompra(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                                                                                                     ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, searchString);
                List <AutoCompleteBoxItemData> result = new List <AutoCompleteBoxItemData>();

                foreach (gsDocumento_ListarTipoCompraResult agenda in lst)
                {
                    AutoCompleteBoxItemData childNode = new AutoCompleteBoxItemData();
                    childNode.Text  = agenda.ID.ToString() + "-" + agenda.Nombre;
                    childNode.Value = agenda.ID.ToString();
                    result.Add(childNode);
                }
                res.Items = result.ToArray();
            }
            return(res);
        }
        private void RefrescarGrillas()
        {
            List <ListarDocumentosFamiliaResult> Lista    = new List <ListarDocumentosFamiliaResult>();
            List <ListarDocumentosFamiliaResult> ListaNoC = new List <ListarDocumentosFamiliaResult>();

            try {
                DocumentoWCFClient cliente = new DocumentoWCFClient();
                int IdEmpresa     = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa;
                int CodigoUsuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario;

                Lista    = cliente.ListarDocumentosFamilia(IdEmpresa, CodigoUsuario, 1).ToList();
                ListaNoC = cliente.ListarDocumentosFamilia(IdEmpresa, CodigoUsuario, 0).ToList();

                this.rgComercial.DataSource = Lista;
                this.rgComercial.DataBind();

                this.rgNoComercial.DataSource = ListaNoC;
                this.rgNoComercial.DataBind();
            }
            catch (Exception ex) {
                throw ex;
            }
        }