Beispiel #1
0
        internal List <PROFESIONAL> GetProfesionales()
        {
            IDataReader        dr     = null;
            List <PROFESIONAL> oLista = new List <PROFESIONAL>();

            try
            {
                SqlParameter[] dbparams = new SqlParameter[0] {
                };

                dr = cDblib.DataReader("SUP_CARGAFICHEROIAP_VALIDAR_PROFESIONALES", dbparams);
                while (dr.Read())
                {
                    PROFESIONAL oP = new PROFESIONAL((int)dr["t001_idficepi"],
                                                     (int)dr["t314_idusuario"],
                                                     dr["Profesional"].ToString(),
                                                     (dr["t303_ultcierreIAP"].ToString() == "") ? null : (int?)dr["t303_ultcierreIAP"],
                                                     bool.Parse(dr["t314_jornadareducida"].ToString()),
                                                     (dr["t303_idnodo"].ToString() == "") ? null : (int?)dr["t303_idnodo"],
                                                     double.Parse(dr["t314_horasjor_red"].ToString()),
                                                     (dr["t314_fdesde_red"].ToString() == "") ? null : (DateTime?)DateTime.Parse(dr["t314_fdesde_red"].ToString()),
                                                     (dr["t314_fhasta_red"].ToString() == "") ? null : (DateTime?)DateTime.Parse(dr["t314_fhasta_red"].ToString()),
                                                     bool.Parse(dr["t314_controlhuecos"].ToString()),
                                                     null,
                                                     (int)dr["t066_idcal"],
                                                     dr["t066_descal"].ToString(),
                                                     dr["t066_semlabL"].ToString() + "," + dr["t066_semlabM"].ToString() + "," + dr["t066_semlabX"].ToString() + "," + dr["t066_semlabJ"].ToString() + "," + dr["t066_semlabV"].ToString() + "," + dr["t066_semlabS"].ToString() + "," + dr["t066_semlabD"].ToString(),
                                                     dr["t001_codred"].ToString(),
                                                     (dr["T001_FECALTA"].ToString() == "") ? null : (DateTime?)DateTime.Parse(dr["T001_FECALTA"].ToString()),
                                                     (dr["T001_FECBAJA"].ToString() == "") ? null : (DateTime?)DateTime.Parse(dr["T001_FECBAJA"].ToString())
                                                     );
                    oLista.Add(oP);
                }
                return(oLista);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dr != null)
                {
                    if (!dr.IsClosed)
                    {
                        dr.Close();
                    }
                    dr.Dispose();
                }
            }
        }
Beispiel #2
0
        //Metodo para agregar profesional
        public bool AgregarProfesional()
        {
            try
            {
                PROFESIONAL pro = new PROFESIONAL();
                CREDENCIAL  cre = new CREDENCIAL();

                /*pro.RUT_PROFESIONAL = this.Rut_profesional;
                 * pro.NOMBRE = this.Nombre;
                 * pro.AP_PAT = this.Ap_pat;
                 * pro.AP_MAT = this.Ap_mat;
                 * pro.FEC_NACIMIENTO = this.Fec_nacimiento;
                 * string result;
                 * result = Convert.ToString(pro.FEC_NACIMIENTO);
                 *
                 * pro.TELEFONO = this.Telefono;
                 * pro.DIRECCION = this.Direccion;
                 * pro.CORREO = this.Correo;
                 * pro.ID_GENERO = this.Id_genero;
                 * pro.ID_COMUNA = this.Id_comuna;*/

                //pro.FEC_NACIMIENTO = Convert.ToDateTime(pro.FEC_NACIMIENTO.ToString("MM/dd/yyyy"));


                //pro.FEC_NACIMIENTO = DateTime.Parse(this._fec_nacimiento);

                var o_result = new System.Data.Objects.ObjectParameter("O_RESULT", typeof(string));
                //conexion.Entidades.SP_INSERT_PROFESIONAL("12096458-81", "Juanpi", "Adame", "Rivas", "21-09-2020", 123344, "adasd", "adasdas", 1, 13114, "adasd1asdaaaa", "adaasd",o_result);
                conexion.Entidades.SP_INSERT_PROFESIONAL(pro.RUT_PROFESIONAL, pro.NOMBRE, pro.AP_PAT, pro.AP_MAT, pro.FEC_NACIMIENTO.ToString(), pro.TELEFONO, pro.DIRECCION, pro.CORREO, pro.ID_GENERO, pro.ID_COMUNA, cre.USER_CRED, cre.PASSWORD, o_result);

                conexion.Entidades.SaveChanges();
                o_result.ToString();

                return(true);
            }
            catch (Exception es)
            {
                return(false);
            }
        }
Beispiel #3
0
    private static DesdeFicheroIAP getLinea(DesdeFicheroIAP oDesdeFicheroIAP, string sEstructu,
                                            Hashtable htTarea, Hashtable htProfesional)
    {
        TAREA       oTarea       = null;
        PROFESIONAL oProfesional = null;

        char[] chrs  = { '+', '-', ',', '.' };
        char[] chrs2 = { '+', '-', '.' };

        int idx = 0;

        oTarea = (TAREA)htTarea[oDesdeFicheroIAP.idtarea];
        if (oTarea != null)
        {
            oDesdeFicheroIAP.t332_destarea = oTarea.t332_destarea;
        }

        oProfesional = (PROFESIONAL)htProfesional[oDesdeFicheroIAP.idusuario];
        if (oProfesional != null)
        {
            oDesdeFicheroIAP.Profesional = oProfesional.Profesional;
        }

        if (Utilidades.isNumeric(oDesdeFicheroIAP.idusuario))
        {
            idx = oDesdeFicheroIAP.idusuario.IndexOfAny(chrs);
            if (idx == -1)
            {
                oDesdeFicheroIAP.t314_idusuario = System.Convert.ToInt32(oDesdeFicheroIAP.idusuario);
            }
            else
            {
                oDesdeFicheroIAP.t314_idusuario = -99999;
            }
        }
        else
        {
            oDesdeFicheroIAP.t314_idusuario = -1;
        }

        if (Utilidades.isNumeric(oDesdeFicheroIAP.idtarea))
        {
            idx = oDesdeFicheroIAP.idtarea.IndexOfAny(chrs);
            if (idx == -1)
            {
                oDesdeFicheroIAP.t332_idtarea = System.Convert.ToInt32(oDesdeFicheroIAP.idtarea);
            }
            else
            {
                oDesdeFicheroIAP.t332_idtarea = -99999;
            }
        }
        else
        {
            oDesdeFicheroIAP.t332_idtarea = -1;
        }

        if (oDesdeFicheroIAP.fechaDesde.Length == 10)
        {
            if (Utilidades.isDate(oDesdeFicheroIAP.fechaDesde))
            {
                oDesdeFicheroIAP.t337_fechaDesde = DateTime.Parse(oDesdeFicheroIAP.fechaDesde);
                if (
                    (!Utilidades.isNumeric(oDesdeFicheroIAP.fechaDesde.ToString().Substring(0, 2)))
                    ||
                    (!Utilidades.isNumeric(oDesdeFicheroIAP.fechaDesde.ToString().Substring(3, 2)))
                    ||
                    (!Utilidades.isNumeric(oDesdeFicheroIAP.fechaDesde.ToString().Substring(6, 4)))
                    )
                {
                    oDesdeFicheroIAP.t337_fechaDesde = null;
                }
            }
            else
            {
                oDesdeFicheroIAP.t337_fechaDesde = null;
            }
        }
        else
        {
            oDesdeFicheroIAP.t337_fechaDesde = null;
        }
        if (Utilidades.isNumeric(oDesdeFicheroIAP.esfuerzo))
        {
            idx = oDesdeFicheroIAP.esfuerzo.IndexOfAny(chrs2);
            if (idx == -1)
            {
                oDesdeFicheroIAP.t337_esfuerzo = Double.Parse(oDesdeFicheroIAP.esfuerzo);
            }
            else
            {
                oDesdeFicheroIAP.t337_esfuerzo = -99999;
            }
        }
        else
        {
            oDesdeFicheroIAP.t337_esfuerzo = -1;
        }

        //if (Request.Form[Constantes.sPrefijo + "rdbImputacion"].ToString() != "D")
        if (sEstructu != "D")
        {
            if (oDesdeFicheroIAP.fechaHasta.Length == 10)
            {
                if (Utilidades.isDate(oDesdeFicheroIAP.fechaHasta))
                {
                    oDesdeFicheroIAP.t337_fechaHasta = DateTime.Parse(oDesdeFicheroIAP.fechaHasta);
                    if (
                        (!Utilidades.isNumeric(oDesdeFicheroIAP.fechaHasta.ToString().Substring(0, 2)))
                        ||
                        (!Utilidades.isNumeric(oDesdeFicheroIAP.fechaHasta.ToString().Substring(3, 2)))
                        ||
                        (!Utilidades.isNumeric(oDesdeFicheroIAP.fechaHasta.ToString().Substring(6, 4)))
                        )
                    {
                        oDesdeFicheroIAP.t337_fechaHasta = null;
                    }
                    else if (oDesdeFicheroIAP.t337_fechaDesde > oDesdeFicheroIAP.t337_fechaHasta)
                    {
                        oDesdeFicheroIAP.t337_fechaHasta = null;
                    }
                }
                else
                {
                    oDesdeFicheroIAP.t337_fechaHasta = null;
                }
            }
            else
            {
                oDesdeFicheroIAP.t337_fechaHasta = null;
            }

            if (Utilidades.isNumeric(oDesdeFicheroIAP.festivos))
            {
                if (oDesdeFicheroIAP.festivos == "1")
                {
                    oDesdeFicheroIAP.bfestivos = true;
                }
                else if (oDesdeFicheroIAP.festivos == "0")
                {
                    oDesdeFicheroIAP.bfestivos = false;
                }
                else
                {
                    oDesdeFicheroIAP.bfestivos = null;
                }
            }
            else
            {
                oDesdeFicheroIAP.bfestivos = null;
            }
        }

        return(oDesdeFicheroIAP);
    }
Beispiel #4
0
        //Metodo para buscar Profesional
        public CL_Profesional BuscarProfesionales()
        {
            try
            {
                PROFESIONAL usu = new PROFESIONAL();
                usu = conexion.Entidades.PROFESIONAL.First(x => x.RUT_PROFESIONAL == this.Rut_profesional);//aca carga los datos que ya no debian existir
                CL_Profesional pro = new CL_Profesional();
                try
                {
                    pro.Rut_profesional = usu.RUT_PROFESIONAL;
                }
                catch (Exception)
                {
                    pro.Rut_profesional = "";
                }

                try
                {
                    pro.Nombre = usu.NOMBRE;
                }
                catch (Exception)
                {
                    pro.Nombre = "";
                }
                try
                {
                    pro.Ap_pat = usu.AP_PAT;
                }
                catch (Exception)
                {
                    pro.Ap_pat = "";
                }
                try
                {
                    pro.Ap_mat = usu.AP_MAT;
                }
                catch (Exception)
                {
                    pro.Ap_mat = "";
                }

                try
                {
                    pro.Fec_nacimiento = usu.FEC_NACIMIENTO;
                }
                catch (Exception)
                {
                    pro.Fec_nacimiento = System.DateTime.Now;
                }
                try
                {
                    pro.Telefono = int.Parse(usu.TELEFONO.ToString());
                }
                catch (Exception)
                {
                    pro.Ap_pat = "";
                }
                try
                {
                    pro.Direccion = usu.DIRECCION;
                }
                catch (Exception)
                {
                    pro.Direccion = "";
                }
                try
                {
                    pro.Correo = usu.CORREO;
                }
                catch (Exception)
                {
                    pro.Correo = "";
                }
                try
                {
                    pro.Id_genero = int.Parse(usu.ID_GENERO.ToString());
                }
                catch (Exception)
                {
                    pro.Id_genero = 1;
                }
                try
                {
                    pro.Id_comuna = int.Parse(usu.ID_COMUNA.ToString());
                }
                catch (Exception)
                {
                    pro.Ap_pat = "";
                }



                return(pro);
            }
            catch (Exception)
            {
                return(null);
            }
        }