/// <summary>
        /// Forma para actualizacion de promotor
        /// </summary>
        /// <param name="co"></param>
        /// <param name="noDoc"></param>
        /// <param name="idPers"></param>
        protected void formUpdateProm(string co, string noDoc, decimal idPers)
        {
            DataTable dtPerson;
            string    showDivs = "$('#fsBasicData').show();$('#fsTypePerson').show();$('#fsUbi').show();$('#fsInfoCust').show();";

            try
            {
                dtPerson = Basic_Data.getPersonCoorProm(noDoc, idPers).Tables[0];
            }
            catch
            {
                msnMessage.LoadMessage("Ha ocurrido un error intentando relaizar la búsqueda.", UserControl.ucMessage.MessageType.Error);
                return;
            }

            if (dtPerson != null && dtPerson.Rows.Count > 0)
            {
                DataRow infoPerson = dtPerson.Rows[0];
                printInfo(infoPerson);
                // Promotor
                string stProm = infoPerson["bdv_status"].ToString();

                btUpdateProm.Visible = true;
                txtDoc.Enabled       = false;
                dwArea.Enabled       = false;
                dwWare.Enabled       = false;
                dwWare.Visible       = false;
                //showDivs += "$('#fsInfoCust').hide();";
                msnMessage.LoadMessage("Puede realizar una actualización de la información.", UserControl.ucMessage.MessageType.Information);
            }
            else
            {
                Utilities.logout(Page.Session, Page.Response);
            }
            System.Web.UI.ScriptManager.RegisterStartupScript(upPanelMsg, Page.GetType(), "ShowDivs", showDivs, true);
        }
Exemplo n.º 2
0
        private void buscar_documento(string doc, string _codigocaptcha)
        {
            try
            {
                btUpdateCust.Visible = false;
                btUpdateProm.Visible = false;
                //btSaveNewCust.Visible = true;
                dwCustType.SelectedValue = "02";

                btSaveNewCust.Visible = false;
                btSaveNewProm.Visible = false;

                lblnombreruc.Text = "";
                //lbldireccionruc.Text = "";
                msnMessage.Visible = false;
                string ocultar_datasunat = "$('#fsSunat').hide();";
                ocultar_datasunat += "$('#fsBasicData').hide();$('#fsTypePerson').hide();$('#fsUbi').hide();";
                ocultar_datasunat += "$('#fsInfoCust').hide();";
                System.Web.UI.ScriptManager.RegisterStartupScript(upPanelMsg, Page.GetType(), "HideDivs", ocultar_datasunat, true);

                if (doc.Length != 8 && doc.Length != 11)
                {
                    //btSaveNewCust.Visible = false;
                    msnMessage.LoadMessage("El Numero de Documento es incorrecto. por favor verifique", UserControl.ucMessage.MessageType.Error);
                    txtDoc.Focus();

                    return;
                }


                //if (_codigocaptcha.Length == 0 && doc.Length==8)
                //{
                //    //btSaveNewCust.Visible = false;
                //    msnMessage.LoadMessage("Ingrese el codigo Captcha", UserControl.ucMessage.MessageType.Error);
                //    txtimagen.Focus();
                //    return;
                //}

                DataTable dtPerson;
                try
                {
                    dtPerson = Basic_Data.getPersonCoorProm(txtDoc.Text, 0).Tables[0];
                }
                catch
                {
                    msnMessage.LoadMessage("Ha ocurrido un error intentando relaizar la búsqueda.", UserControl.ucMessage.MessageType.Error);
                    return;
                }

                if (dtPerson != null && dtPerson.Rows.Count > 0)
                {
                    string _nombre_existe = dtPerson.Rows[0]["Bas_Primer_Nombre"].ToString() + " " +
                                            dtPerson.Rows[0]["bas_segundo_nombre"].ToString() + " " +
                                            dtPerson.Rows[0]["Bas_Primer_Apellido"].ToString() + " " +
                                            dtPerson.Rows[0]["Bas_Segundo_Apellido"].ToString();
                    msnMessage.LoadMessage("El Cliente " + _nombre_existe + " .Ya existe en nuestra base de datos con dni nro. " + txtDoc.Text, UserControl.ucMessage.MessageType.Information);
                    return;
                }

                //Consultar_Documento myRucDni = new Consultar_Documento((doc.Length == 8) ? Microsoft.VisualBasic.Strings.Trim("10" + doc + Consultar_Documento.getDigito("10" + doc).ToString()) : doc);

                //if (string.IsNullOrEmpty(myRucDni.Error))
                //{
                //    string showDivs = "$('#fsSunat').show();";

                //    lblnombreruc.Text = Consultar_Documento.Convert_MayusMin(myRucDni.GetInfo.RazonSocial);
                //    //lbldireccionruc.Text = Consultar_Documento.Convert_MayusMin(myRucDni.GetInfo.Direccion);
                //    System.Web.UI.ScriptManager.RegisterStartupScript(upPanelMsg, Page.GetType(), "ShowDivs", showDivs, true);
                //}

                //else
                //{
                //Persona info_captcha = Session["Captcha"];
                cargarAreaLiderZonal();
                cleanInfo("4");
                btUpdateCust.Visible  = false;
                btUpdateProm.Visible  = false;
                btSaveNewCust.Visible = false;
                btSaveNewProm.Visible = true;
                Persona myInfo = new Persona(); //(Persona)HttpContext.Current.Session["Captcha"];

                if (doc.Length == 8)
                {
                    myInfo.GetInfo(txtDoc.Text, "");
                }
                else
                {
                    myInfo.GetInfo(txtDoc.Text);
                }
                HttpContext.Current.Session["Captcha"] = myInfo;
                CaptionResul();

                //CargarImagen();
                //}
            }
            catch
            {
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Prepara formulario segun la accion
        /// </summary>
        /// <param name="co"></param>
        /// <param name="noDoc"></param>
        /// <param name="idPers"></param>
        protected void prepareForm(string noDoc, decimal idPers)
        {
            string ocultar_datasunat = "$('#fsSunat').hide();";

            System.Web.UI.ScriptManager.RegisterStartupScript(upPanelMsg, Page.GetType(), "HideDivs", ocultar_datasunat, true);

            if (noDoc.Length != 8 && noDoc.Length != 11)
            {
                msnMessage.LoadMessage("El Numero de Documento es incorrecto. por favor verifique", UserControl.ucMessage.MessageType.Error);
                return;
            }

            DataTable dtPerson;

            string showDivs = "$('#fsBasicData').show();$('#fsTypePerson').show();$('#fsUbi').show();$('#fsInfoCust').show();";

            try
            {
                dtPerson = Basic_Data.getPersonCoorProm(noDoc, idPers).Tables[0];
            }
            catch
            {
                msnMessage.LoadMessage("Ha ocurrido un error intentando relaizar la búsqueda.", UserControl.ucMessage.MessageType.Error);
                return;
            }

            if (dtPerson != null && dtPerson.Rows.Count > 0)
            {
                DataRow infoPerson = dtPerson.Rows[0];
                Boolean valor      = false;
                if (infoPerson["dis_dep_id"] != null && !string.IsNullOrEmpty(infoPerson["dis_dep_id"].ToString()))
                {
                    valor = true;
                }

                cleanInfo(_formCreCust, valor);
                printInfo(infoPerson);
                // Cliente
                string idCliente = infoPerson["bas_id"].ToString();

                if (!string.IsNullOrEmpty(idCliente))
                {
                    Users cust = new Users {
                        _usn_userid = Convert.ToDecimal(idCliente)
                    };
                    Session[_nameSessionCoord] = cust;
                    btUpdateCust.Visible       = true;
                    btSaveNewCust.Visible      = false;
                    showDivs += "$('#fsInfoCust').show();";
                }
                msnMessage.LoadMessage("Puede realizar una actualización de la información.", UserControl.ucMessage.MessageType.Information);
            }
            else
            {
                showDivs += "$('#fsInfoCust').show();";
                msnMessage.LoadMessage("Número de documento disponible.", UserControl.ucMessage.MessageType.Information);
                cleanInfo("4");
                btUpdateCust.Visible     = false;
                btUpdateProm.Visible     = false;
                btSaveNewCust.Visible    = true;
                dwCustType.SelectedValue = "02";


                Boolean validadni = false;
                if (noDoc.Length == 8)
                {
                    dwDocType.SelectedValue = "1";
                    validadni = true;
                }
                else
                {
                    dwDocType.SelectedValue = "2";
                }

                //verificando dni existe en la web service sunat

                Consultar_Documento myRucDni = new Consultar_Documento((noDoc.Length == 8) ? Microsoft.VisualBasic.Strings.Trim("10" + noDoc + Consultar_Documento.getDigito("10" + noDoc).ToString()) : noDoc);

                if (string.IsNullOrEmpty(myRucDni.Error) && myRucDni.Error != null)
                {
                    showDivs = "$('#fsBasicData').show();$('#fsTypePerson').show();$('#fsUbi').show();$('#fsSunat').show();$('#fsInfoCust').show();";
                    if (validadni)
                    {
                        string _primer_nombre = ""; string _segundo_nombre = ""; string _primer_apellido = ""; string _segundo_apellido = "";
                        Consultar_Documento.divide_nombres(myRucDni.GetInfo.RazonSocial, ref _primer_nombre, ref _segundo_nombre, ref _primer_apellido, ref _segundo_apellido);
                        txtFirstName.Text     = Consultar_Documento.Convert_MayusMin(_primer_nombre);
                        txtMiddleName.Text    = Consultar_Documento.Convert_MayusMin(_segundo_nombre);
                        txtFirstSurname.Text  = Consultar_Documento.Convert_MayusMin(_primer_apellido);
                        txtSecondSurname.Text = Consultar_Documento.Convert_MayusMin(_segundo_apellido);
                    }
                    else
                    {
                        this.txtFirstName.Text = myRucDni.GetInfo.RazonSocial;
                    }
                    lblnombreruc.Text = Consultar_Documento.Convert_MayusMin(myRucDni.GetInfo.RazonSocial);
                    //lbldireccionruc.Text = Consultar_Documento.Convert_MayusMin(myRucDni.GetInfo.Direccion);
                    this.txtPhone.Text   = myRucDni.GetInfo.Telefono;
                    this.txtAddress.Text = Consultar_Documento.Convert_MayusMin(myRucDni.GetInfo.Direccion);
                    this.txtBirth.Text   = myRucDni.GetInfo.Fecha_Nac;
                }
                //**************************************************

                //cargar dwArea
            }

            System.Web.UI.ScriptManager.RegisterStartupScript(upPanelMsg, Page.GetType(), "ShowDivs", showDivs, true);
        }