Ejemplo n.º 1
0
        public ActionResult DanhSachChuong(int id, string name)
        {
            if (!CheckSS())
            {
                return(RedirectToAction("DangNhap", "User"));
            }
            else
            {
                var tentruyen = data.Truyens.SingleOrDefault(m => m.MaProject == id).TenProject;
                ViewBag.TenTruyen  = tentruyen;
                ViewBag.MaProject  = id;
                ViewBag.Tenbandich = name;
                //int pageNum = (page ?? 1);
                //int pageSize = 7;
                DAO.DaoChuongTruyen daoChuongTruyen = new DAO.DaoChuongTruyen();
                ViewBag.LoaiTrang = daoChuongTruyen.GetLoaiTrang();
                var listtruyen = data.ChuongTruyens.Where(m => m.MaProject == id && m.DaXoa == false).OrderByDescending(a => a.ThuTuChuong).ToList();
                List <ChuongTruyenDaTao> chuongtruyens = new List <ChuongTruyenDaTao>();

                foreach (var truyen in listtruyen)
                {
                    ChuongTruyenDaTao chuongtruyen1 = new ChuongTruyenDaTao();
                    chuongtruyen1.TenChuong = truyen.TenChuongTruyen;
                    DateTime Tgcn  = truyen.ThoiGianCapNhat;
                    var      month = new DateDifference(Tgcn, DateTime.Now);

                    chuongtruyen1.Thoigian = month.ToString();
                    chuongtruyen1.LuotXem  = truyen.LuotXem;
                    chuongtruyen1.MaChuong = truyen.MaChuongTruyen;
                    chuongtruyens.Add(chuongtruyen1);
                }
                return(View(chuongtruyens));
            }
        }
        private void dtpFechaNacimiento_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            //Calcula la edad
            if (dtpFechaNacimiento.Text != "")
            {
                int lEdad = CalcularEdad(DateTime.Parse(dtpFechaNacimiento.Text));

                if (lEdad == -1)
                {
                    ControlOperation.alertWarning("La fecha de nacimiento es mayor a la fecha de hoy, Ingrese correctamente la fecha de nacimiento");
                    dtpFechaNacimiento.Text = "";
                }
                else if (lEdad == -2)
                {
                    ControlOperation.alertWarning(
                        "La edad del niño es igual o mayor a 13 años, no se le puede registrar en el sistema");

                    mAgeBlock = true;
                }
                else
                {
                    DateDifference dateDifference = new DateDifference(dtpFechaNacimiento.SelectedDate.Value,
                                                                       DateTime.Now.Date);

                    if (dtpFechaNacimiento.SelectedDate != null)
                    {
                        lblEdad.Content = dateDifference.ToString();
                    }
                    //lblEdad.Content = lEdad.ToString();
                }
            }
        }
Ejemplo n.º 3
0
        private void dTP_Born_ValueChanged(object sender, EventArgs e)
        {
            DateTime ToDate = DateTime.Now;

            DateDifference dDiff = new DateDifference(dTP_Born.Value, ToDate);

            lb_BirthDay.Text = dDiff.ToString("ปี", "เดือน", "วัน");
        }
Ejemplo n.º 4
0
        private void button3_Click(object sender, EventArgs e)
        {
            string         date           = "11/01/1991";
            DateTime       dt             = Convert.ToDateTime(date);
            DateTime       dt2            = Convert.ToDateTime("07/03/2013");
            DateDifference dateDifference = new DateDifference(dt, dt2);

            MessageBox.Show(dateDifference.ToString());
        }
Ejemplo n.º 5
0
        protected void TmpCopintGridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            Label lbempName = (Label)(e.Row.FindControl("lbempName"));

            if (lbempName != null)
            {
                lbempName.Text = (string)DataBinder.Eval(e.Row.DataItem, "profix_name") + (string)DataBinder.Eval(e.Row.DataItem, "emp_name") + "  " + (string)DataBinder.Eval(e.Row.DataItem, "emp_lname");
            }

            Label lbempChengDate = (Label)(e.Row.FindControl("lbempChengDate"));

            if (lbempChengDate != null)
            {
                lbempChengDate.Text = dBScript.convertDatelongThai((string)DataBinder.Eval(e.Row.DataItem, "tmp_cpoint_date"));
            }

            // เหลือเวลา
            Label lbempAgeWork = (Label)(e.Row.FindControl("lbCountdown"));

            if (lbempAgeWork != null)
            {
                string[]       data      = DataBinder.Eval(e.Row.DataItem, "tmp_cpoint_date").ToString().Split('-');
                DateTime       dateStart = DateTime.ParseExact(data[0] + "-" + data[1] + "-" + (int.Parse(data[2]) - 543), "dd-MM-yyyy", CultureInfo.InvariantCulture);
                DateDifference dDiff     = new DateDifference(dateStart);
                lbempAgeWork.Text = dDiff.ToString();
            }

            LinkButton btnConfirm = (LinkButton)(e.Row.FindControl("btnConfirm"));
            Label      txtConfirm = (Label)(e.Row.FindControl("txtConfirm"));

            if (btnConfirm != null)
            {
                btnConfirm.CommandName = DataBinder.Eval(e.Row.DataItem, "tmp_cpoint_id").ToString();
                if (DataBinder.Eval(e.Row.DataItem, "tmp_cpoint_status_approve").ToString() == "0")
                {
                    btnConfirm.Visible = true;
                    txtConfirm.Visible = false;
                }
                else
                {
                    btnConfirm.Visible = false;
                    txtConfirm.Visible = true;
                }
            }

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                try
                {
                    ((LinkButton)e.Row.Cells[6].Controls[0]).OnClientClick = "return confirmDelete(this);";
                }
                catch { }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (idHCP == 0)
            {
                divResumenPaciente.Attributes["class"] += " ui-helper-hidden";
            }
            else
            {
                AprHistoriaClinicaPerinatal oHCP = new AprHistoriaClinicaPerinatal(idHCP);
                SysPaciente oPaciente            = new SysPaciente(oHCP.IdPaciente);
                int         idPaciente           = oHCP.IdPaciente;
                if (!oPaciente.IsNew)
                {
                    DateDifference oEdad = new DateDifference(oPaciente.FechaNacimiento, DateTime.Today);
                    edad                   = oEdad;
                    ltPaciente.Text        = String.Format("{0}, {1}", oPaciente.Apellido, oPaciente.Nombre);
                    ltDocumentoUnico.Text  = oPaciente.NumeroDocumento.ToString();
                    ltFechaNacimiento.Text = oPaciente.FechaNacimiento.ToShortDateString();
                    ltEdad.Text            = oEdad.ToString();
                    semanas                = oEdad.Weeks;
                    ltObraSocial.Text      = oPaciente.SysObraSocial.Nombre;
                    ltSexo.Text            = oPaciente.SysSexo.Nombre;
                    //ltCronico.Text = oPaciente.Cronico ? "SI" : "NO";

                    //traigo el numero de historia clinica en el efector
                    int       efector = SSOHelper.CurrentIdentity.IdEfector;
                    DataTable dt      = SPs.SysGetPacientesHC(oPaciente.NumeroDocumento, efector).GetDataSet().Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        if (!string.IsNullOrEmpty(dt.Rows[0][9].ToString()))
                        {
                            int numeroHistoria = Convert.ToInt32(dt.Rows[0][9]);
                            ltHC.Text = numeroHistoria.ToString();
                        }
                    }

                    lkEditar.NavigateUrl = "~/Paciente/PacienteEdit.aspx?id=" + idPaciente.ToString();
                    if (oEdad.Years > 6)
                    {
                        //mayor de 6 años, oculto el link de control del menor
                        lkControlmenor.Visible = false;
                    }
                    else
                    {
                        //Menor o igual a 6 años, muestro el link del controles del menor
                        lkControlmenor.NavigateUrl = String.Format("~/ControlMenor/?idPaciente={0}", idPaciente);
                    }
                }
                else
                {
                    divResumenPaciente.Attributes["class"] += " ui-helper-hidden";
                }
            }
        }
        protected void ClaimGridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            LinkButton lbCpoint = (LinkButton)(e.Row.FindControl("lbCpoint"));

            if (lbCpoint != null)
            {
                lbCpoint.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id");
            }

            LinkButton lbEquipment = (LinkButton)(e.Row.FindControl("lbEquipment"));

            if (lbEquipment != null)
            {
                lbEquipment.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id");
                lbEquipment.ToolTip     = (string)DataBinder.Eval(e.Row.DataItem, "claim_equipment");
            }

            Label _lbDateStart = (Label)(e.Row.FindControl("_lbDateStart"));

            if (_lbDateStart != null)
            {
                _lbDateStart.Text = function.ConvertDateShortThai((string)DataBinder.Eval(e.Row.DataItem, "claim_start_date"));
            }

            Label lbStartDate = (Label)(e.Row.FindControl("lbStartDate"));

            if (lbStartDate != null)
            {
                lbStartDate.Text = function.ConvertDateShortThai((string)DataBinder.Eval(e.Row.DataItem, "detail_date_start"));
            }

            Label lbDay = (Label)(e.Row.FindControl("lbDay"));

            if (lbDay != null)
            {
                string[]       data      = DataBinder.Eval(e.Row.DataItem, "detail_date_start").ToString().Split('-');
                DateTime       dateStart = DateTime.ParseExact(data[0] + "-" + data[1] + "-" + (int.Parse(data[2]) - 543), "dd-MM-yyyy", CultureInfo.InvariantCulture);
                DateDifference differnce = new DateDifference(dateStart);

                if (differnce.ToString() == "")
                {
                    lbDay.CssClass = "badge badge-danger";
                    lbDay.Text     = "NEW!!";
                }
                else
                {
                    lbDay.Text = differnce.ToString();
                }
            }

            Label lbCountdown = (Label)(e.Row.FindControl("lbCountdown"));

            if (lbDay != null)
            {
                string[]       data      = DataBinder.Eval(e.Row.DataItem, "detail_date_end").ToString().Split('-');
                DateTime       dateStart = DateTime.ParseExact(data[0] + "-" + data[1] + "-" + (int.Parse(data[2]) - 543), "dd-MM-yyyy", CultureInfo.InvariantCulture);
                DateDifference differnce = new DateDifference(dateStart);
                if (dateStart < DateTime.Now.Date)
                {
                    lbCountdown.Text     = "เกินกำหนดมา " + differnce.ToString();
                    lbCountdown.CssClass = "text-danger";
                }
                else
                {
                    if (differnce.ToString() != "")
                    {
                        lbCountdown.Text     = "ครบกำหนดอีก " + differnce.ToString();
                        lbCountdown.CssClass = "text-success";
                    }
                    else
                    {
                        lbCountdown.Text     = "ครบกำหนดวันนี้ ";
                        lbCountdown.CssClass = "text-warning";
                    }
                }

                if ((string)DataBinder.Eval(e.Row.DataItem, "status_name") == "ส่งงาน/เสร็จสิ้น")
                {
                    lbCountdown.Text     = "เสร็จสิ้น";
                    lbCountdown.CssClass = "text-success";
                }
            }

            Label lbStatus = (Label)(e.Row.FindControl("lbStatus"));

            if (lbStatus != null)
            {
                lbStatus.CssClass = "badge badge-" + (string)DataBinder.Eval(e.Row.DataItem, "status_alert");
            }

            LinkButton btnChangeStatus = (LinkButton)(e.Row.FindControl("btnChangeStatus"));

            if (btnChangeStatus != null)
            {
                btnChangeStatus.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id");
            }
        }
Ejemplo n.º 8
0
        protected void ClaimGridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            LinkButton lbCpoint = (LinkButton)(e.Row.FindControl("lbCpoint"));

            if (lbCpoint != null)
            {
                lbCpoint.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id");
            }

            LinkButton lbNoteCom = (LinkButton)(e.Row.FindControl("lbNoteCom"));

            if (lbNoteCom != null)
            {
                lbNoteCom.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id");
            }


            LinkButton lbEquipment = (LinkButton)(e.Row.FindControl("lbEquipment"));

            if (lbEquipment != null)
            {
                lbEquipment.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id");
                lbEquipment.ToolTip     = (string)DataBinder.Eval(e.Row.DataItem, "claim_equipment");;
            }


            Label lbCpointDate = (Label)(e.Row.FindControl("lbCpointDate"));

            if (lbCpointDate != null)
            {
                lbCpointDate.Text = function.ConvertDateShortThai((string)DataBinder.Eval(e.Row.DataItem, "claim_cpoint_date"));
            }

            Label lbStartDate = (Label)(e.Row.FindControl("lbStartDate"));

            if (lbStartDate != null)
            {
                lbStartDate.Text = function.ConvertDateShortThai((string)DataBinder.Eval(e.Row.DataItem, "claim_start_date"));
            }

            Label lbDay = (Label)(e.Row.FindControl("lbDay"));

            if (lbDay != null)
            {
                string[]       data      = DataBinder.Eval(e.Row.DataItem, "claim_start_date").ToString().Split('-');
                DateTime       dateStart = DateTime.ParseExact(data[0] + "-" + data[1] + "-" + (int.Parse(data[2]) - 543), "dd-MM-yyyy", CultureInfo.InvariantCulture);
                DateDifference differnce = new DateDifference(dateStart);

                if (differnce.ToString() == "")
                {
                    lbDay.CssClass = "badge badge-danger";
                    lbDay.Text     = "NEW!!";
                }
                else
                {
                    lbDay.Text = differnce.ToString();
                }
            }

            Label lbStatus = (Label)(e.Row.FindControl("lbStatus"));

            if (lbStatus != null)
            {
                lbStatus.CssClass = "badge badge-" + (string)DataBinder.Eval(e.Row.DataItem, "status_alert");
            }

            LinkButton printReport1 = (LinkButton)(e.Row.FindControl("printReport1"));

            if (printReport1 != null)
            {
                printReport1.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id");
                //printReport1.OnClientClick = "document.forms[0].target ='_blank';";
                //printReport1.t
            }

            LinkButton printReport2 = (LinkButton)(e.Row.FindControl("printReport2"));

            if (printReport2 != null)
            {
                printReport2.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id");
                //printReport1.t
            }

            //*** Edit ***'
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DropDownList txtStatusEdit = (DropDownList)e.Row.FindControl("txtStatusEdit");
                if ((txtStatusEdit != null))
                {
                    string sql_status = "SELECT * FROM tbl_status";
                    function.getListItem(txtStatusEdit, sql_status, "status_name", "status_id");
                    txtStatusEdit.SelectedIndex = txtStatusEdit.Items.IndexOf(txtStatusEdit.Items.FindByValue((string)DataBinder.Eval(e.Row.DataItem, "status_id").ToString()));
                }
            }
        }
Ejemplo n.º 9
0
        protected void GridViewEmp_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //รหัสบุคคล
            Label lbempID = (Label)(e.Row.FindControl("lbempID"));

            if (lbempID != null)
            {
                lbempID.Text = (string)DataBinder.Eval(e.Row.DataItem, "emp_id");
            }


            // ชื่อ - สกุล
            Label lbempName = (Label)(e.Row.FindControl("lbempName"));

            if (lbempName != null)
            {
                lbempName.Text = (string)DataBinder.Eval(e.Row.DataItem, "profix_name") + (string)DataBinder.Eval(e.Row.DataItem, "emp_name") + "  " + (string)DataBinder.Eval(e.Row.DataItem, "emp_lname");
            }

            // สังกัดด่านฯ
            Label lbempCpoint = (Label)(e.Row.FindControl("lbempCpoint"));

            if (lbempCpoint != null)
            {
                lbempCpoint.Text = (string)DataBinder.Eval(e.Row.DataItem, "cpoint_name");
            }

            // ตำแหน่ง
            Label lbempPos = (Label)(e.Row.FindControl("lbempPos"));

            if (lbempPos != null)
            {
                lbempPos.Text = (string)DataBinder.Eval(e.Row.DataItem, "pos_name");
            }

            // หน่วย
            Label lbempAff = (Label)(e.Row.FindControl("lbempAff"));

            if (lbempAff != null)
            {
                lbempAff.Text = (string)DataBinder.Eval(e.Row.DataItem, "affi_name");
            }

            // ประเภทพนักงาน
            Label lbempType = (Label)(e.Row.FindControl("lbempType"));

            if (lbempType != null)
            {
                lbempType.Text = (string)DataBinder.Eval(e.Row.DataItem, "type_emp_name");
            }

            // อายุงาน
            Label lbempAgeWork = (Label)(e.Row.FindControl("lbempAgeWork"));

            if (lbempAgeWork != null)
            {
                string[] data      = DataBinder.Eval(e.Row.DataItem, "emp_start_working").ToString().Split('-');
                DateTime dateStart = DateTime.ParseExact(data[0] + "-" + data[1] + "-" + (int.Parse(data[2]) - 543), "dd-MM-yyyy", CultureInfo.InvariantCulture);
                if (dateStart.Date <= DateTime.Now.Date)
                {
                    DateDifference dDiff = new DateDifference(dateStart);
                    lbempAgeWork.Text = dDiff.ToString();
                }
                else
                {
                    lbempAgeWork.Text = "<span class='badge badge-pill badge-danger'>ข้อมูลวันเริ่มงานผิดพลาด</span>";
                }
            }

            // อายุงาน
            Label lbempAgeWorkNow = (Label)(e.Row.FindControl("lbempAgeWorkNow"));

            if (lbempAgeWorkNow != null)
            {
                try
                {
                    string          sql = "SELECT * FROM tbl_exp_moterway WHERE exp_moterway_emp_id = '" + (string)DataBinder.Eval(e.Row.DataItem, "emp_id") + "' AND exp_moterway_end = '00-00-0000'";
                    MySqlDataReader rs  = dbScript.selectSQL(sql);
                    if (rs.Read())
                    {
                        string[] data      = rs.GetString("exp_moterway_start").ToString().Split('-');
                        DateTime dateStart = DateTime.ParseExact(data[0] + "-" + data[1] + "-" + (int.Parse(data[2]) - 543), "dd-MM-yyyy", CultureInfo.InvariantCulture);
                        if (dateStart.Date <= DateTime.Now.Date)
                        {
                            DateDifference dDiff = new DateDifference(dateStart);
                            lbempAgeWorkNow.Text = dDiff.ToString();
                        }
                        else
                        {
                            lbempAgeWorkNow.Text = "<span class='badge badge-pill badge-danger'>ข้อมูลวันเริ่มงานตำแหน่งปัจจุบันผิดพลาด</span>";
                        }
                        rs.Close();
                    }
                    else
                    {
                        lbempAgeWorkNow.Text = "-";
                    }
                }
                catch { lbempAgeWorkNow.Text = "มีข้อผิดพลาด"; }
            }

            Button txtEmpViwe = (Button)(e.Row.FindControl("txtEmpViwe"));

            if (txtEmpViwe != null)
            {
                txtEmpViwe.CommandArgument = (string)DataBinder.Eval(e.Row.DataItem, "emp_id");
            }
            dbScript.CloseConnection();
        }
        private void fillData()
        {
            DataTable lDtHistorialMedico = new DataTable();

            ControlDePacientes.Dal.HistorialMedico lHistorialMedico = new HistorialMedico();

            lDtHistorialMedico = lHistorialMedico.HistorialMedicoGetAllForPrint(mIdHistorialMedico);

            if (lDtHistorialMedico.Rows.Count > 0)
            {
                if (lDtHistorialMedico.Rows[0]["Nombre"].ToString() != "")
                {
                    txtNombrePaciente.Text = (string)lDtHistorialMedico.Rows[0]["Nombre"];
                }
                else
                {
                    txtNombrePaciente.Text = "";
                }


                if (lDtHistorialMedico.Rows[0]["Apellido"].ToString() != "" || lDtHistorialMedico.Rows[0]["SegundoApellido"].ToString() != "")
                {
                    txtApellidoPaciente.Text = (string)lDtHistorialMedico.Rows[0]["Apellido"] + " " + (string)lDtHistorialMedico.Rows[0]["SegundoApellido"];
                }
                else
                {
                    txtApellidoPaciente.Text = "";
                }
                txtApellidoPaciente.IsEnabled = false;
                if (lDtHistorialMedico.Rows[0]["SexoName"].ToString() != "")
                {
                    txtSexo.Text = (string)lDtHistorialMedico.Rows[0]["SexoName"];
                }
                else
                {
                    txtSexo.Text = "";
                }
                txtSexo.IsEnabled = false;
                //lblEdad.Content = Convert.ToString( CalcularEdad(DateTime.Parse(Convert.ToString(lDtPaciente.Rows[0]["FechaNacimiento"]))));
                if (lDtHistorialMedico.Rows[0]["FechaNacimiento"].ToString() != "")
                {
                    DateDifference dateDifference =
                        new DateDifference(DateTime.Parse(Convert.ToString(lDtHistorialMedico.Rows[0]["FechaNacimiento"])),
                                           DateTime.Now.Date);
                    lblEdad.Content = dateDifference.ToString();
                }
                else
                {
                    lblEdad.Content = "";
                }

                if (lDtHistorialMedico.Rows[0]["NombrePadre"].ToString() != "")
                {
                    txtNombrePadre.Text = (string)lDtHistorialMedico.Rows[0]["NombrePadre"];
                }
                else
                {
                    txtNombrePadre.Text = "";
                }
                txtNombrePadre.IsEnabled = false;
                if (lDtHistorialMedico.Rows[0]["NombreMadre"].ToString() != "")
                {
                    txtNombreMadre.Text = (string)lDtHistorialMedico.Rows[0]["NombreMadre"];
                }
                else
                {
                    txtNombreMadre.Text = "";
                }
                txtNombreMadre.IsEnabled = false;
                if (lDtHistorialMedico.Rows[0]["Direccion"].ToString() != "")
                {
                    txtDireccion.Text = (string)lDtHistorialMedico.Rows[0]["Direccion"]; //unir con municipio y departamento
                }
                else
                {
                    txtDireccion.Text = "";
                }
                txtDireccion.IsEnabled = false;
                if (lDtHistorialMedico.Rows[0]["FotoPath"] == DBNull.Value || (string)lDtHistorialMedico.Rows[0]["FotoPath"] == "")
                {
                }
                else
                {
                    ControlOperation.LoadImageFromDB((byte[])lDtHistorialMedico.Rows[0]["FotoPaciente"], imgPaciente);
                }


                // lblDate.Content = (string)lDtPaciente.Rows[0]["FECHA"];

                wrpButtons.Visibility = Visibility.Visible;

                txtMotivoConsulta.Text      = lDtHistorialMedico.Rows[0]["MotivoConsulta"].ToString() != "" ? (string)lDtHistorialMedico.Rows[0]["MotivoConsulta"] : "";
                txtMotivoConsulta.IsEnabled = false;

                txtPA.Text      = lDtHistorialMedico.Rows[0]["PresionArterial"].ToString() != "" ? Convert.ToString(lDtHistorialMedico.Rows[0]["PresionArterial"]) : "";
                txtPA.IsEnabled = false;

                if (lDtHistorialMedico.Rows[0]["CodServicio"].ToString() != "")//(int) lDtPaciente.Rows[0]["CodServicio"] != 0)
                {
                    cmbServicio.SelectedValue = (int)lDtHistorialMedico.Rows[0]["CodServicio"];
                }
                else
                {
                    cmbServicio.SelectedIndex = 0;
                }
                cmbServicio.IsEnabled = false;

                txtFC.Text                = lDtHistorialMedico.Rows[0]["FrecuenciaCardiaca"].ToString() != "" ? Convert.ToString(lDtHistorialMedico.Rows[0]["FrecuenciaCardiaca"]) : "";
                txtFC.IsEnabled           = false;
                txtRX.Text                = lDtHistorialMedico.Rows[0]["RayosX"].ToString() != "" ? Convert.ToString(lDtHistorialMedico.Rows[0]["RayosX"]) : "";
                txtRX.IsEnabled           = false;
                txtFR.Text                = lDtHistorialMedico.Rows[0]["FrecuenciaRespiratora"].ToString() != "" ? Convert.ToString(lDtHistorialMedico.Rows[0]["FrecuenciaRespiratora"]) : "";
                txtFR.IsEnabled           = false;
                txtTemp.Text              = lDtHistorialMedico.Rows[0]["Temperatura"].ToString() != "" ? Convert.ToString(lDtHistorialMedico.Rows[0]["Temperatura"]) : "";
                txtTemp.IsEnabled         = false;
                txtCC.Text                = lDtHistorialMedico.Rows[0]["CC"].ToString() != "" ? Convert.ToString(lDtHistorialMedico.Rows[0]["CC"]) : "";
                txtCC.IsEnabled           = false;
                txtPeso.Text              = lDtHistorialMedico.Rows[0]["Peso"].ToString() != "" ? Convert.ToString(lDtHistorialMedico.Rows[0]["Peso"]) : "";
                txtPeso.IsEnabled         = false;
                txtTalla.Text             = lDtHistorialMedico.Rows[0]["Talla"].ToString() != "" ? Convert.ToString(lDtHistorialMedico.Rows[0]["Talla"]) : "";
                txtTalla.IsEnabled        = false;
                txtMC.Text                = lDtHistorialMedico.Rows[0]["MasaCorporal"].ToString() != "" ? Convert.ToString(lDtHistorialMedico.Rows[0]["MasaCorporal"]) : "";
                txtMC.IsEnabled           = false;
                txtTE.Text                = lDtHistorialMedico.Rows[0]["TE"].ToString() != "" ? Convert.ToString(lDtHistorialMedico.Rows[0]["TE"]) : "";
                txtTE.IsEnabled           = false;
                txtPE.Text                = lDtHistorialMedico.Rows[0]["PE"].ToString() != "" ? Convert.ToString(lDtHistorialMedico.Rows[0]["PE"]) : "";
                txtPE.IsEnabled           = false;
                txtPesoTalla.Text         = lDtHistorialMedico.Rows[0]["PesoTalla"].ToString() != "" ? Convert.ToString(lDtHistorialMedico.Rows[0]["PesoTalla"]) : "";
                txtPesoTalla.IsEnabled    = false;
                txtSaturacion.Text        = lDtHistorialMedico.Rows[0]["SaturacionO2"].ToString() != "" ? Convert.ToString(lDtHistorialMedico.Rows[0]["SaturacionO2"]) : "";
                txtSaturacion.IsEnabled   = false;
                txtExamenFisico.Text      = lDtHistorialMedico.Rows[0]["ExamenFisico"].ToString() != "" ? (string)lDtHistorialMedico.Rows[0]["ExamenFisico"] : "";
                txtExamenFisico.IsEnabled = false;
                txtAntecedentes.Text      = lDtHistorialMedico.Rows[0]["AntecedentesImportancia"].ToString() != "" ? (string)lDtHistorialMedico.Rows[0]["AntecedentesImportancia"] : "";

                txtAntecedentes.IsEnabled = false;

                if (lDtHistorialMedico.Rows[0]["EstudiosIniciales"].ToString() != "")
                {
                    txtEstudioInicial.Text = (string)lDtHistorialMedico.Rows[0]["EstudiosIniciales"];
                }
                txtEstudioInicial.IsEnabled = false;
                if (lDtHistorialMedico.Rows[0]["EstadoNutricinal"].ToString() != "")
                {
                    txtEstadoNutricional.Text = (string)lDtHistorialMedico.Rows[0]["EstadoNutricinal"];
                }
                txtEstadoNutricional.IsEnabled = false;
                if (lDtHistorialMedico.Rows[0]["ImpresionClinica"].ToString() != "")
                {
                    txtImpresion.Text = (string)lDtHistorialMedico.Rows[0]["ImpresionClinica"];
                }
                txtImpresion.IsEnabled = false;
                if (lDtHistorialMedico.Rows[0]["TratamientoConsultaExterna"].ToString() != "")
                {
                    txtTratamiento.Text = (string)lDtHistorialMedico.Rows[0]["TratamientoConsultaExterna"];
                }
                txtTratamiento.IsEnabled = false;
                if (lDtHistorialMedico.Rows[0]["Observaciones"].ToString() != "")
                {
                    txtObservaciones.Text = (string)lDtHistorialMedico.Rows[0]["Observaciones"];
                }
                txtObservaciones.IsEnabled = false;
                if (lDtHistorialMedico.Rows[0]["NotasDescargo"].ToString() == "")
                {
                    txtNotaDescargo.Text = "";
                }
                else
                {
                    txtNotaDescargo.Text = (string)lDtHistorialMedico.Rows[0]["NotasDescargo"];
                }
                txtNotaDescargo.IsEnabled = false;


                if (lDtHistorialMedico.Rows[0]["DxEgreso"].ToString() != "")
                {
                    cmbDiagnosticoFinal.SelectedValue = (int)lDtHistorialMedico.Rows[0]["DxEgreso"];
                }
                else
                {
                    cmbDiagnosticoFinal.SelectedIndex = 0;
                }
                cmbDiagnosticoFinal.IsEnabled = false;

                if (lDtHistorialMedico.Rows[0]["DxIngreso"].ToString() != "")
                {
                    cmbDiagnosticoInicial.SelectedValue = (int)lDtHistorialMedico.Rows[0]["DxIngreso"];
                }
                else
                {
                    cmbDiagnosticoInicial.SelectedIndex = 0;
                }
                cmbDiagnosticoInicial.IsEnabled = false;

                if (lDtHistorialMedico.Rows[0]["CodDestinoCaso"].ToString() != "")
                {
                    cmbDestinoCaso.SelectedValue = (int)lDtHistorialMedico.Rows[0]["CodDestinoCaso"];
                }
                else
                {
                    cmbDestinoCaso.SelectedIndex = 0;
                }
                cmbDestinoCaso.IsEnabled = false;

                txtIdPaciente.IsEnabled       = false;
                txtIdPaciente.Text            = txtIdPacienteSearch.Text;
                txtNombrePaciente.IsEnabled   = false;
                txtApellidoPaciente.IsEnabled = false;
                txtSexo.IsEnabled             = false;
                txtNombrePadre.IsEnabled      = false;
                txtNombreMadre.IsEnabled      = false;
                txtDireccion.IsEnabled        = false;

                txtNombrePaciente.IsEnabled = false;
            }
            else
            {
                ControlOperation.alertWarning("El Paciente no tiene Historial");
            }



            //DataTable lDtPaciente = new DataTable();
            //ControlDePacientes.Dal.Paciente lPaciente = new Paciente();

            //lDtPaciente = lPaciente.GetPacienteByRegistroMedico(txtIdPacienteSearch.Text);

            //if (lDtPaciente.Rows.Count > 0)
            //{
            //    txtIdPaciente.IsEnabled = false;
            //    txtIdPaciente.Text = txtIdPacienteSearch.Text;
            //    txtNombrePaciente.IsEnabled = false;
            //    txtApellidoPaciente.IsEnabled = false;
            //    txtSexo.IsEnabled = false;
            //    txtNombrePadre.IsEnabled = false;
            //    txtNombreMadre.IsEnabled = false;
            //    txtDireccion.IsEnabled = false;

            //txtNombrePaciente.IsEnabled = false;
            //if (lDtPaciente.Rows[0]["Apellido"].ToString() != "" || lDtPaciente.Rows[0]["SegundoApellido"].ToString() != "")
            //    txtApellidoPaciente.Text = (string)lDtPaciente.Rows[0]["Apellido"] + " " + (string)lDtPaciente.Rows[0]["SegundoApellido"];
            //else txtApellidoPaciente.Text = "";
            //txtApellidoPaciente.IsEnabled = false;
            //if (lDtPaciente.Rows[0]["SexoName"].ToString() != "")
            //    txtSexo.Text = (string)lDtPaciente.Rows[0]["SexoName"];
            //else txtSexo.Text = "";
            //txtSexo.IsEnabled = false;
            ////lblEdad.Content = Convert.ToString( CalcularEdad(DateTime.Parse(Convert.ToString(lDtPaciente.Rows[0]["FechaNacimiento"]))));
            //if (lDtPaciente.Rows[0]["FechaNacimiento"].ToString() != "")
            //{
            //    DateDifference dateDifference =
            //        new DateDifference(DateTime.Parse(Convert.ToString(lDtPaciente.Rows[0]["FechaNacimiento"])),
            //                           DateTime.Now.Date);
            //    lblEdad.Content = dateDifference.ToString();
            //}
            //else lblEdad.Content = "";

            //if (lDtPaciente.Rows[0]["NombrePadre"].ToString() != "")
            //    txtNombrePadre.Text = (string)lDtPaciente.Rows[0]["NombrePadre"];
            //else txtNombrePadre.Text = "";
            //txtNombrePadre.IsEnabled = false;
            //if (lDtPaciente.Rows[0]["NombreMadre"].ToString() != "")
            //    txtNombreMadre.Text = (string)lDtPaciente.Rows[0]["NombreMadre"];
            //else txtNombreMadre.Text = "";
            //txtNombreMadre.IsEnabled = false;
            //if (lDtPaciente.Rows[0]["Direccion"].ToString() != "")
            //    txtDireccion.Text = (string)lDtPaciente.Rows[0]["Direccion"]; //unir con municipio y departamento
            //else txtDireccion.Text = "";
            //txtDireccion.IsEnabled = false;
            //if (lDtPaciente.Rows[0]["FotoPath"] == DBNull.Value || (string)lDtPaciente.Rows[0]["FotoPath"] == "")
            //{ }
            //else imgPaciente.Source = new BitmapImage(new Uri((string)lDtPaciente.Rows[0]["FotoPath"]));


            //// lblDate.Content = (string)lDtPaciente.Rows[0]["FECHA"];

            //wrpButtons.Visibility = Visibility.Visible;

            // }
        }
Ejemplo n.º 11
0
        private void fillData()
        {
            DataTable lDtPaciente = new DataTable();

            ControlDePacientes.Dal.Paciente lPaciente = new Paciente();
            //lDtPaciente = lPaciente.GetPacienteById(Convert.ToInt32(txtIdPaciente.Text));
            lDtPaciente = lPaciente.GetPacienteByRegistroMedico(txtIdPaciente.Text);

            if (lDtPaciente.Rows.Count > 0)
            {
                mIdPaciente = (int)lDtPaciente.Rows[0]["IdPaciente"];

                DataTable lDtVerifyHistorial = new DataTable();
                ControlDePacientes.Dal.HistorialMedico lHistorialMedicoVerify = new HistorialMedico();
                lDtVerifyHistorial = lHistorialMedicoVerify.HistorialMedicoVerify(mIdPaciente, 10); //10 es Iniciado

                if (lDtVerifyHistorial.Rows.Count > 0)
                {
                    txtIdPaciente.IsEnabled       = false;
                    txtNombrePaciente.Text        = (string)lDtPaciente.Rows[0]["Nombre"];
                    txtNombrePaciente.IsEnabled   = false;
                    txtApellidoPaciente.Text      = lDtPaciente.Rows[0]["Apellido"].ToString() != "" || lDtPaciente.Rows[0]["SegundoApellido"].ToString() != "" ? (string)lDtPaciente.Rows[0]["Apellido"] + " " + (string)lDtPaciente.Rows[0]["SegundoApellido"] : "";
                    txtApellidoPaciente.IsEnabled = false;
                    txtSexo.Text      = lDtPaciente.Rows[0]["SexoName"].ToString() != "" ? (string)lDtPaciente.Rows[0]["SexoName"] : "";
                    txtSexo.IsEnabled = false;
                    if (lDtPaciente.Rows[0]["FechaNacimiento"].ToString() != "")
                    {
                        DateDifference dateDifference = new DateDifference(DateTime.Parse(Convert.ToString(lDtPaciente.Rows[0]["FechaNacimiento"])), DateTime.Now.Date);
                        lblEdad.Content = dateDifference.ToString();
                    }
                    else
                    {
                        lblEdad.Content = "";
                    }

                    txtNombrePadre.Text      = lDtPaciente.Rows[0]["NombrePadre"].ToString() != "" ? (string)lDtPaciente.Rows[0]["NombrePadre"] : "";
                    txtNombrePadre.IsEnabled = false;
                    txtNombreMadre.Text      = lDtPaciente.Rows[0]["NombreMadre"].ToString() != "" ? (string)lDtPaciente.Rows[0]["NombreMadre"] : "";
                    txtNombreMadre.IsEnabled = false;
                    txtDireccion.Text        = lDtPaciente.Rows[0]["Direccion"].ToString() != "" ? (string)lDtPaciente.Rows[0]["Direccion"] : "";
                    txtDireccion.IsEnabled   = false;


                    if (lDtPaciente.Rows[0]["FotoPath"] == DBNull.Value || (string)lDtPaciente.Rows[0]["FotoPath"] == "")
                    {
                    }
                    else
                    {
                        ControlOperation.LoadImageFromDB((byte[])lDtPaciente.Rows[0]["FotoPaciente"], imgPaciente);
                    }

                    //   imgPaciente.Source = new BitmapImage(new Uri((string)lDtPaciente.Rows[0]["FotoPath"]));

                    expExamenFisico.IsEnabled  = true;
                    expExamenFisico.IsExpanded = true;
                    wrpButtons.Visibility      = Visibility.Visible;

                    //lleno el examen fisico
                    txtMotivoConsulta.Text = lDtVerifyHistorial.Rows[0]["MotivoConsulta"].ToString() != "" ? (string)lDtVerifyHistorial.Rows[0]["MotivoConsulta"] : "";
                    txtPA.Text             = lDtVerifyHistorial.Rows[0]["PresionArterial"].ToString() != "" ? Convert.ToString(lDtVerifyHistorial.Rows[0]["PresionArterial"]) : "";
                    if (lDtVerifyHistorial.Rows[0]["CodServicio"].ToString() != "")
                    {
                        cmbServicio.SelectedValue = (int)lDtVerifyHistorial.Rows[0]["CodServicio"];
                    }
                    else
                    {
                        cmbServicio.SelectedIndex = 0;
                    }
                    txtFC.Text           = lDtVerifyHistorial.Rows[0]["FrecuenciaCardiaca"].ToString() != "" ? Convert.ToString(lDtVerifyHistorial.Rows[0]["FrecuenciaCardiaca"]) : "";
                    txtRX.Text           = lDtVerifyHistorial.Rows[0]["RayosX"].ToString() != "" ? Convert.ToString(lDtVerifyHistorial.Rows[0]["RayosX"]) : "";
                    txtFR.Text           = lDtVerifyHistorial.Rows[0]["FrecuenciaRespiratora"].ToString() != "" ? Convert.ToString(lDtVerifyHistorial.Rows[0]["FrecuenciaRespiratora"]) : "";
                    txtTemp.Text         = lDtVerifyHistorial.Rows[0]["Temperatura"].ToString() != "" ? Convert.ToString(lDtVerifyHistorial.Rows[0]["Temperatura"]) : "";
                    txtCC.Text           = lDtVerifyHistorial.Rows[0]["CC"].ToString() != "" ? Convert.ToString(lDtVerifyHistorial.Rows[0]["CC"]) : "";
                    txtPeso.Text         = lDtVerifyHistorial.Rows[0]["Peso"].ToString() != "" ? Convert.ToString(lDtVerifyHistorial.Rows[0]["Peso"]) : "";
                    txtTalla.Text        = lDtVerifyHistorial.Rows[0]["Talla"].ToString() != "" ? Convert.ToString(lDtVerifyHistorial.Rows[0]["Talla"]) : "";
                    txtMC.Text           = lDtVerifyHistorial.Rows[0]["MasaCorporal"].ToString() != "" ? Convert.ToString(lDtVerifyHistorial.Rows[0]["MasaCorporal"]) : "";
                    txtTE.Text           = lDtVerifyHistorial.Rows[0]["TE"].ToString() != "" ? Convert.ToString(lDtVerifyHistorial.Rows[0]["TE"]) : "";
                    txtPE.Text           = lDtVerifyHistorial.Rows[0]["PE"].ToString() != "" ? Convert.ToString(lDtVerifyHistorial.Rows[0]["PE"]) : "";
                    txtPesoTalla.Text    = lDtVerifyHistorial.Rows[0]["PesoTalla"].ToString() != "" ? Convert.ToString(lDtVerifyHistorial.Rows[0]["PesoTalla"]) : "";
                    txtSaturacion.Text   = lDtVerifyHistorial.Rows[0]["SaturacionO2"].ToString() != "" ? Convert.ToString(lDtVerifyHistorial.Rows[0]["SaturacionO2"]) : "";
                    txtExamenFisico.Text = lDtVerifyHistorial.Rows[0]["ExamenFisico"].ToString() != "" ? (string)lDtVerifyHistorial.Rows[0]["ExamenFisico"] : "";
                    txtAntecedentes.Text = lDtVerifyHistorial.Rows[0]["AntecedentesImportancia"].ToString() != "" ? (string)lDtVerifyHistorial.Rows[0]["AntecedentesImportancia"] : "";
                }
                else
                {
                    ControlOperation.alertWarning("El paciente no tiene un historial nuevo, debe registrarse en Admisión");
                }
            }
        }
Ejemplo n.º 12
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            textBox1.Text = DateTime.Now.ToString("dd/MM/yyyy");
            string     status = "", salary = "";
            string     joinD      = "";
            double     curPayment = 0.00;
            string     q1         = "select empName,salary,status,joinDate from employeeInfo where empID='" + comboBox1.Text + "'";
            string     q2         = "select sum(currentPayment) from empPayment where empID='" + comboBox1.Text + "'";
            SqlCommand cmd        = new SqlCommand(q1, aa);

            try
            {
                aa.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    textBox6.Text = dr.GetValue(0).ToString();
                    salary        = dr.GetValue(1).ToString();
                    textBox7.Text = dr.GetValue(1).ToString();
                    status        = dr.GetValue(2).ToString();
                    joinD         = dr.GetValue(3).ToString();
                }

                dr.Close();
                SqlCommand    cmd2     = new SqlCommand(q2, aa);
                SqlDataReader dr2      = cmd2.ExecuteReader();
                string        curPtemp = "";
                while (dr2.Read())
                {
                    curPtemp = dr2.GetValue(0).ToString();
                }

                if (curPtemp != "")
                {
                    curPayment = Convert.ToDouble(curPtemp);
                }
                else
                {
                    curPayment = 0.00;
                }
                dr2.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "errror!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                aa.Close();
            }
            //salary calculation
            string[] s = status.Split(' ');

            // MessageBox.Show(s[0] + "\t" + s[1]);

            if (s[0] == "Inactive")
            {
                label12.Text = "Inactive";
                string activeDate = joinD;

                DateTime       jdate          = Convert.ToDateTime(activeDate);
                DateTime       currentdate    = Convert.ToDateTime(s[1].ToString());
                DateDifference dateDifference = new DateDifference(jdate, currentdate);

                string DiffDate = dateDifference.ToString();
                //  MessageBox.Show(DiffDate);
                string[] sDD = DiffDate.Split('/');
                int      yy  = Convert.ToInt32(sDD[0]);
                int      mm  = Convert.ToInt32(sDD[1]);
                int      dd  = Convert.ToInt32(sDD[2]);
                //if (dd != 0)
                //{
                //    mm += 1;
                //}
                int totalMonth = (yy * 12) + mm;
                textBox8.Text = totalMonth.ToString();

                double totalSal = totalMonth * Convert.ToDouble(salary);
                double dueSal   = totalSal - curPayment;
                textBox2.Text = dueSal.ToString();
            }
            else if (s[0] == "Active")
            {
                label12.Text = "Active";
                string activeDate = s[1].ToString();

                DateTime       jdate          = Convert.ToDateTime(activeDate);
                DateTime       currentdate    = DateTime.Now;
                DateDifference dateDifference = new DateDifference(jdate, currentdate);

                string   DiffDate = dateDifference.ToString();
                string[] sDD      = DiffDate.Split('/');
                int      yy       = Convert.ToInt32(sDD[0]);
                int      mm       = Convert.ToInt32(sDD[1]);
                int      dd       = Convert.ToInt32(sDD[2]);
                //if (dd != 0)
                //{
                //    mm += 1;
                //}
                int totalMonth = (yy * 12) + mm;
                textBox8.Text = totalMonth.ToString();

                double totalSal = totalMonth * Convert.ToDouble(salary);
                double dueSal   = totalSal - curPayment;
                textBox2.Text = dueSal.ToString();
            }
            else
            {
                MessageBox.Show("Error to receive data.try again..........", "warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void fillData()
        {
            DataTable lDtHistorialMedico = new DataTable();

            ControlDePacientes.Dal.Paciente lPaciente = new Paciente();

            lDtHistorialMedico = lPaciente.GetPacienteByRegistroMedico(txtIdPaciente.Text);

            if (lDtHistorialMedico.Rows.Count > 0)
            {
                txtIdPaciente.IsEnabled     = false;
                txtNombrePaciente.Text      = (string)lDtHistorialMedico.Rows[0]["Nombre"];
                txtNombrePaciente.IsEnabled = false;
                if (lDtHistorialMedico.Rows[0]["Apellido"].ToString() != "" || lDtHistorialMedico.Rows[0]["SegundoApellido"].ToString() != "")
                {
                    txtApellidoPaciente.Text = (string)lDtHistorialMedico.Rows[0]["Apellido"] + " " + (string)lDtHistorialMedico.Rows[0]["SegundoApellido"];
                }
                else
                {
                    txtApellidoPaciente.Text = "";
                }
                txtApellidoPaciente.IsEnabled = false;
                if (lDtHistorialMedico.Rows[0]["SexoName"].ToString() != "")
                {
                    txtSexo.Text = (string)lDtHistorialMedico.Rows[0]["SexoName"];
                }
                else
                {
                    txtSexo.Text = "";
                }
                txtSexo.IsEnabled = false;
                //lblEdad.Content = Convert.ToString( CalcularEdad(DateTime.Parse(Convert.ToString(lDtHistorialMedico.Rows[0]["FechaNacimiento"]))));
                if (lDtHistorialMedico.Rows[0]["FechaNacimiento"].ToString() != "")
                {
                    DateDifference dateDifference =
                        new DateDifference(DateTime.Parse(Convert.ToString(lDtHistorialMedico.Rows[0]["FechaNacimiento"])),
                                           DateTime.Now.Date);
                    lblEdad.Content = dateDifference.ToString();
                }
                else
                {
                    lblEdad.Content = "";
                }

                if (lDtHistorialMedico.Rows[0]["NombrePadre"].ToString() != "")
                {
                    txtNombrePadre.Text = (string)lDtHistorialMedico.Rows[0]["NombrePadre"];
                }
                else
                {
                    txtNombrePadre.Text = "";
                }
                txtNombrePadre.IsEnabled = false;
                if (lDtHistorialMedico.Rows[0]["NombreMadre"].ToString() != "")
                {
                    txtNombreMadre.Text = (string)lDtHistorialMedico.Rows[0]["NombreMadre"];
                }
                else
                {
                    txtNombreMadre.Text = "";
                }
                txtNombreMadre.IsEnabled = false;
                if (lDtHistorialMedico.Rows[0]["Direccion"].ToString() != "")
                {
                    txtDireccion.Text = (string)lDtHistorialMedico.Rows[0]["Direccion"]; //unir con municipio y departamento
                }
                else
                {
                    txtDireccion.Text = "";
                }
                txtDireccion.IsEnabled = false;
                if (lDtHistorialMedico.Rows[0]["FotoPath"] == DBNull.Value || (string)lDtHistorialMedico.Rows[0]["FotoPath"] == "")
                {
                }
                else
                {
                    ControlOperation.LoadImageFromDB((byte[])lDtHistorialMedico.Rows[0]["FotoPaciente"], imgPaciente);
                }

                expDetalle.IsEnabled  = true;
                expDetalle.IsExpanded = true;
                wrpButtons.Visibility = Visibility.Visible;
            }
        }