示例#1
0
 public void DA_Registrar_SOLICITUD(VT_Solicitud a)
 {
     try
     {
         using (SqlConnection conexion = new SqlConnection(conexionString))
         {
             SqlCommand cmd = new SqlCommand("VT_SOLICITUD_INSERT", conexion);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Id_Solicitud", a.Id_Solicitud);
             cmd.Parameters.AddWithValue("@Id_Regional", a.Id_Regional);
             cmd.Parameters.AddWithValue("@Id_Usuario", a.Id_Usuario);
             cmd.Parameters.AddWithValue("@Tipo_Salida", a.Tipo_Salida);
             cmd.Parameters.AddWithValue("@Tipo_Solicitud", a.Tipo_Solicitud);
             cmd.Parameters.AddWithValue("@Dep_Salida", a.Dep_Salida);
             cmd.Parameters.AddWithValue("@Cargo", a.Cargo);
             cmd.Parameters.AddWithValue("@ci_Aprobador", a.ci_Aprobador);
             cmd.Parameters.AddWithValue("@Cargo_Aprobador", a.Cargo_Aprobador);
             cmd.Parameters.AddWithValue("@Fecha_Solicitud", a.Fecha_Solicitud);
             cmd.Parameters.AddWithValue("@Fecha_Aprob", a.Fecha_Aprob);
             cmd.Parameters.AddWithValue("@Motivo_Viaje", a.Motivo_Viaje);
             cmd.Parameters.AddWithValue("@Descrip_Motivo", a.Descrip_Motivo);
             cmd.Parameters.AddWithValue("@Tipo_Viaje", a.Tipo_Viaje);
             cmd.Parameters.AddWithValue("@Estado", a.Estado);
             conexion.Open();
             cmd.ExecuteNonQuery();
             conexion.Close();
         }
     }
     catch (Exception err)
     {
         throw (new Exception(err.ToString() + "-" + err.Source.ToString() + "-" + err.Message.ToString()));
     }
 }
示例#2
0
 public void DA_Modificar_SOLICITUD(VT_Solicitud s)
 {
     try
     {
         using (SqlConnection conexion = new SqlConnection(conexionString))
         {
             SqlCommand cmd = new SqlCommand("VT_SOLICITUD_UPDATE", conexion);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Id_Solicitud", s.Id_Solicitud);
             cmd.Parameters.AddWithValue("@Tipo_Viaje", s.Tipo_Viaje);
             cmd.Parameters.AddWithValue("@Motivo_Viaje", s.Motivo_Viaje);
             conexion.Open();
             cmd.ExecuteNonQuery();
             conexion.Close();
         }
     }
     catch (Exception err)
     {
         throw (new Exception(err.ToString() + "-" + err.Source.ToString() + "-" + err.Message.ToString()));
     }
 }
        protected void Registrar_SOLICITUD()
        {
            /*************** CODIGO DE USIARIO DE LA BASE DE DATOS PRODUCCION ***************/
            DB_AP_Registro_Org Usuario = new DB_AP_Registro_Org();
            DataTable          dt      = new DataTable();

            dt = Usuario.DB_Desplegar_USUARIO(LblIdUser.Text);
            /*************** INMEDIATO SUPERIOR *************/
            DB_Usuario us   = new DB_Usuario();
            DataTable  dtus = new DataTable();

            dtus = us.DB_Desplegar_USUARIO(0, LblIdUser.Text, "INMEDIATOSUPERIOR");
            /************* CONTRUCCION DE CODIFICACION **************/
            DB_Codificacion cod = new DB_Codificacion();

            LblIdSolicitud.Text = cod.GetCodigo(Convert.ToInt32(dt.Rows[0][4].ToString()), "VIATICOS");
            DB_VT_Viaticos rs = new DB_VT_Viaticos();
            VT_Solicitud   s  = new VT_Solicitud();

            s.Id_Solicitud    = LblIdSolicitud.Text;
            s.Id_Regional     = Convert.ToInt32(dt.Rows[0][4].ToString());
            s.Id_Usuario      = LblIdUser.Text;
            s.Tipo_Salida     = DDLTipSalid.SelectedValue;
            s.Tipo_Solicitud  = DDLTipSol.SelectedValue;
            s.Dep_Salida      = DDLDepart.SelectedValue;
            s.Cargo           = dt.Rows[0][3].ToString();
            s.ci_Aprobador    = dtus.Rows[0][4].ToString();
            s.Cargo_Aprobador = dtus.Rows[0][6].ToString();
            s.Fecha_Solicitud = DateTime.Now;
            s.Fecha_Aprob     = DateTime.Now;
            s.Motivo_Viaje    = TxtMotiv.Text;
            s.Descrip_Motivo  = "";
            s.Tipo_Viaje      = DDLTipViaje.SelectedValue;
            s.Estado          = "ENVIADO";
            rs.DB_Registrar_SOLICITUD(s);
            Registrar_SOLICITUD_DESTINO();
        }
示例#4
0
        public void DB_Registrar_SOLICITUD(VT_Solicitud a)
        {
            DA_VT_Viaticos Inscripcion = new DA_VT_Viaticos();

            Inscripcion.DA_Registrar_SOLICITUD(a);
        }
示例#5
0
        protected void BtnModificar_Click(object sender, EventArgs e)
        {
            try
            {
                //*ini*lrojas:05092016 validacion fecha retorno
                DB_VT_Solicitud            sol   = new DB_VT_Solicitud();
                List <VT_SolicitudDestino> ColSD = new List <VT_SolicitudDestino>();
                foreach (GridViewRow dgi in GVSolicitud.Rows)
                {
                    VT_SolicitudDestino Objsd                     = new VT_SolicitudDestino();
                    DropDownList        ddlZona                   = (DropDownList)dgi.Cells[3].Controls[1];
                    DropDownList        ddlDestino                = (DropDownList)dgi.Cells[4].Controls[1];
                    TextBox             txLugar                   = (TextBox)dgi.Cells[5].Controls[1];
                    TextBox             txObjetivo                = (TextBox)dgi.Cells[6].Controls[1];
                    TextBox             tx2                       = (TextBox)dgi.Cells[7].Controls[1];
                    DropDownList        ddlHora                   = (DropDownList)dgi.Cells[8].Controls[1];
                    DropDownList        ddlMin                    = (DropDownList)dgi.Cells[9].Controls[1];
                    DropDownList        ddlVia_Transporte         = (DropDownList)dgi.Cells[10].Controls[1];
                    DropDownList        ddlTipo_Transporte        = (DropDownList)dgi.Cells[11].Controls[1];
                    TextBox             txNombre_Transporte       = (TextBox)dgi.Cells[12].Controls[1];
                    TextBox             txIdentificador_Trasporte = (TextBox)dgi.Cells[13].Controls[1];
                    Objsd.Id_Solicitud            = LblIdSolicitud.Text;
                    Objsd.Cont                    = Convert.ToInt32(GVSolicitud.DataKeys[dgi.RowIndex].Values[0]);
                    Objsd.Tramo                   = dgi.Cells[2].Text;
                    Objsd.Zona                    = ddlZona.SelectedValue;
                    Objsd.Destino                 = ddlDestino.SelectedValue;
                    Objsd.Lugar                   = txLugar.Text;
                    Objsd.Objetivo                = txObjetivo.Text;
                    Objsd.Fecha_Salida            = Convert.ToDateTime(tx2.Text + " " + ddlHora.SelectedValue + ":" + ddlMin.SelectedValue);
                    Objsd.Via_Transporte          = ddlVia_Transporte.SelectedValue;
                    Objsd.Tipo_Transporte         = ddlTipo_Transporte.SelectedValue;
                    Objsd.Nombre_Transporte       = txNombre_Transporte.Text;
                    Objsd.Identificador_Trasporte = txIdentificador_Trasporte.Text;
                    ColSD.Add(Objsd);
                }

                if (ColSD.Count > 1)
                {
                    DateTime datetime1 = ColSD.Where(x => x.Tramo == "Salida" && x.Cont > 0).ToList().OrderByDescending(ord => ord.Fecha_Salida).ToList().FirstOrDefault().Fecha_Salida;
                    DateTime datetime2 = ColSD.Where(x => x.Tramo == "Retorno").ToList().OrderByDescending(ord => ord.Fecha_Salida).ToList().FirstOrDefault().Fecha_Salida;

                    //TimeSpan ts = datetime2 - datetime1;
                    //int tday = datetime2.Day - datetime1.Day;
                    TimeSpan ts   = Convert.ToDateTime(datetime2.ToShortDateString()) - Convert.ToDateTime(datetime1.ToShortDateString());
                    int      tday = ts.Days;

                    if (tday < 0)
                    {
                        string scriptf = @"<script type='text/javascript'>alert('{0}');</script>";
                        scriptf = string.Format(scriptf, "Observación en la fecha de Retorno a " + datetime1.ToShortDateString());
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", scriptf, false);
                        return;
                    }
                    int tHour = datetime2.Hour - datetime1.Hour;
                    if (tHour <= 0 && tday <= 0)
                    {
                        string scripth = @"<script type='text/javascript'>alert('{0}');</script>";
                        scripth = string.Format(scripth, "La HORA de Retorno debe ser mayor a " + datetime1.Hour + ":" + datetime1.Minute);
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", scripth, false);
                        return;
                    }
                }

                //*fin*

                //DB_VT_Solicitud sol = new DB_VT_Solicitud();
                VT_Solicitud        s  = new VT_Solicitud();
                VT_SolicitudDestino sd = new VT_SolicitudDestino();
                s.Id_Solicitud = LblIdSolicitud.Text;
                s.Tipo_Viaje   = DDLTipViaje.SelectedValue;
                s.Motivo_Viaje = TxtMotiv.Text;
                sol.DB_Modificar_SOLICITUD(s);
                foreach (GridViewRow dgi in GVSolicitud.Rows)
                {
                    DropDownList ddlZona                   = (DropDownList)dgi.Cells[3].Controls[1];
                    DropDownList ddlDestino                = (DropDownList)dgi.Cells[4].Controls[1];
                    TextBox      txLugar                   = (TextBox)dgi.Cells[5].Controls[1];
                    TextBox      txObjetivo                = (TextBox)dgi.Cells[6].Controls[1];
                    TextBox      tx2                       = (TextBox)dgi.Cells[7].Controls[1];
                    DropDownList ddlHora                   = (DropDownList)dgi.Cells[8].Controls[1];
                    DropDownList ddlMin                    = (DropDownList)dgi.Cells[9].Controls[1];
                    DropDownList ddlVia_Transporte         = (DropDownList)dgi.Cells[10].Controls[1];
                    DropDownList ddlTipo_Transporte        = (DropDownList)dgi.Cells[11].Controls[1];
                    TextBox      txNombre_Transporte       = (TextBox)dgi.Cells[12].Controls[1];
                    TextBox      txIdentificador_Trasporte = (TextBox)dgi.Cells[13].Controls[1];

                    sd.Id_Solicitud            = LblIdSolicitud.Text;
                    sd.Cont                    = Convert.ToInt32(GVSolicitud.DataKeys[dgi.RowIndex].Values[0]);
                    sd.Zona                    = ddlZona.SelectedValue;
                    sd.Destino                 = ddlDestino.SelectedValue;
                    sd.Lugar                   = txLugar.Text;
                    sd.Objetivo                = txObjetivo.Text;
                    sd.Fecha_Salida            = Convert.ToDateTime(tx2.Text + " " + ddlHora.SelectedValue + ":" + ddlMin.SelectedValue);
                    sd.Via_Transporte          = ddlVia_Transporte.SelectedValue;
                    sd.Tipo_Transporte         = ddlTipo_Transporte.SelectedValue;
                    sd.Nombre_Transporte       = txNombre_Transporte.Text;
                    sd.Identificador_Trasporte = txIdentificador_Trasporte.Text;
                    sol.DB_Modificar_SOLICITUD_DESTINO(sd);
                }
                if (LblEstado.Text == "OBSERVADO")
                {
                    sol.DB_Cambiar_ESTADO(LblIdSolicitud.Text, "HABILITADO");
                }
                //sol.DB_Eliminar_OBSERVACION(LblIdSolicitud.Text);
                string script = @"<script type='text/javascript'>alert('{0}');</script>";
                script = string.Format(script, "- El registro fué modificado correctamente.");
                ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
                //Response.Redirect("frmListaSolicitUs.aspx");
            }
            catch (Exception ex)
            {
                string script = @"<script type='text/javascript'>alert('{0}');</script>";
                script = string.Format(script, ex.Message);
                ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
                return;
            }
        }
示例#6
0
        public void DB_Modificar_SOLICITUD(VT_Solicitud s)
        {
            DA_VT_Solicitud dato = new DA_VT_Solicitud();

            dato.DA_Modificar_SOLICITUD(s);
        }