Exemplo n.º 1
0
        private string cliente(HttpContext context)
        {
            string response = string.Empty;
            string option   = context.Request["opt"].ToString();
            string key      = string.Empty;

            switch (option)
            {
            case "getAll":
                response = JsonConvert.SerializeObject(CatalogCtrl.Cliente_GetAll());
                break;

            case "getCopyByOperation":
                int id_cliente   = 0;
                int id_operation = 0;
                int.TryParse(context.Request["id_cliente"], out id_cliente);
                int.TryParse(context.Request["id_operation"], out id_operation);

                response = JsonConvert.SerializeObject(CatalogCtrl.ClienteCopiaOperacionLst(id_operation, id_cliente));

                break;

            default:
                throw new Exception("La opción " + option + " no existe");
            }
            return(response);
        }
Exemplo n.º 2
0
        private void fillForm()
        {
            int Id = 0;

            int.TryParse(hfId.Value, out Id);

            try
            {
                Cliente oC = CatalogCtrl.Cliente_GetById(Id);

                txt_nombre.Text             = oC.Nombre;
                txt_rfc.Text                = oC.Rfc;
                txt_razon.Text              = oC.Razon;
                ddlCuentaTipo.SelectedValue = oC.Id_cuenta_tipo.ToString();

                //ddlDocumento.SelectedValue = "0";
                List <Cliente_documento> lstCDoc = CatalogCtrl.Cliente_DocumentoFillLstByCliente(oC.Id);
                foreach (ListItem itemDoc in chkbxlstDocumento.Items)
                {
                    itemDoc.Selected = lstCDoc.Exists(p => string.Compare(p.Id_documento.ToString(), itemDoc.Value) == 0);
                    Cliente_documento cteDocFind = lstCDoc.Find(p => string.Compare(p.Id_documento.ToString(), itemDoc.Value) == 0);
                    if (cteDocFind != null)
                    {
                        itemDoc.Selected = true;
                        ListItem litemPrincipal = new ListItem(itemDoc.Text, itemDoc.Value);
                        litemPrincipal.Selected = cteDocFind.Es_principal;
                        ddlDocPrincipal.Items.Add(litemPrincipal);
                    }
                }
                //if (lstCDoc.Count > 0)
                //{
                //    ddlDocumento.SelectedValue = lstCDoc.First().Id_documento.ToString();
                //}

                ddlGrupo.SelectedValue = oC.Id_cliente_grupo.ToString();

                List <Cliente_copia> lst = CatalogCtrl.ClienteCopiaOperacionLst(1, Id);
                foreach (Cliente_copia itemCC in lst)
                {
                    lstCCOp.Add(new Cliente_copia_operacion()
                    {
                        Id_cliente = Id, Id_operacion = 1, Id_cliente_copia = itemCC.Id
                    });
                }

                lst = CatalogCtrl.ClienteCopiaOperacionLst(2, Id);
                foreach (Cliente_copia itemCC in lst)
                {
                    lstCCOp.Add(new Cliente_copia_operacion()
                    {
                        Id_cliente = Id, Id_operacion = 2, Id_cliente_copia = itemCC.Id
                    });
                }

                fillCopies();
            }
            catch
            {
                throw;
            }
        }