示例#1
0
 public static FRM_ASIGNACION_SALA_REGISTRAR Get_instacnias()
 {
     if (Instancia == null)
     {
         Instancia = new FRM_ASIGNACION_SALA_REGISTRAR();
     }
     return(Instancia);
 }
示例#2
0
 private void btnCANCELAR_Click(object sender, EventArgs e)
 {
     if (Program.isnuevo_ASIGNACION_SALA == true)
     {
         Program.isnuevo_ASIGNACION_SALA = false;
     }
     if (Program.Consultar_ASIGNACION_SALA == true)
     {
         Program.Consultar_ASIGNACION_SALA = false;
     }
     Instancia = null;
     Close();
 }
        public void Datos_Consultar_AsignacionSala()
        {
            try
            {
                DataTable codigo = Capa_Negocio.N_ASIGNACION_SALA.CONSULTAR(Convert.ToInt32(dgvLista.CurrentRow.Cells[0].Value.ToString()));
                if (codigo.Rows.Count == 0)
                {
                    //  MessageBox.Show("ERROR perro", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MessageBox.Show("PORFAVOR ASIGNE PRIMERO UNA SALA A LA < INTERNACION >", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    FRM_ASIGNACION_SALA_REGISTRAR frm = FRM_ASIGNACION_SALA_REGISTRAR.Get_instacnias();
                    string codigoAsignacion           = codigo.Rows[0][3].ToString();//codi
                    //string nom = codigo.Rows[0][1].ToString();//nombre
                    string codigoPaciente    = codigo.Rows[0][1].ToString();
                    string nombrepaciente    = codigo.Rows[0][2].ToString(); //obse
                    string CodigoInternacion = codigo.Rows[0][0].ToString(); //
                    string fecha             = codigo.Rows[0][4].ToString();
                    string codigoSala        = codigo.Rows[0][5].ToString();
                    string sala = codigo.Rows[0][6].ToString();
                    //string codiTipo = codigo.Rows[0][4].ToString();

                    frm.txtcodigoInternacion.Text = CodigoInternacion.ToString();
                    frm.txtPaciente.Text          = nombrepaciente.ToString();
                    frm.lblCodigoSala.Text        = codigoSala.ToString();
                    frm.txtNombreSala.Text        = sala.ToString();

                    //if (codigo.Rows[0]["ESTADO"].ToString() == "D")
                    //{
                    //    string habilitado = "Habilitado";
                    //    frm.cbESTADO.Text = habilitado.ToString();
                    //}
                    //else
                    //{
                    //    string Deshabilitado = "Deshabilitado";
                    //    frm.cbESTADO.Text = Deshabilitado;
                    //}
                    if (Program.isnuevo_ASIGNACION_SALA == true)
                    {
                        // frm.btnNUEVO.Visible = true;
                        // frm.btnEDITAR.Visible = true;
                        frm.btnACEPTAR.Enabled  = true;
                        frm.btnCANCELAR.Enabled = true;
                    }
                    else if (Program.ismodificar_ASIGNACION_SALA == true)
                    {
                        //frm.cbESTADO.Enabled = false;
                        //frm.lblestado.Visible = true;
                        //frm.btnACEPTAR.Enabled = true;
                        //frm.btnCANCELAR.Enabled = true;
                        //if (codigo.Rows[0]["ESTADO"].ToString() == "H")
                        //{
                        //    string habilitado = "Habilitado";
                        //    frm.cbESTADO.Text = habilitado.ToString();
                        //}
                        //else
                        //{
                        //    string Deshabilitado = "Deshabilitado";
                        //    frm.cbESTADO.Text = Deshabilitado;
                        //}
                    }
                    else
                    {
                        if (Program.Cambio_Estado_ASIGNACION_SALA == true)
                        {
                            //frm.btnACEPTAR.Enabled = true;
                            //frm.btnCANCELAR.Enabled = true;
                            //frm.groupBoxDATOS.Enabled = true;
                            //frm.cbESTADO.Enabled = false;
                            //frm.txtCODIGO.Enabled = false;
                            //frm.txtNOMBRE.Enabled = false;
                            //frm.txtobservacion.Enabled = false;
                            //frm.cbESTADO.Focus();
                            //string Deshabilitado = "Deshabilitado";
                            //string habilitado = "Habilitado";
                            //if (codigo.Rows[0]["ESTADO"].ToString() == "D")
                            //{
                            //    frm.cbESTADO.Text = habilitado;
                            //}
                            //else
                            //{
                            //    frm.cbESTADO.Text = Deshabilitado;
                            //}
                        }
                        else if (Program.Consultar_ASIGNACION_SALA == true)
                        {
                            //frm.txtNOMBRE.Enabled = false;
                            //frm.txtobservacion.Enabled = false;
                            //frm.cbESTADO.Enabled = false;
                            //frm.btnACEPTAR.Visible = false;
                            frm.txtcodigoInternacion.Enabled  = false;
                            frm.txtPaciente.Enabled           = false;
                            frm.txtNombreSala.Enabled         = false;
                            frm.comboBox1.Enabled             = false;
                            frm.dtFechaAsignacionSala.Enabled = false;
                            frm.btnACEPTAR.Visible            = false;
                            if (codigo.Rows[0][7].ToString() == "H")
                            {
                                string habilitado = "Habilitado";
                                frm.comboBox1.Text = habilitado.ToString();
                            }
                            else
                            {
                                string Deshabilitado = "Deshabilitado";
                                frm.comboBox1.Text = Deshabilitado;
                            }
                        }
                        else if (Program.Eliminar_ASIGNACION_SALA == true)
                        {
                            //if (codigo.Rows[0][3].ToString() == "H")
                            //{
                            //    string habilitado = "Habilitado";
                            //    frm.cbESTADO.Text = habilitado.ToString();
                            //}
                            //else
                            //{
                            //    string Deshabilitado = "Deshabilitado";
                            //    frm.cbESTADO.Text = Deshabilitado;
                            //}
                        }
                        else
                        {
                            frm.btnACEPTAR.Enabled  = false;
                            frm.btnCANCELAR.Enabled = false;
                        }
                    }

                    frm.ShowDialog();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("No hay ningun dato");
            }
        }
        public void Datos()
        {
            try
            {
                DataTable codigo = Capa_Negocio.N_ASIGNACION_SALA.Consultar_codigo(Convert.ToInt32(this.dgvLista.CurrentRow.Cells["CODIGO"].Value.ToString()));
                if (codigo.Rows.Count == 0)
                {
                    MessageBox.Show("ERROR", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    FRM_ASIGNACION_SALA_REGISTRAR frm = FRM_ASIGNACION_SALA_REGISTRAR.Get_instacnias();


                    string co = codigo.Rows[0][0].ToString();     //codi
                    //string nom = codigo.Rows[0][1].ToString();//nombre
                    string nombre = codigo.Rows[0][2].ToString(); //obse
                                                                  //string nombreTipo = codigo.Rows[0]["TIPO SALA"].ToString();//
                                                                  //string codiTipo = codigo.Rows[0][4].ToString();

                    frm.txtcodigoInternacion.Text = co.Trim();
                    frm.txtPaciente.Text          = nombre.Trim();

                    //if (codigo.Rows[0]["ESTADO"].ToString() == "D")
                    //{
                    //    string habilitado = "Habilitado";
                    //    frm.cbESTADO.Text = habilitado.ToString();
                    //}
                    //else
                    //{
                    //    string Deshabilitado = "Deshabilitado";
                    //    frm.cbESTADO.Text = Deshabilitado;
                    //}
                    if (Program.isnuevo_ASIGNACION_SALA == true)
                    {
                        // frm.btnNUEVO.Visible = true;
                        // frm.btnEDITAR.Visible = true;
                        frm.btnACEPTAR.Enabled  = true;
                        frm.btnCANCELAR.Enabled = true;
                    }
                    else if (Program.ismodificar_ASIGNACION_SALA == true)
                    {
                        //frm.cbESTADO.Enabled = false;
                        //frm.lblestado.Visible = true;
                        //frm.btnACEPTAR.Enabled = true;
                        //frm.btnCANCELAR.Enabled = true;
                        //if (codigo.Rows[0]["ESTADO"].ToString() == "H")
                        //{
                        //    string habilitado = "Habilitado";
                        //    frm.cbESTADO.Text = habilitado.ToString();
                        //}
                        //else
                        //{
                        //    string Deshabilitado = "Deshabilitado";
                        //    frm.cbESTADO.Text = Deshabilitado;
                        //}
                    }
                    else
                    {
                        if (Program.Cambio_Estado_ASIGNACION_SALA == true)
                        {
                            //frm.btnACEPTAR.Enabled = true;
                            //frm.btnCANCELAR.Enabled = true;
                            //frm.groupBoxDATOS.Enabled = true;
                            //frm.cbESTADO.Enabled = false;
                            //frm.txtCODIGO.Enabled = false;
                            //frm.txtNOMBRE.Enabled = false;
                            //frm.txtobservacion.Enabled = false;
                            //frm.cbESTADO.Focus();
                            //string Deshabilitado = "Deshabilitado";
                            //string habilitado = "Habilitado";
                            //if (codigo.Rows[0]["ESTADO"].ToString() == "D")
                            //{
                            //    frm.cbESTADO.Text = habilitado;
                            //}
                            //else
                            //{
                            //    frm.cbESTADO.Text = Deshabilitado;
                            //}
                        }
                        else if (Program.Consultar_ASIGNACION_SALA == true)
                        {
                            //frm.txtNOMBRE.Enabled = false;
                            //frm.txtobservacion.Enabled = false;
                            //frm.cbESTADO.Enabled = false;
                            //frm.btnACEPTAR.Visible = false;
                            //if (codigo.Rows[0]["ESTADO"].ToString() == "H")
                            //{
                            //    string habilitado = "Habilitado";
                            //    frm.cbESTADO.Text = habilitado.ToString();
                            //}
                            //else
                            //{
                            //    string Deshabilitado = "Deshabilitado";
                            //    frm.cbESTADO.Text = Deshabilitado;
                            //}
                        }
                        else if (Program.Eliminar_ASIGNACION_SALA == true)
                        {
                            //if (codigo.Rows[0][3].ToString() == "H")
                            //{
                            //    string habilitado = "Habilitado";
                            //    frm.cbESTADO.Text = habilitado.ToString();
                            //}
                            //else
                            //{
                            //    string Deshabilitado = "Deshabilitado";
                            //    frm.cbESTADO.Text = Deshabilitado;
                            //}
                        }
                        else
                        {
                            frm.btnACEPTAR.Enabled  = false;
                            frm.btnCANCELAR.Enabled = false;
                        }
                    }

                    frm.ShowDialog();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("No hay ningun dato");
            }
        }