Exemplo n.º 1
0
        private void frm_inicio_Load(object sender, EventArgs e)
        {
            // metodo pone un timer a funcionar para ir mostrado la hora en el sistema y se cambie
            timer1.Start();
            // antes de iniciar el programa implementa parametros para acomodar la interfaz dependiendo de la pantalla de computador
            PictureBox1.SetBounds(Screen.PrimaryScreen.Bounds.Width - 150, 15, PictureBox1.Width, PictureBox1.Height);
            pb_inicio.SetBounds(0, Screen.PrimaryScreen.Bounds.Height - 140, pb_inicio.Width, pb_inicio.Height);
            PictureBox3.SetBounds(Screen.PrimaryScreen.Bounds.Width - 60, 15, PictureBox3.Width, PictureBox3.Height);
            PictureBox4.SetBounds(10, 30, PictureBox4.Width, PictureBox4.Height);
            PictureBox5.SetBounds(this.Width - 200, this.Height - 100, PictureBox5.Width, PictureBox5.Height);
            Label1.SetBounds(100, 30, Label1.Width, Label1.Height);
            nombre.SetBounds(Screen.PrimaryScreen.Bounds.Width - 290, PictureBox1.Height - 40, nombre.Width, nombre.Height);
            Label4.SetBounds(Screen.PrimaryScreen.Bounds.Width - 290, PictureBox1.Height - 15, Label4.Width, Label4.Height);
            Label11.SetBounds(this.Width - 245, this.Height - 120, Label11.Width, Label11.Height);
            Label12.SetBounds(Screen.PrimaryScreen.Bounds.Width - 60, PictureBox3.Height + 15, Label12.Width, Label12.Height);
            Label4.SetBounds(Screen.PrimaryScreen.Bounds.Width - 220, PictureBox1.Height, Label4.Width, Label4.Height);
            pn_principal.SetBounds(PictureBox4.Width + 50, PictureBox4.Height + 40, Panel1.Width + pn_empleados.Width + Pn_pagos.Width + 400, Panel4.Height + Panel1.Height + 100);
            Panel1.SetBounds(PictureBox4.Width + 50, PictureBox4.Height + 40, Panel1.Width, Panel1.Height);
            pn_empleados.SetBounds(Panel1.Width + 350, PictureBox4.Height + 40, pn_empleados.Width, pn_empleados.Height);
            Pn_pagos.SetBounds(pn_empleados.Width + 800, PictureBox4.Height + 40, Pn_pagos.Width, Pn_pagos.Height);
            Panel4.SetBounds(PictureBox4.Width + 50, Panel1.Height + 200, Panel4.Width, Panel4.Height);
            Panel5.SetBounds(Panel4.Width + 350, Panel1.Height + 200, Panel5.Width, Panel5.Height);
            pn_configuracion.SetBounds(Panel5.Width + 800, Panel1.Height + 200, Panel5.Width, Panel5.Height);
            pn_principal.Hide();


            // obtiene los datos del usuario actual por medio de la variable ID

            DataSet ds = conexion.sqlconsulta("Select nombre,cedula,foto from  tbl_usuarios  where id_usuario='" + ID.ToString() + "'");

            nombre.Text = ds.Tables[0].Rows[0].ItemArray[0].ToString();
            Label4.Text = ds.Tables[0].Rows[0].ItemArray[1].ToString();

            try
            {
                PictureBox1.BackgroundImage       = Image.FromFile(ds.Tables[0].Rows[0].ItemArray[3].ToString());
                PictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
            }
            catch (Exception ex)
            {
                PictureBox1.BackgroundImage       = Image.FromFile(@"perfiles\profile.png");
                PictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
            }

            var busqueda = new StreamReader("configuracion.cfg");

            String cadena;

            while ((cadena = busqueda.ReadLine()) != null)
            {
                string[] campos = cadena.Split(':');
                if (campos[0].Equals("Fondo"))
                {
                    this.BackgroundImage       = Image.FromFile("fondo/" + campos[1]);
                    this.BackgroundImageLayout = ImageLayout.Stretch;
                }
                cadena = busqueda.ReadLine();
            }


            busqueda.Close();
        }
Exemplo n.º 2
0
        protected void patientSaveButton_Click(object sender, EventArgs e)
        {
            DateTime localDate   = DateTime.Now;
            var      dateAndTime = DateTime.Now;
            var      date        = dateAndTime.Date;


            aPatient.PatientName = patientNameTextBox.Text;
            aPatient.DateofBirth = dateOfBirthTextBox.Text;
            aPatient.MobileNo    = mobileNoTextBox.Text;
            aPatient.BillNo      = "Bill No-" + localDate.ToString("yyMMddHHmmss");
            aPatient.TotalFee    = Convert.ToDouble(totalFeeTextBox.Text);
            aPatient.DateofIssue = date.ToString("yyyy-MM-dd");
            aPatient.Status      = "N";



            patientAddButton.Enabled  = false;
            patientSaveButton.Enabled = false;

            timeLabel.Text = aPatientManager.SavePatient(aPatient);

            aPatient.PatientId = aPatientManager.GetPatientId(aPatient.BillNo);

            List <Patient> myPatient1 = (List <Patient>)ViewState["List"];

            timeLabel.Text = aPatientManager.InsertTestRequest(myPatient1, aPatient.PatientId);



            //pdf
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.pdf");
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            StringWriter   swr    = new StringWriter();
            HtmlTextWriter htmlwr = new HtmlTextWriter(swr);

            patientGridView.AllowPaging = false;
            List <Patient> myPatient = GetGridViewListForPatient1();

            patientGridView.DataSource = myPatient;
            patientGridView.DataBind();



            Label10.Text = " " + aPatient.BillNo + "";
            Label7.Text  = "NAME : " + patientNameTextBox.Text + "------";
            Label8.Text  = "Date of Birth : " + dateOfBirthTextBox.Text + "------";
            Label9.Text  = "Mobile Number : " + mobileNoTextBox.Text + "";

            Label11.Text = "_______________________________________________________________________________";
            Label12.Text = " ...................................................................................................Total Fee :" + totalFeeTextBox.Text + "";
            Label13.Text = "Issued Date: " + aPatient.DateofIssue + "........................................................................................\n";


            Label13.RenderControl(htmlwr);
            Label10.RenderControl(htmlwr);
            Label7.RenderControl(htmlwr);
            Label8.RenderControl(htmlwr);
            Label9.RenderControl(htmlwr);


            //ShowGridViewForPatient();
            //timeLabel.RenderControl(htmlwr);

            patientGridView.RenderControl(htmlwr);
            Label11.RenderControl(htmlwr);
            Label12.RenderControl(htmlwr);

            patientSaveButton.Enabled = false;

            StringReader srr = new StringReader(swr.ToString());

            Document   pdfdoc     = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
            HTMLWorker htmlparser = new HTMLWorker(pdfdoc);

            PdfWriter.GetInstance(pdfdoc, Response.OutputStream);
            pdfdoc.Open();
            htmlparser.Parse(srr);
            pdfdoc.Close();
            Response.Write(pdfdoc);
            Response.End();
        }