示例#1
0
        private void btnOmitir_Click(object sender, RoutedEventArgs e)
        {
            Paciente pa      = new Paciente(bandera_offline_online);
            bool     inserto = pa.insertarPaciente(this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.paciente.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica, alias);

            if (inserto)
            {
                //pa = new Paciente(!bandera_offline_online);
                // pa.insertarPaciente(this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.paciente.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica);
                Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault();
                Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
                Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();
                if (admin != null)
                {
                    admin.Main.Content = new Page6(alias);
                    //System.Windows.Forms.MessageBox.Show("Se Ingreso  el Paciente", "Se Ingreso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                if (recep != null)
                {
                    recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias);
                    //System.Windows.Forms.MessageBox.Show("Se Ingreso  el Paciente", "Se Ingreso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                if (socio != null)
                {
                    socio.Main4.Content = new Pacientes_socio(this.lista, this.alias);
                    //System.Windows.Forms.MessageBox.Show("Se Ingreso  el Paciente", "Se Ingreso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                // System.Windows.Forms.MessageBox.Show("No se pudo  Ingresar el Paciente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#2
0
        internal static string ToIconValue(this object icon)
        {
            if (icon.IsUsed())
            {
                var value = Convert.ToInt32(icon);

                if (icon.GetType() == typeof(FlatIcon))
                {
                    return(Flat.Get((FlatIcon)value));
                }
                else if (icon.GetType() == typeof(Flat2Icon))
                {
                    return(Flat2.Get((Flat2Icon)value));
                }
                else if (icon.GetType() == typeof(FontawesomeIcon))
                {
                    return(Fontawesome.Get((FontawesomeIcon)value));
                }
                else if (icon.GetType() == typeof(LineawesomeIcon))
                {
                    return(Lineawesome.Get((LineawesomeIcon)value));
                }
                else if (icon.GetType() == typeof(SocIcon))
                {
                    return(Soc.Get((SocIcon)value));
                }
                else if (icon.GetType() == typeof(SvgIcon))
                {
                    return(Svg.Get((SvgIcon)value));
                }
            }

            return("");
        }
示例#3
0
        private void btnFinalizar_Click(object sender, RoutedEventArgs e)
        {
            string descripcion = txtAntecedentes.Text;

            paciente.antecedente = descripcion;
            Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();
            Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault();
            Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();

            if (admin != null)
            {
                admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden;
                admin.Main.Content = new Page8_IngresarFoto(paciente, this.lista, this.alias);
            }
            else
            if (recep != null)
            {
                recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden;
                recep.Main3.Content = new Page8_IngresarFoto(paciente, this.lista, this.alias);
            }
            else
            if (socio != null)
            {
                socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden;
                socio.Main4.Content = new Page8_IngresarFoto(paciente, this.lista, this.alias);
            }
        }
示例#4
0
        private void ListViewItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            Nota_de_digi_evolucionModel nota = (Nota_de_digi_evolucionModel)lvNotas.SelectedItem;

            if (lvNotas.SelectedItems.Count > 0)
            {
                Carpeta_archivosModel carpeta = new Carpeta_archivosModel();
                carpeta.id_carpeta     = nota.carpeta.id_carpeta;
                carpeta.nombre_carpeta = nota.carpeta.nombre_carpeta;
                carpeta.id_paciente    = nota.id_paciente;
                carpeta.id_motivo      = nota.id_motivo;
                carpeta.id_nota        = nota.id_nota;

                Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();
                Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
                Clin  clin  = System.Windows.Application.Current.Windows.OfType <Clin>().FirstOrDefault();

                if (admin != null)
                {
                    admin.Main.Content = new Fotos_de_Estudios(carpeta, alias);
                }
                else
                if (clin != null)
                {
                    clin.Main2.Content = new Fotos_de_Estudios(carpeta, alias);
                }
                else
                if (socio != null)
                {
                    socio.Main4.Content = new Fotos_de_Estudios(carpeta, alias);
                }
            }
        }
示例#5
0
文件: SocStream.cs 项目: mtaneda/MACS
        private bool flush(int timeout)
        {
            int len = 0;

            while ((len < writeIndex) && ((timeout < 0) || (timer.ElapsedMilliseconds < timeout)))
            {
                int t = -1;
                if (timeout >= 0)
                {
                    t = timeout - (int)timer.ElapsedMilliseconds;
                    if (t < 0)
                    {
                        t = 0;
                    }
                }
                if (Soc.Poll(t * 1000, SelectMode.SelectWrite))
                {
                    int l = Soc.Send(writeBuf, len, writeIndex - len, SocketFlags.None);
                    if (l <= 0)
                    {
                        throw new SocketException(SocError.NO_RECOVERY);
                    }
                    len += l;
                }
            }
            writeIndex -= len;
            if (writeIndex < 0)
            {
                writeIndex = 0; // Fail safe.
            }
            return(writeIndex == 0);
        }
示例#6
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Motivo_citaModel motivo = (Motivo_citaModel)lvMotivo.SelectedItem;

            if (lvMotivo.SelectedItems.Count > 0)
            {
                //System.Windows.MessageBox.Show("id_paciente :" + motivo.paciente.id_paciente.ToString() + "   " + "id_motivo   " + motivo.id_motivo.ToString());

                Soc socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();

                Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
                Clin  clin  = System.Windows.Application.Current.Windows.OfType <Clin>().FirstOrDefault();
                //Recep recep = System.Windows.Application.Current.Windows.OfType<Recep>().FirstOrDefault();
                if (admin != null)
                {
                    admin.Main.Content = new Page2_notas(paciente, motivo, nombre_doctor, alias);
                }

                else
                if (clin != null)
                {
                    clin.Main2.Content = new Page2_notas(paciente, motivo, nombre_doctor, alias);
                }
                else
                if (socio != null)
                {
                    socio.Main4.Content = new Page2_notas(paciente, motivo, nombre_doctor, alias);
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("No selecciono ningun registro", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#7
0
        private void lvCarpetas_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            Carpeta_archivosModel carpeta = (Carpeta_archivosModel)lvCarpetas.SelectedItem;

            if (lvCarpetas.SelectedItems.Count > 0)

            {
                // System.Windows.MessageBox.Show(lvCarpetas.SelectedItems.Count + "");
                // System.Windows.MessageBox.Show(carpeta.id_carpeta + "");
                // System.Windows.MessageBox.Show(carpeta.id_paciente + "");
                //System.Windows.MessageBox.Show("hi");
                Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();
                Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
                Clin  clin  = System.Windows.Application.Current.Windows.OfType <Clin>().FirstOrDefault();


                if (admin != null)
                {
                    admin.Main.Content = new Fotos_de_Estudios(carpeta, alias);
                }
                else
                if (clin != null)
                {
                    clin.Main2.Content = new Fotos_de_Estudios(carpeta, alias);
                }
                else
                if (socio != null)
                {
                    socio.Main4.Content = new Fotos_de_Estudios(carpeta, alias);
                }
            }
        }
示例#8
0
 private void PWD_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         Soc.Focus();
     }
 }
示例#9
0
 public virtual void LoadXML(XmlElement ele)
 {
     Str.LoadXML(ele);
     Dex.LoadXML(ele);
     End.LoadXML(ele);
     Int.LoadXML(ele);
     Edu.LoadXML(ele);
     Soc.LoadXML(ele);
 }
示例#10
0
 public virtual void SaveXML(XmlElement ele)
 {
     Str.SaveXML(ele);
     Dex.SaveXML(ele);
     End.SaveXML(ele);
     Int.SaveXML(ele);
     Edu.SaveXML(ele);
     Soc.SaveXML(ele);
 }
示例#11
0
文件: SocStream.cs 项目: mtaneda/MACS
        /// <summary>
        ///   ソケットから複数バイトを読む
        /// </summary>
        /// <remarks>
        ///   <para>
        ///     ソケットの切断などのエラーが発生した場合は、SocketExceptionがthrow
        ///     される。
        ///   </para>
        /// </remarks>
        /// <param name="buf">読み取ったデータを格納する配列</param>
        /// <param name="offset">読み取ったデータを格納する先頭位置</param>
        /// <param name="size">読み取りバイト数</param>
        /// <param name="timeout">最大待ち時間(ミリ秒)</param>
        /// <returns>読みとったバイト数。sizeと等しくない場合はタイムアウトが発生した。</returns>
        public int Read(byte[] buf, int offset, int size, int timeout)
        {
            if (Soc == null)
            {
                throw new SocketException(SocError.ENOTCONN);
            }
            if (timeout == 0)
            {
                // すぐに読める分だけ読む
                int sz = Soc.Available;
                if (size < sz)
                {
                    sz = size;
                }
                if (sz > 0)
                {
                    return(Soc.Receive(buf, offset, sz, SocketFlags.None));
                }
                else
                {
                    return(0);
                }
            }
            timer.Reset();
            timer.Start();
            int len = 0;

            while ((len < size) && ((timeout < 0) || (timer.ElapsedMilliseconds < timeout)))
            {
                int t = -1;
                if (timeout >= 0)
                {
                    t = timeout - (int)timer.ElapsedMilliseconds;
                    if (t < 0)
                    {
                        t = 0;
                    }
                }
                if (Soc.Poll(t * 1000, SelectMode.SelectRead))
                {
                    int sz = Soc.Available;
                    if (size - len < sz)
                    {
                        sz = size - len;
                    }
                    int l = Soc.Receive(buf, offset + len, sz, SocketFlags.None);
                    if (l <= 0)
                    {
                        throw new SocketException(SocError.NO_DATA);
                    }
                    len += l;
                }
            }
            timer.Stop();
            return(len);
        }
示例#12
0
        public Soc get_beneficiario(string dni) // busco un socio beneficiario desde un DNI
        {
            var c = from a in db_sindicato.maeflia
                    where a.MAEFLIA_NRODOC == Convert.ToDouble(dni)
                    select new
            {
                codfliar = a.MAEFLIA_CODFLIAR,
                nrodni   = a.MAEFLIA_NRODOC,
                nombre   = a.MAEFLIA_NOMBRE.Trim() + " " + a.MAEFLIA_APELLIDO.Trim(),
                sexo     = a.MAEFLIA_SEXO,
            };

            if (c.Count() > 0)
            {
                cod = c.Max(x => x.codfliar);
                var sss = from a in c
                          where a.codfliar == cod
                          select a;
                dat_soc.dni    = sss.Single().nrodni.ToString();
                dat_soc.nombre = sss.Single().nombre;
                dat_soc.sexo   = sss.First().sexo;

                var cuil = from a in db_sindicato.socflia where a.SOCFLIA_CODFLIAR == sss.Single().codfliar select a;

                var nrosoc = (from a in db_sindicato.maesoc
                              where a.MAESOC_CUIL == cuil.First().SOCFLIA_CUIL
                              select a).First().MAESOC_NROAFIL;
                dat_soc.nrosocio = nrosoc.ToString();

                var e = from a in db_sindicato.socflia
                        where a.SOCFLIA_CODFLIAR == cod
                        select new { estado = a.SOCFLIA_ESTADO };
                if (e.Count() > 0)
                {
                    estado = e.Single().estado;
                }
                var f = from a in db_sindicato.fotos where a.FOTOS_CODFLIAR == cod select new { foto = a.FOTOS_FOTO };
                if (f.Count() > 0)
                {
                    foto = f.First().foto;
                }
                else
                {
                    foto = null;
                }
                dat_soc.cuil   = "0";
                dat_soc.foto   = foto;
                dat_soc.estado = Convert.ToByte(estado);
            }
            else
            {
                dat_soc = null;
            }
            return(dat_soc);
        }
示例#13
0
        /// <summary>
        ///   クライアントからの接続を待ち、通信用ソケットを新たに作成する。
        /// </summary>
        /// <remarks>
        ///   <para>
        ///     タイムアウト以外の接続失敗が発生すると、SocketExceptionが発生する。
        ///   </para>
        /// </remarks>
        /// <param name="timeout">最大待ち時間(ミリ秒)負の値を指定すると無限に待つ。</param>
        /// <param name="crtfile">サーバ認証CRTファイル名。nullの場合SSL接続せずに単純なTCPソケット接続を行なう。</param>
        /// <returns>新たな通信用ソケット。タイムアウト時はnull</returns>
        public SocStream Accept(int timeout = -1, string crtfile = null)
        {
            if (Soc == null)
            {
                throw new SocketException(SocError.ENOTCONN);
            }
            if (!Soc.Poll(timeout * 1000, SelectMode.SelectRead))
            {
                return(null);
            }
            Socket s = Soc.Accept();

            return(new SocStream(s, crtfile));
        }
示例#14
0
        private void btnFinalizar_Click(object sender, RoutedEventArgs e)
        {
            // MessageBox.Show("la foto es :" + paciente.foto);

            PacienteModel paciente_nuevo = new PacienteModel();
            ClinicaModel  clinica        = new ClinicaModel();

            paciente_nuevo.id_paciente = this.paciente.id_paciente;
            paciente_nuevo.nombre      = this.paciente.nombre;
            paciente_nuevo.apellidos   = this.paciente.apellidos;
            paciente_nuevo.direccion   = this.paciente.direccion;
            paciente_nuevo.telefono    = this.paciente.telefono;
            paciente_nuevo.foto        = this.paciente.foto;
            paciente_nuevo.imagen      = null;
            paciente_nuevo.antecedente = txtAntecedentes.Text;
            paciente_nuevo.email       = this.paciente.email;
            paciente_nuevo.marketing   = this.paciente.marketing;
            clinica.id_clinica         = this.paciente.clinica.id_clinica;
            clinica.nombre_sucursal    = this.paciente.clinica.nombre_sucursal;
            clinica.color          = this.paciente.clinica.color;
            paciente_nuevo.clinica = clinica;
            this.foto = this.paciente.foto;
            Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault();
            Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();
            Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();

            if (admin != null)
            {
                admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden;
                admin.Main.Content = new Page8_ActualizarFoto(paciente_nuevo, null, alias);
            }
            else
            if (recep != null)
            {
                recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden;
                recep.Main3.Content = new Page8_ActualizarFoto(paciente_nuevo, null, alias);
            }
            else
            if (socio != null)
            {
                socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden;

                socio.Main4.Content = new Page8_ActualizarFoto(paciente_nuevo, this.lista, this.alias);
            }
        }
示例#15
0
文件: SocStream.cs 项目: mtaneda/MACS
 /// <summary>
 ///   ソケットから1バイト読む
 /// </summary>
 /// <remarks>
 ///   <para>
 ///     ソケットの切断などのエラーが発生した場合は、SocketExceptionがthrow
 ///     される。
 ///   </para>
 /// </remarks>
 /// <param name="res">読み取ったデータを格納する変数</param>
 /// <param name="timeout">タイムアウト時間(ミリ秒)</param>
 /// <returns>true=読み取り成功, false=タイムアウト</returns>
 public bool ReadOne(out byte res, int timeout)
 {
     if (Soc == null)
     {
         throw new SocketException(SocError.ENOTCONN);
     }
     if (!Soc.Poll(timeout * 1000, SelectMode.SelectRead))
     {
         res = 0;
         return(false);
     }
     byte[] buf = new byte[1];
     if (Soc.Receive(buf, 0, 1, SocketFlags.None) != 1)
     {
         throw new SocketException(SocError.NO_DATA);
     }
     res = buf[0];
     return(true);
 }
示例#16
0
文件: SocStream.cs 项目: mtaneda/MACS
 /// <summary>
 ///   接続を切る
 /// </summary>
 /// <remarks>
 ///   <para>
 ///     すでに切断されている場合は何もしない。
 ///   </para>
 /// </remarks>
 public override void Close()
 {
     if (writeBuf != null)
     {
         try {
             if (writeIndex > 0)
             {
                 flush(WriteTimeout);
             }
         } catch (Exception) {
             // just ignore.
         }
         writeBuf = null;
     }
     if (Soc != null)
     {
         Soc.Close();
         init();
     }
 }
示例#17
0
        private void button1_Click(object sender, EventArgs e)
        {
            ColorDialog MyDialog = new ColorDialog();

            if (MyDialog.ShowDialog() == DialogResult.OK)
            {
            }
            System.Drawing.Color color = MyDialog.Color;

            System.Windows.Media.Color mediaColor = System.Windows.Media.Color.FromRgb(color.R, color.G, color.B);

            Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
            Clin  clin  = System.Windows.Application.Current.Windows.OfType <Clin>().FirstOrDefault();
            Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault();
            Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();

            if (admin != null)
            {
                admin.paleta_colores.Background = new SolidColorBrush(mediaColor);
            }
            else
            if (clin != null)
            {
                clin.paleta_colores.Background = new SolidColorBrush(mediaColor);
                this.Hide();
            }
            else
            if (recep != null)
            {
                recep.paleta_colores.Background = new SolidColorBrush(mediaColor);
                this.Hide();
            }
            else
            if (socio != null)
            {
                socio.paleta_colores.Background = new SolidColorBrush(mediaColor);
                this.Hide();
            }
        }
示例#18
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            Soc socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();

            Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
            Clin  clin  = System.Windows.Application.Current.Windows.OfType <Clin>().FirstOrDefault();

            if (admin != null)
            {
                admin.Main.Content = new Page2_Abonos(paciente, motivo, alias);
            }
            else
            if (clin != null)
            {
                clin.Main2.Content = new Page2_Abonos(paciente, motivo, alias);
            }
            else
            if (socio != null)
            {
                socio.Main4.Content = new Page2_Abonos(paciente, motivo, alias);
            }
        }
示例#19
0
        private void btn_Omitir_Click(object sender, RoutedEventArgs e)
        {
            if (MiWebCam != null && MiWebCam.IsRunning)
            {
                CerrarWebCam();
            }
            Servicios.Paciente paciente = new Servicios.Paciente(bandera_offline_online);
            bool inserto = paciente.insertarPaciente(this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, "", this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica, alias);

            if (inserto)
            {
                //paciente = new Servicios.Paciente(!bandera_offline_online);
                //bool inserto_2 = paciente.insertarPaciente(this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, "", this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica);

                Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();
                Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault();
                Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
                if (admin != null)
                {
                    admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                    admin.Main.Content = new Page6(alias);
                }
                else
                if (recep != null)
                {
                    recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                    recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias);
                }
                else
                if (socio != null)
                {
                    socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                    socio.Main4.Content = new Pacientes_socio(this.lista, this.alias);
                }
            }
        }
示例#20
0
        private void Button_Click_5(object sender, RoutedEventArgs e)
        {
            Motivo_citaModel motivo = (Motivo_citaModel)lvMotivo.SelectedItem;

            if (lvMotivo.SelectedItems.Count > 0)
            {
                Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
                Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();

                if (admin != null)
                {
                    admin.Main.Content = new Pagina_Estudios(paciente, motivo, alias);
                }
                else
                if (socio != null)
                {
                    socio.Main4.Content = new Pagina_Estudios(paciente, motivo, alias);
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("No seleccionó ningún registro", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#21
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            string id_membresia = "";

            if (!txtPrecio.Text.Equals("") && !txt_efectivo.Text.Equals(""))
            {
                if (new Seguridad().validar_numero(txtPrecio.Text) && new Seguridad().validar_numero(txt_efectivo.Text))
                {
                    double abono    = Convert.ToDouble(txtPrecio.Text, culture);
                    double efectivo = Convert.ToDouble(txt_efectivo.Text, culture);
                    if (efectivo > 0)
                    {
                        try
                        {
                            //MessageBox.Show(paciente.nombre);
                            bool inserto = new Membresia(bandera_online_offline).InsertarMembresia(paciente.id_paciente, datetimepicker1.Value.ToString("yyyy/MM/dd"), paciente.clinica.id_clinica, abono.ToString(culture), alias);
                            if (inserto)
                            {
                                List <MembresiaModel> lista = new Membresia(bandera_online_offline).MostrarMembresias(paciente.id_paciente, paciente.clinica.id_clinica);
                                foreach (var membresia in lista)
                                {
                                    id_membresia = membresia.id_membresia;
                                }

                                bool inserto2 = new Abonos_Membresia(bandera_online_offline).InsertarAbonoMembresia(DateTime.Now.ToString("yyyy/MM/dd"), efectivo.ToString(culture), "Primer pago para tener la membresia", id_membresia, paciente.id_paciente, paciente.clinica.id_clinica, alias);
                                if (inserto2)
                                {
                                    //System.Windows.Forms.MessageBox.Show("El paciente " + paciente.nombre + " " + paciente.apellidos + " es ahora miembro", "Se ingreso correctamente", MessageBoxButtons.OK, MessageBoxIcon.Information);

                                    imprimir_recibo();

                                    Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();
                                    Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
                                    Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault();

                                    if (admin != null)
                                    {
                                        //MessageBox.Show(abono.ToString());
                                        admin.Main.Content = new Abonos_Mem(paciente, id_membresia, abono, alias);
                                    }
                                    else
                                    if (recep != null)
                                    {
                                        recep.Main3.Content = new Abonos_Mem(paciente, id_membresia, abono, alias);
                                    }
                                    else
                                    if (socio != null)
                                    {
                                        socio.Main4.Content = new Abonos_Mem(paciente, id_membresia, abono, alias);
                                    }
                                }


                                // -----------------------------------------------/
                                //inserto = new Paciente(!bandera_online_offline).actualizarMembresia(paciente);
                            }
                            else
                            {
                                // System.Windows.Forms.MessageBox.Show("No se pudo  Ingresar la membresia", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        catch (Exception ex)
                        {
                            System.Windows.Forms.MessageBox.Show("Se ha producido un error ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            this.DialogResult = DialogResult.OK;
                        }
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        System.Windows.Forms.MessageBox.Show("Abono mayor que efectivo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Cantidad no valida", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("LLene todos los campos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#22
0
 public override string SocialUPP()
 {
     return(string.Format("{0}{1}{2}-{3}", Int.ToString(), Edu.ToString(), Soc.ToString(), Psi.ToString()));
 }
示例#23
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string identificador = new Seguridad().SHA1(DateTime.Now + "");
            string foto          = this.paciente.nombre + "_" + this.paciente.apellidos + "_" + identificador + ".jpg";

            foto = foto.Replace(" ", "_");


            if (MiWebCam != null && MiWebCam.IsRunning)
            {
                /*CerrarWebCam();
                 * string filePath = ruta +foto;
                 * var encoder = new JpegBitmapEncoder();
                 * encoder.Frames.Add(BitmapFrame.Create((BitmapSource)img1.Source));
                 * using (FileStream stream = new FileStream(filePath, FileMode.Create))
                 *  encoder.Save(stream);*/
                System.Windows.Forms.MessageBox.Show("La camara sigue encendida no ha tomado la foto ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                string filePath = filePath = ruta + foto;



                var encoder = new JpegBitmapEncoder();
                encoder.Frames.Add(BitmapFrame.Create((BitmapSource)img1.Source));
                using (FileStream stream = new FileStream(filePath, FileMode.Create))
                    encoder.Save(stream);
            }

            Servicios.Paciente paciente = new Servicios.Paciente(bandera_offline_online);
            bool inserto = paciente.insertarPaciente(this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, foto, this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica, alias);

            if (inserto)
            {
                string destFile  = System.IO.Path.Combine(ruta_offline, foto);
                string destFile2 = System.IO.Path.Combine(@configuracion.carpetas.ruta_imagenes_carpeta + "\\", foto);
                System.IO.File.Copy(ruta + foto, destFile, true);
                System.IO.File.Copy(ruta + foto, destFile2, true);
                if (File.Exists(ruta + foto))
                {
                    File.Delete(ruta + foto);
                }
                //System.Windows.Forms.MessageBox.Show("Se subio correctamente la foto", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();
                Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault();
                Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
                if (admin != null)
                {
                    admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                    admin.Main.Content = new Page6(alias);
                }
                else
                if (recep != null)
                {
                    recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                    recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias);
                }
                else
                if (socio != null)
                {
                    socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                    socio.Main4.Content = new Pacientes_socio(this.lista, this.alias);
                }

                //paciente = new Servicios.Paciente(!bandera_offline_online);
                //bool inserto_2 = paciente.insertarPaciente(this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, foto, this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica);
                //if(inserto_2)
                //{
                //    System.Windows.Forms.MessageBox.Show("Tardaran unos minutos al subir la foto", "Espera", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                //    bool subir = SubirFicheroStockFTP(foto, @configuracion.carpetas.ruta_imagenes_carpeta + "\\");
                //    if (subir)
                //    {

                //        System.Windows.Forms.MessageBox.Show("Se subio correctamente la foto", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //        Soc socio = System.Windows.Application.Current.Windows.OfType<Soc>().FirstOrDefault();
                //        Recep recep = System.Windows.Application.Current.Windows.OfType<Recep>().FirstOrDefault();
                //        Admin admin = System.Windows.Application.Current.Windows.OfType<Admin>().FirstOrDefault();
                //        if (admin != null)
                //        {
                //            admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                //            admin.Main.Content = new Page6();
                //        }
                //        else
                //        if (recep != null)
                //        {
                //            recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                //            recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica);
                //        }
                //        else
                //        if (socio != null)
                //        {
                //            socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                //            socio.Main4.Content = new Pacientes_socio(this.lista,this.alias);
                //        }

                //    }
                //    else
                //    {
                //        System.Windows.Forms.MessageBox.Show("No se pudo subir la foto", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //        Soc socio = System.Windows.Application.Current.Windows.OfType<Soc>().FirstOrDefault();
                //        Recep recep = System.Windows.Application.Current.Windows.OfType<Recep>().FirstOrDefault();
                //        Admin admin = System.Windows.Application.Current.Windows.OfType<Admin>().FirstOrDefault();
                //        if (admin != null)
                //        {
                //            admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                //            admin.Main.Content = new Page6();
                //        }
                //        else
                //        if (recep != null)
                //        {
                //            recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                //            recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica);
                //        }
                //        else
                //        if (socio != null)
                //        {
                //            socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                //            socio.Main4.Content = new Pacientes_socio(this.lista, this.alias);
                //        }
                //    }
                //}
                //else
                //{
                //    Soc socio = System.Windows.Application.Current.Windows.OfType<Soc>().FirstOrDefault();
                //    Recep recep = System.Windows.Application.Current.Windows.OfType<Recep>().FirstOrDefault();
                //    Admin admin = System.Windows.Application.Current.Windows.OfType<Admin>().FirstOrDefault();
                //    if (admin != null)
                //    {
                //        admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                //        admin.Main.Content = new Page6();
                //    }
                //    else
                //    if (recep != null)
                //    {
                //        recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                //        recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica);
                //    }
                //    else
                //    if (socio != null)
                //    {
                //        socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                //        socio.Main4.Content = new Pacientes_socio(this.lista, this.alias);
                //    }
            }
            else
            {
                // System.Windows.Forms.MessageBox.Show("No se pudo registrar el paciente ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }


            //bool insertarPaciente = paciente.insertarPaciente(this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, foto, this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica);

            //if (insertarPaciente)
            //{
            //    System.Windows.Forms.MessageBox.Show("Se registro correctamente el Paciente", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    Test_Internet ti = new Test_Internet();
            //    if (ti.Test())
            //    {
            //        System.Windows.Forms.MessageBox.Show("Tardaran unos minutos al subir la foto", "Espera", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            //        bool subir = SubirFicheroStockFTP(foto, ruta);
            //        if (subir)
            //        {

            //            //bool descargo = downloadFile("ftp://jjdeveloperswdm.com/", "*****@*****.**", "bonita_smile", foto,
            //            //  @"\\DESKTOP-ED8E774\bs\" + foto, 10);
            //            string destFile = System.IO.Path.Combine(@"\\DESKTOP-ED8E774\bs\", foto);
            //            //MessageBox.Show("el valor de result es " + result);
            //            System.IO.File.Copy(ruta+foto, destFile, true);
            //            //File.Delete(ruta + foto);
            //            System.Windows.Forms.MessageBox.Show("Se subio correctamente la foto", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //
            //        }
            //        else
            //        {
            //            System.Windows.Forms.MessageBox.Show("No se pudo subir la foto", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //        }
            //    }

            //    else
            //    {
            //        System.Windows.Forms.MessageBox.Show("No se pudo subir la foto por el internet ", "Error por falta de internet", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //        string destFile = System.IO.Path.Combine(ruta_offline, foto);
            //        string destFile2 = System.IO.Path.Combine(@"\\DESKTOP-ED8E774\bs\", foto);
            //        //MessageBox.Show("el valor de result es " + result);
            //        System.IO.File.Copy(ruta + foto, destFile, true);
            //        System.IO.File.Copy(ruta + foto, destFile2, true);
            //        File.Delete(ruta + foto);
            //        System.Windows.Forms.MessageBox.Show("Se subira la foto cuando tengas internet y des click en sincronizar ", "Se guardara la foto", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //        Recep recep = System.Windows.Application.Current.Windows.OfType<Recep>().FirstOrDefault();
            //        Admin admin = System.Windows.Application.Current.Windows.OfType<Admin>().FirstOrDefault();
            //        if (admin != null)
            //        {
            //            admin.Main.Content = new Page6();
            //        }
            //        else
            //        if (recep != null)
            //        {
            //            recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica);
            //        }
            //    }
            //}
            //
        }
示例#24
0
 public override string SocialUPP()
 {
     return(Int.ToString() + Edu.ToString() + Soc.ToString() + Chr.ToString());
 }
示例#25
0
        //this.paciente.clinica.id_clinica-> esto va en recepcionista en la ventana wpf
        private void btnOmitir_Click(object sender, RoutedEventArgs e)
        {
            bool   eliminarArchivo     = true;
            string rutaArchivoEliminar = @"\\DESKTOP-ED8E774\backup_bs\eliminar_imagen_temporal.txt";


            Paciente pa             = new Paciente(bandera_online_offline);
            bool     email_correcto = new Seguridad().email_bien_escrito(this.paciente.email);

            if (email_correcto || this.paciente.email.Equals(""))
            {
                string viejo = this.nombre_viejo;
                string nuevo = this.paciente.nombre + "_" + this.paciente.apellidos;
                if (viejo.Equals(nuevo))
                {
                    if (this.foto.Equals(""))
                    {
                        bool inserto = pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica, alias);
                        if (inserto)
                        {
                            // System.Windows.Forms.MessageBox.Show("Se actualizo el Paciente", "Se Actualizo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            //    pa = new Paciente(!bandera_online_offline);
                            //pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica);
                            Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
                            Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault();
                            Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();
                            if (admin != null)
                            {
                                admin.Main.Content = new Page6(alias);
                            }
                            else
                            if (recep != null)
                            {
                                recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias);
                            }
                            else
                            if (socio != null)
                            {
                                socio.Main4.Content = new Pacientes_socio(this.lista, this.alias);
                            }
                        }
                    }
                    else
                    {
                        bool inserto = pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica, alias);
                        if (inserto)
                        {
                            //System.Windows.Forms.MessageBox.Show("Se actualizo el Paciente", "Se Actualizo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            //    pa = new Paciente(!bandera_online_offline);
                            //pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica);
                            Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
                            Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault();
                            Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();
                            if (admin != null)
                            {
                                admin.Main.Content = new Page6(alias);
                            }
                            else
                            if (recep != null)
                            {
                                recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias);
                            }
                            else
                            if (socio != null)
                            {
                                socio.Main4.Content = new Pacientes_socio(this.lista, this.alias);
                            }
                        }
                    }
                }
                else
                {
                    if (foto.Equals(""))
                    {
                        bool inserto = pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica, alias);
                        {
                            //System.Windows.Forms.MessageBox.Show("Se actualizo el Paciente", "Se Actualizo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            //    pa = new Paciente(!bandera_online_offline);
                            //pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, this.foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica);
                            Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
                            Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault();
                            Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();
                            if (admin != null)
                            {
                                admin.Main.Content = new Page6(alias);
                            }
                            else
                            if (recep != null)
                            {
                                recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias);
                            }
                            else
                            if (socio != null)
                            {
                                socio.Main4.Content = new Pacientes_socio(this.lista, this.alias);
                            }
                        }
                    }
                    else
                    {
                        Seguridad s = new Seguridad();
                        string    nombre_nuevo_foto = this.paciente.nombre + "_" + this.paciente.apellidos + "_" + this.paciente.id_paciente + ".jpg";
                        nombre_nuevo_foto = nombre_nuevo_foto.Replace(" ", "_");
                        nombre_nuevo_foto = s.quitar_acentos(nombre_nuevo_foto);
                        bool inserto = pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, nombre_nuevo_foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica, alias);
                        if (inserto)
                        {
                            renombrar(this.paciente.foto, nombre_nuevo_foto);
                            if (File.Exists(@configuracion.carpetas.ruta_subir_servidor_carpeta + "\\" + this.paciente.foto))
                            {
                                File.Delete(@configuracion.carpetas.ruta_subir_servidor_carpeta + "\\" + this.paciente.foto);
                            }
                            string destFile2 = System.IO.Path.Combine(@configuracion.carpetas.ruta_subir_servidor_carpeta + "\\", nombre_nuevo_foto);
                            System.IO.File.Copy(@configuracion.carpetas.ruta_imagenes_carpeta + "\\" + nombre_nuevo_foto, destFile2, true);
                            Escribir_Archivo ea = new Escribir_Archivo();
                            ea.escribir_imagen_eliminar(this.paciente.foto, @configuracion.carpetas.ruta_eliminar_carpeta + "\\eliminar_imagen_temporal_" + alias + ".txt");
                            // System.Windows.Forms.MessageBox.Show("Se actualizo el Paciente", "Se Actualizo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
                            Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault();
                            Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();
                            if (admin != null)
                            {
                                admin.Main.Content = new Page6(alias);
                            }
                            else
                            if (recep != null)
                            {
                                recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias);
                            }
                            else
                            if (socio != null)
                            {
                                socio.Main4.Content = new Pacientes_socio(this.lista, this.alias);
                            }
                            //pa = new Paciente(!bandera_online_offline);
                            //bool actualizo = pa.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, nombre_nuevo_foto, txtAntecedentes.Text, this.paciente.email, 0, this.paciente.clinica.id_clinica);
                            //    if (actualizo)
                            //        {
                            //            var datos = ea.leer(rutaArchivoEliminar);

                            //            foreach (string imagen in datos)
                            //            {
                            //                Uri siteUri = new Uri("ftp://jjdeveloperswdm.com/" + imagen);
                            //                bool verdad = DeleteFileOnServer(siteUri, "*****@*****.**", "bonita_smile");

                            //                if (!verdad)
                            //                    eliminarArchivo = false;
                            //            }

                            //            if (eliminarArchivo)
                            //            {
                            //                System.Windows.MessageBox.Show("elimino Archivo");
                            //                ea.SetFileReadAccess(rutaArchivoEliminar, false);
                            //                File.Delete(@"\\DESKTOP-ED8E774\backup_bs\eliminar_imagen_temporal.txt");
                            //                bool subir = SubirFicheroStockFTP(nombre_nuevo_foto, @"\\DESKTOP-ED8E774\bs\");
                            //        Admin admin = System.Windows.Application.Current.Windows.OfType<Admin>().FirstOrDefault();
                            //        Recep recep = System.Windows.Application.Current.Windows.OfType<Recep>().FirstOrDefault();
                            //        Soc socio = System.Windows.Application.Current.Windows.OfType<Soc>().FirstOrDefault();
                            //        if (admin != null)
                            //        {
                            //            admin.Main.Content = new Page6();
                            //        }
                            //        else
                            //    if (recep != null)
                            //        {
                            //            recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica);
                            //        }
                            //        else
                            //    if (socio != null)
                            //        {
                            //            socio.Main4.Content = new Pacientes_socio(this.lista, this.alias);
                            //        }

                            //    }
                            //}
                        }
                    }
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Correo no válido", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#26
0
 protected override string GetIcon() => Soc.Get(Name);
示例#27
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            bool      eliminarArchivo     = true;
            string    rutaArchivoEliminar = @configuracion.carpetas.ruta_respaldo_carpeta + "\\eliminar_imagen_temporal_" + alias + ".txt";
            Seguridad s    = new Seguridad();
            string    foto = this.paciente.nombre + "_" + this.paciente.apellidos + "_" + this.paciente.id_paciente + ".jpg";

            foto = foto.Replace(" ", "_");
            foto = s.quitar_acentos(foto);

            if (MiWebCam != null && MiWebCam.IsRunning)
            {
                /*CerrarWebCam();
                 * string filePath = ruta +foto;
                 * var encoder = new JpegBitmapEncoder();
                 * encoder.Frames.Add(BitmapFrame.Create((BitmapSource)img1.Source));
                 * using (FileStream stream = new FileStream(filePath, FileMode.Create))
                 *  encoder.Save(stream);*/
                System.Windows.Forms.MessageBox.Show("No apagó la cámara ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                string        filePath = "";
                Test_Internet test_i   = new Test_Internet();


                filePath = ruta2 + foto;

                var encoder = new JpegBitmapEncoder();
                encoder.Frames.Add(BitmapFrame.Create((BitmapSource)img1.Source));
                using (FileStream stream = new FileStream(filePath, FileMode.Create))
                    encoder.Save(stream);
                Paciente paciente = new Paciente(bandera_online_offline);

                bool actualizo = paciente.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, foto, this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica, alias);

                if (actualizo)
                {
                    if (this.foto_vieja.Equals(""))
                    {
                        string destfile_bs = @configuracion.carpetas.ruta_imagenes_carpeta + "\\" + foto;
                        System.IO.File.Copy(ruta2 + foto, destfile_bs, true);
                        string destfile_fotos = @configuracion.carpetas.ruta_subir_servidor_carpeta + "\\" + foto;
                        System.IO.File.Copy(destfile_bs, destfile_fotos, true);
                        File.Delete(ruta2 + foto);
                        //paciente = new Paciente(!bandera_online_offline);
                        //bool actualizo_again = paciente.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, foto, this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica);
                        //if (actualizo_again)
                        //{
                        //    System.Windows.Forms.MessageBox.Show("Tardaran unos minutos al subir la foto", "Espera", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        //    bool subir = SubirFicheroStockFTP(foto, @configuracion.carpetas.ruta_imagenes_carpeta+"\\");
                        //    System.Windows.Forms.MessageBox.Show("Se subio correctamente la foto", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        //    Recep recep = System.Windows.Application.Current.Windows.OfType<Recep>().FirstOrDefault();
                        //    Admin admin = System.Windows.Application.Current.Windows.OfType<Admin>().FirstOrDefault();
                        //    Soc socio = System.Windows.Application.Current.Windows.OfType<Soc>().FirstOrDefault();
                        //    if (admin != null)
                        //    {
                        //        admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                        //        admin.Main.Content = new Page6();
                        //    }
                        //    else
                        //    if (recep != null)
                        //    {
                        //        recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                        //        recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica);
                        //    }
                        //    else
                        //    if (socio != null)
                        //    {
                        //        socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                        //        socio.Main4.Content = new Pacientes_socio(this.lista,this.alias);
                        //    }

                        //}
                        //else
                        //{
                        //System.Windows.Forms.MessageBox.Show("Offline", "Offline", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault();
                        Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
                        Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();
                        if (admin != null)
                        {
                            admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                            admin.Main.Content = new Page6(alias);
                        }
                        else
                        if (recep != null)
                        {
                            recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                            recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias);
                        }
                        else
                        if (socio != null)
                        {
                            socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                            socio.Main4.Content = new Pacientes_socio(this.lista, this.alias);
                        }
                    }
                    else
                    {
                        if (File.Exists(@configuracion.carpetas.ruta_subir_servidor_carpeta + "\\" + foto_vieja))
                        {
                            File.Delete(@configuracion.carpetas.ruta_subir_servidor_carpeta + "\\" + foto_vieja);
                        }
                        if (File.Exists(@configuracion.carpetas.ruta_imagenes_carpeta + "\\" + foto_vieja))
                        {
                            File.Delete(@configuracion.carpetas.ruta_imagenes_carpeta + "\\" + foto_vieja);
                        }

                        string destfile_bs = @configuracion.carpetas.ruta_imagenes_carpeta + "\\" + foto;
                        System.IO.File.Copy(ruta2 + foto, destfile_bs, true);
                        string destfile_fotos = @configuracion.carpetas.ruta_subir_servidor_carpeta + "\\" + foto;
                        System.IO.File.Copy(destfile_bs, destfile_fotos, true);
                        if (File.Exists(ruta2 + foto))
                        {
                            File.Delete(ruta2 + foto);
                        }



                        Escribir_Archivo ea = new Escribir_Archivo();
                        ea.escribir_imagen_eliminar(this.foto_vieja, @configuracion.carpetas.ruta_eliminar_carpeta + "\\eliminar_imagen_temporal_" + alias + ".txt");
                        //paciente = new Paciente(!bandera_online_offline);
                        //bool actualizo_again = paciente.actualizarPaciente(this.paciente.id_paciente, this.paciente.nombre, this.paciente.apellidos, this.paciente.direccion, this.paciente.telefono, foto, this.paciente.antecedente, this.paciente.email, this.paciente.marketing, this.paciente.clinica.id_clinica);
                        //if (actualizo_again)
                        //{
                        //    System.Windows.Forms.MessageBox.Show("Tardaran unos minutos al subir la foto", "Espera", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        //    var datos = ea.leer(rutaArchivoEliminar);

                        //    foreach (string imagen in datos)
                        //    {
                        //        Uri siteUri = new Uri("ftp://jjdeveloperswdm.com/" + imagen);
                        //        bool verdad = DeleteFileOnServer(siteUri, "*****@*****.**", "bonita_smile");

                        //        if (!verdad)
                        //            eliminarArchivo = false;
                        //    }

                        //    if (eliminarArchivo)
                        //    {
                        //        System.Windows.MessageBox.Show("elimino Archivo");
                        //        ea.SetFileReadAccess(rutaArchivoEliminar, false);
                        //        File.Delete(@"\\DESKTOP-ED8E774\backup_bs\eliminar_imagen_temporal.txt");
                        //        bool subir = SubirFicheroStockFTP(foto, @"\\DESKTOP-ED8E774\bs\");
                        //        System.Windows.Forms.MessageBox.Show("Se subio correctamente la foto", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        //        Recep recep = System.Windows.Application.Current.Windows.OfType<Recep>().FirstOrDefault();
                        //        Admin admin = System.Windows.Application.Current.Windows.OfType<Admin>().FirstOrDefault();
                        //        Soc socio = System.Windows.Application.Current.Windows.OfType<Soc>().FirstOrDefault();
                        //        if (admin != null)
                        //        {
                        //            admin.Main.Content = new Page6();
                        //        }
                        //        else
                        //        if (recep != null)
                        //        {
                        //            recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica);
                        //        }
                        //        else
                        //        if (socio != null)
                        //        {
                        //            socio.Main4.Content = new Pacientes_socio(this.lista, this.alias);
                        //        }
                        //    }
                        //}

                        //System.Windows.Forms.MessageBox.Show("Offline", "Offline", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Recep recep = System.Windows.Application.Current.Windows.OfType <Recep>().FirstOrDefault();
                        Admin admin = System.Windows.Application.Current.Windows.OfType <Admin>().FirstOrDefault();
                        Soc   socio = System.Windows.Application.Current.Windows.OfType <Soc>().FirstOrDefault();
                        if (admin != null)
                        {
                            admin.Main.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                            admin.Main.Content = new Page6(alias);
                        }
                        else
                        if (recep != null)
                        {
                            recep.Main3.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                            recep.Main3.Content = new Pacientes_Recepcionista(this.paciente.clinica.id_clinica, alias);
                        }
                        else
                        if (socio != null)
                        {
                            socio.Main4.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Visible;
                            socio.Main4.Content = new Pacientes_socio(this.lista, this.alias);
                        }
                    }
                }
                else
                {
                    // System.Windows.Forms.MessageBox.Show("No se pudo actualizar el paciente ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }