public int uspINS_TBL_RequerimientoSubDetalle_PDC_OBSERVA(BE_TBL_RequerimientoSubDetalle oBE)
        {
            object[] Parametros = new[] {
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.Requ_Numero, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.Reqd_CodLinea, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.Reqs_Correlativo, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_FECHA_ENVIO_OBRA, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_CODIGO_CARE, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_COMENTARIOS, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_OBSERVACION_RUTA, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_GUIA_RUTA, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_ESTADO_PROCESO, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_FECHA_SALE_OBRA, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_OBSERVACION_FILE, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_GUIA_FILE, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_HRAS_MIN, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_COSTO_HORA, tgSQLFieldType.TEXT),

                (object)UC_FormWeb.mSQLFieldOrNull(oBE.A_GUIA_INGRESO, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.A_SERIE, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.A_PLACA, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.A_GUIA_SALIDA, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.USUARIO_ATIENDE, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.FECHA_DESPACHO, tgSQLFieldType.TEXT),
            };

            return(Convert.ToInt32(new UtilCareMenor().ExecuteScalar("uspINS_TBL_RequerimientoSubDetalle_PDC_OBSERVA", Parametros)));
        }
Exemplo n.º 2
0
 public int uspINS_TBL_RequerimientoSubDetalle_PDC_OBSERVA(BE_TBL_RequerimientoSubDetalle oBE)
 {
     try
     {
         return(new DA_TBL_RequerimientoSubDetalle().uspINS_TBL_RequerimientoSubDetalle_PDC_OBSERVA(oBE));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 public DataTable uspUPD_TBL_RequerimientoSubDetalle_Alquiler(BE_TBL_RequerimientoSubDetalle oBE)
 {
     try
     {
         return(new DA_TBL_RequerimientoSubDetalle().uspUPD_TBL_RequerimientoSubDetalle_Alquiler(oBE));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
0
 public int uspINS_TBL_RequerimientoSubDetalle_AMPLIACION(BE_TBL_RequerimientoSubDetalle oBE)
 {
     try
     {
         return(new DA_TBL_RequerimientoSubDetalle().uspINS_TBL_RequerimientoSubDetalle_AMPLIACION(oBE));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public int uspINS_TBL_RequerimientoSubDetalle_PDC_AMPLIACION(BE_TBL_RequerimientoSubDetalle oBE)
        {
            object[] Parametros = new[] {
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.Requ_Numero, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.Reqd_CodLinea, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.Reqs_Correlativo, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_PDC, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_PDC_MONTO, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_PDC_MONTO_TOTAL, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_PDC_MONTO_MOVIL, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.GUID, tgSQLFieldType.TEXT),
            };

            return(Convert.ToInt32(new UtilCareMenor().ExecuteScalar("uspINS_TBL_RequerimientoSubDetalle_PDC_AMPLIACION", Parametros)));
        }
        public DataTable uspUPD_TBL_RequerimientoSubDetalle_Alquiler(BE_TBL_RequerimientoSubDetalle oBE)
        {
            object[] Parametros = new[] {
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.Requ_Numero, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.Reqd_CodLinea, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.Reqs_Correlativo, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_DOCUMENTO_TIPO, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_DOCUMENTO_RUTA, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_DOCUMENTO_FILE, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_DOC_MOVILIZACION, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_DOCUMENTO_FECHA, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_Prov_RUC, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_ATENCION_TIPO, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.TIPO_OPERACION, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_DOCUMENTO_FILENAME, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.TIPO_FILE, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_ATENCION_COMENTARIOS, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_FLG_OPERARIO, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.COD_GUID, tgSQLFieldType.TEXT),
                (object)UC_FormWeb.mSQLFieldOrNull(oBE.D_FECHA_SALE_OBRA, tgSQLFieldType.TEXT),
            };

            return(new UtilCareMenor().EjecutaDatatable("uspUPD_TBL_RequerimientoSubDetalle_Alquiler", Parametros));
        }
Exemplo n.º 7
0
    int cargar(FileUpload FileUpload1, string TipoArchivo, string g, string Requ_Numero, string Reqd_CodLinea, string Reqs_Correlativo)
    {
        FileUpload1 = (FileUpload)Session["FileUpload1"];

        string cleanMessage = string.Empty;

        int registros = 0;


        // Si el directorio no existe, crearlo
        //if (!Directory.Exists(Server.MapPath(FolderAlquiler)))
        //    Directory.CreateDirectory(FolderAlquiler);

        String  fileExtension = string.Empty;
        Boolean fileOK        = false;
        string  fileArchivo   = string.Empty;
        string  Name          = string.Empty;

        if (FileUpload1.HasFile)
        {
            string fileName = FileUpload1.FileName.ToString();
            int    length   = FileUpload1.PostedFile.ContentLength;

            fileExtension = Path.GetExtension(FileUpload1.FileName);

            String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".txt" };
            for (int i = 0; i < allowedExtensions.Length; i++)
            {
                if (fileExtension == allowedExtensions[i])
                {
                    fileOK = true;
                }
            }
        }

        if (fileOK)
        {
            try
            {
                // Se carga la ruta física de la carpeta temp del sitio
                string ruta        = Server.MapPath(FolderAlquiler);
                string rutaBackups = FolderAlquilerBackups;
                // Si el directorio no existe, crearlo
                //if (!Directory.Exists(ruta))
                //    Directory.CreateDirectory(ruta);

                string archivo = String.Format("{0}\\{1}", ruta, FileUpload1.PostedFile.FileName);
                Name = EliminarCaracteres.ReemplazarCaracteresEspeciales(FileUpload1.PostedFile.FileName);
                // Verificar que el archivo no exista
                if (File.Exists(archivo))
                {
                    fileArchivo = EliminarCaracteres.ReemplazarCaracteresEspeciales(BL_Session.CENTRO_COSTO + "_" + TipoArchivo + "_" + DateTime.UtcNow.ToFileTimeUtc() + Path.GetExtension(FileUpload1.PostedFile.FileName));
                    FileUpload1.SaveAs(ruta + fileArchivo);
                    FileUpload1.SaveAs(rutaBackups + fileArchivo);
                }

                else
                {
                    fileArchivo = EliminarCaracteres.ReemplazarCaracteresEspeciales(BL_Session.CENTRO_COSTO + "_" + TipoArchivo + "_" + Path.GetFileName(FileUpload1.FileName));
                    //FileUpload1.SaveAs(archivo);
                    FileUpload1.SaveAs(ruta + fileArchivo);
                    FileUpload1.SaveAs(rutaBackups + fileArchivo);
                }
            }
            catch (Exception ex)
            {
                cleanMessage = "Archivo no puedo ser cargado";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            }
        }
        ////////////////////////////////



        BE_TBL_RequerimientoSubDetalle oBESol = new BE_TBL_RequerimientoSubDetalle();

        oBESol.Requ_Numero          = Requ_Numero;
        oBESol.Reqd_CodLinea        = Reqd_CodLinea;
        oBESol.Reqs_Correlativo     = Reqs_Correlativo;
        oBESol.D_DOCUMENTO_TIPO     = 0;
        oBESol.D_DOCUMENTO_RUTA     = FolderAlquiler;
        oBESol.D_DOCUMENTO_FILE     = fileArchivo;
        oBESol.D_DOC_MOVILIZACION   = 0;
        oBESol.D_DOCUMENTO_FECHA    = DateTime.Today.ToString("dd/MM/yyyy");
        oBESol.D_Prov_RUC           = "";
        oBESol.D_ATENCION_TIPO      = 0;
        oBESol.TIPO_OPERACION       = 1;
        oBESol.D_DOCUMENTO_FILENAME = Name;
        oBESol.TIPO_FILE            = TipoArchivo;
        oBESol.D_FLG_OPERARIO       = "";
        oBESol.COD_GUID             = g.ToString();
        oBESol.D_FECHA_SALE_OBRA    = "";
        DataTable dtrpta = new DataTable();

        dtrpta = new BL_TBL_RequerimientoSubDetalle().uspUPD_TBL_RequerimientoSubDetalle_Alquiler(oBESol);

        if (dtrpta.Rows.Count > 0)
        {
            registros++;
        }
        return(registros);
    }
Exemplo n.º 8
0
    protected void registroPDC()
    {
        string estado       = ddlEstado.SelectedItem.ToString();
        string cleanMessage = string.Empty;

        if (txtFechaProyecto.Text.Trim() == string.Empty && estado == "ATENDIDO TERCEROS")
        {
            cleanMessage = "Ingresar fecha de envio proyecto";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtFechaProyecto.Text.Trim() != string.Empty && estado == "ATENDIDO SSK")
        {
            cleanMessage = "Quitar fecha de envio proyecto (" + estado + ")";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else
        {
            // Si el directorio no existe, crearlo
            if (!Directory.Exists(Server.MapPath(FolderAlquiler)))
            {
                Directory.CreateDirectory(FolderAlquiler);
            }

            String  fileExtension = string.Empty;
            Boolean fileOK        = false;
            string  fileArchivo   = string.Empty;
            if (FileUploadGuia.HasFile)
            {
                string fileName = FileUploadGuia.FileName.ToString();
                int    length   = FileUploadGuia.PostedFile.ContentLength;

                fileExtension = Path.GetExtension(FileUploadGuia.FileName);

                String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".txt" };
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        fileOK = true;
                    }
                }
            }
            if (fileOK)
            {
                try
                {
                    string ruta        = Server.MapPath(FolderAlquiler);
                    string rutaBackups = FolderAlquilerBackups;
                    if (!Directory.Exists(ruta))
                    {
                        Directory.CreateDirectory(ruta);
                    }

                    string archivo = String.Format("{0}\\{1}", ruta, FileUploadGuia.PostedFile.FileName);

                    // Verificar que el archivo no exista
                    if (File.Exists(archivo))
                    {
                        fileArchivo = BL_Session.CENTRO_COSTO + "_GUIA_" + DateTime.UtcNow.ToFileTimeUtc() + Path.GetExtension(FileUploadGuia.PostedFile.FileName);
                        FileUploadGuia.SaveAs(ruta + fileArchivo);
                        FileUploadGuia.SaveAs(rutaBackups + fileArchivo);
                    }

                    else
                    {
                        fileArchivo = BL_Session.CENTRO_COSTO + "_GUIA_" + Path.GetFileName(FileUploadGuia.FileName);
                        //FileUpload1.SaveAs(archivo);
                        FileUploadGuia.SaveAs(ruta + fileArchivo);
                        FileUploadGuia.SaveAs(rutaBackups + fileArchivo);
                    }
                }
                catch (Exception ex)
                {
                    cleanMessage = "Archivo no puedo ser cargado";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                }
            }

            String  fileExtensionObserva = string.Empty;
            Boolean fileOKObserva        = false;
            string  fileArchivoObserva   = string.Empty;


            if (FileUploadObserva.HasFile)
            {
                string fileName = FileUploadObserva.FileName.ToString();
                int    length   = FileUploadObserva.PostedFile.ContentLength;

                fileExtensionObserva = Path.GetExtension(FileUploadObserva.FileName);

                String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".txt" };
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtensionObserva == allowedExtensions[i])
                    {
                        fileOKObserva = true;
                    }
                }
            }
            if (fileOKObserva)
            {
                try
                {
                    string ruta = Server.MapPath(FolderAlquiler);
                    if (!Directory.Exists(ruta))
                    {
                        Directory.CreateDirectory(ruta);
                    }

                    string archivo = String.Format("{0}\\{1}", ruta, FileUploadObserva.PostedFile.FileName);

                    // Verificar que el archivo no exista
                    if (File.Exists(archivo))
                    {
                        fileArchivoObserva = BL_Session.CENTRO_COSTO + "_OBSERVA_" + DateTime.UtcNow.ToFileTimeUtc() + Path.GetExtension(FileUploadObserva.PostedFile.FileName);
                        FileUploadObserva.SaveAs(ruta + fileArchivoObserva);
                    }

                    else
                    {
                        fileArchivoObserva = BL_Session.CENTRO_COSTO + "_OBSERVA_" + Path.GetFileName(FileUploadObserva.FileName);
                        //FileUpload1.SaveAs(archivo);
                        FileUploadObserva.SaveAs(ruta + fileArchivoObserva);
                    }
                }
                catch (Exception ex)
                {
                    cleanMessage = "Archivo no puedo ser cargado";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                }
            }

            ////////////////////////////////
            Requ_Numero      = Request.QueryString["Requ_Numero"].ToString();
            Reqd_CodLinea    = Request.QueryString["Reqd_CodLinea"].ToString();
            Reqs_Correlativo = Request.QueryString["Reqs_Correlativo"].ToString();


            BE_TBL_RequerimientoSubDetalle oBESol = new BE_TBL_RequerimientoSubDetalle();
            oBESol.Requ_Numero        = Requ_Numero;
            oBESol.Reqd_CodLinea      = Reqd_CodLinea;
            oBESol.Reqs_Correlativo   = Reqs_Correlativo;
            oBESol.D_FECHA_ENVIO_OBRA = txtFechaProyecto.Text;
            oBESol.D_CODIGO_CARE      = txtCare.Text.Trim();
            oBESol.D_COMENTARIOS      = txtComentarios.Text.Trim();
            oBESol.D_OBSERVACION_RUTA = FolderAlquiler;
            oBESol.D_GUIA_RUTA        = FolderAlquiler;
            oBESol.D_ESTADO_PROCESO   = Convert.ToInt32(ddlEstado.SelectedValue.ToString());
            oBESol.D_FECHA_SALE_OBRA  = txtSalida.Text;
            oBESol.D_OBSERVACION_FILE = fileArchivoObserva;
            oBESol.D_GUIA_FILE        = fileArchivo;
            oBESol.D_HRAS_MIN         = Convert.ToDecimal(string.IsNullOrEmpty(txtHminimas.Text.Trim()) ? "0" : txtHminimas.Text.Trim());
            oBESol.D_COSTO_HORA       = Convert.ToDecimal(string.IsNullOrEmpty(txtCostoxHora.Text.Trim()) ? "0" : txtCostoxHora.Text.Trim());
            oBESol.A_GUIA_INGRESO     = txtGuia_i.Text.Trim();
            oBESol.A_SERIE            = txtserie.Text.Trim();
            oBESol.A_PLACA            = txtPlaca.Text.Trim();
            oBESol.A_GUIA_SALIDA      = txtGuia_S.Text.Trim();
            oBESol.USUARIO_ATIENDE    = Session["IDE_USUARIO"].ToString();
            oBESol.FECHA_DESPACHO     = txtFechaDespacho.Text.Trim();

            int dtrpta = 0;
            dtrpta = new BL_TBL_RequerimientoSubDetalle().uspINS_TBL_RequerimientoSubDetalle_PDC_OBSERVA(oBESol);
            if (dtrpta > 0)
            {
                cleanMessage = "Registro exitoso.";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                UpdateCerrar();
                datos();
            }
        }
    }
Exemplo n.º 9
0
    protected void SOLPED()
    {
        string cleanMessage = string.Empty;

        if (txtFechaLegajo.Text.Trim() == string.Empty)
        {
            cleanMessage = "Ingresar fecha de legajo";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (ddlProveedor.Text.Trim() == string.Empty)
        {
            cleanMessage = "Ingresar nombre de proveedor";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else
        {
            ////////////////////////////////
            Requ_Numero      = Request.QueryString["Requ_Numero"].ToString();
            Reqd_CodLinea    = Request.QueryString["Reqd_CodLinea"].ToString();
            Reqs_Correlativo = Request.QueryString["Reqs_Correlativo"].ToString();


            BE_TBL_RequerimientoSubDetalle oBESol = new BE_TBL_RequerimientoSubDetalle();
            oBESol.Requ_Numero            = Requ_Numero;
            oBESol.Reqd_CodLinea          = Reqd_CodLinea;
            oBESol.Reqs_Correlativo       = Reqs_Correlativo;
            oBESol.D_DOCUMENTO_TIPO       = Convert.ToInt32(ddldocumento.SelectedValue.ToString());
            oBESol.D_DOCUMENTO_RUTA       = FolderAlquiler;
            oBESol.D_DOCUMENTO_FILE       = "";
            oBESol.D_DOC_MOVILIZACION     = Convert.ToInt32(ddlMovilizacion.SelectedValue.ToString());
            oBESol.D_DOCUMENTO_FECHA      = txtFechaLegajo.Text.Trim();
            oBESol.D_Prov_RUC             = ddlProveedor.SelectedValue.ToString();
            oBESol.D_ATENCION_TIPO        = Convert.ToInt32(ddlAtencion.SelectedValue.ToString());
            oBESol.TIPO_OPERACION         = 2;
            oBESol.D_DOCUMENTO_FILENAME   = "";
            oBESol.TIPO_FILE              = "";
            oBESol.D_ATENCION_COMENTARIOS = txtComentarios.Text.Trim();
            //string OPERARIO = "0";
            //if(CheckOperario.Checked)
            //{
            //    OPERARIO = "1";
            //}
            //else
            //{
            //    OPERARIO = "0";
            //}
            oBESol.D_FLG_OPERARIO    = ddlOperario.SelectedValue.ToString();
            oBESol.COD_GUID          = string.Empty;
            oBESol.D_FECHA_SALE_OBRA = txtFinSalida.Text.Trim();
            DataTable dtrpta = new DataTable();
            dtrpta = new BL_TBL_RequerimientoSubDetalle().uspUPD_TBL_RequerimientoSubDetalle_Alquiler(oBESol);

            if (dtrpta.Rows.Count > 0)
            {
                if (GridView2.Rows.Count > 0)
                {
                    GuardarGrupo();
                }

                cleanMessage = "Registro existo!";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                datos();
            }
        }
    }
Exemplo n.º 10
0
    public int registroPDC(string _Requ_Numero, string _Reqd_CodLinea, string _Reqs_Correlativo, decimal valor, decimal total, int contador, int registros, decimal valorMov, string G)
    {
        string ruta         = Server.MapPath(FolderAlquiler);
        string rutaBackups  = FolderAlquilerBackups;
        int    dtrpta       = 0;
        string cleanMessage = string.Empty;

        if (txtFechaPDC.Text.Trim() == string.Empty)
        {
            cleanMessage = "Ingresar fecha de PDC";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtPdc.Text.Trim() == string.Empty)
        {
            cleanMessage = "Ingresar PDC";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else if (txtPdc.Text.Length < 10)
        {
            cleanMessage = "Favor de ingresar los 10 digtos de la PDC";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        //else if (txtmonto.Text.Trim() == string.Empty)
        //{
        //    cleanMessage = "Ingresar monto PDC";
        //    ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        //}
        else
        {
            // Si el directorio no existe, crearlo
            //if (!Directory.Exists(Server.MapPath(FolderAlquiler)))
            //    Directory.CreateDirectory(FolderAlquiler);

            String  fileExtension = string.Empty;
            Boolean fileOK        = false;
            string  fileArchivo   = string.Empty;
            if (FileUploadGuia.HasFile)
            {
                string fileName = FileUploadGuia.FileName.ToString();
                int    length   = FileUploadGuia.PostedFile.ContentLength;

                fileExtension = Path.GetExtension(FileUploadGuia.FileName).ToUpper();

                String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".txt" };
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i].ToUpper())
                    {
                        fileOK = true;
                    }
                }
            }
            if (fileOK)
            {
                try
                {
                    // Si el directorio no existe, crearlo
                    //if (!Directory.Exists(ruta))
                    //    Directory.CreateDirectory(ruta);

                    string archivo = String.Format("{0}\\{1}", ruta, FileUploadGuia.PostedFile.FileName);

                    // Verificar que el archivo no exista
                    if (File.Exists(archivo))
                    {
                        fileArchivo = EliminarCaracteres.ReemplazarCaracteresEspeciales("PDC_" + DateTime.UtcNow.ToFileTimeUtc() + Path.GetExtension(FileUploadGuia.PostedFile.FileName));
                        fileArchivo = fileArchivo.Replace("&", "y");
                        FileUploadGuia.SaveAs(ruta + fileArchivo);
                        FileUploadGuia.SaveAs(rutaBackups + fileArchivo);
                    }

                    else
                    {
                        fileArchivo = EliminarCaracteres.ReemplazarCaracteresEspeciales("PDC_" + Path.GetFileName(FileUploadGuia.FileName));
                        fileArchivo = fileArchivo.Replace("&", "y");
                        //FileUpload1.SaveAs(archivo);

                        FileUploadGuia.SaveAs(ruta + fileArchivo);
                        FileUploadGuia.SaveAs(rutaBackups + fileArchivo);
                    }
                }
                catch (Exception ex)
                {
                    cleanMessage = "Archivo no puedo ser cargado";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                }
            }


            BE_TBL_RequerimientoSubDetalle oBESol = new BE_TBL_RequerimientoSubDetalle();
            oBESol.Requ_Numero        = _Requ_Numero;
            oBESol.Reqd_CodLinea      = _Reqd_CodLinea;
            oBESol.Reqs_Correlativo   = _Reqs_Correlativo;
            oBESol.D_PDC              = txtPdc.Text.Trim();
            oBESol.D_OBSERVACION_RUTA = FolderAlquiler;
            oBESol.D_GUIA_RUTA        = FolderAlquiler;
            oBESol.D_GUIA_FILE        = fileArchivo;
            oBESol.D_PDC_FECHA        = txtFechaPDC.Text;
            oBESol.D_PDC_MONEDA       = Convert.ToInt32(ddlMoneda.SelectedValue);
            oBESol.D_PDC_MONTO        = Convert.ToDecimal(string.IsNullOrEmpty(valor.ToString()) ? "0" : valor.ToString());

            int ampliacion = 0;
            if (CheckAmpliacion.Checked)
            {
                ampliacion = 1;
            }
            else
            {
                ampliacion = 0;
            }

            oBESol.D_AMPLIACION      = ampliacion;
            oBESol.D_PDC_MONTO_TOTAL = Convert.ToDecimal(string.IsNullOrEmpty(total.ToString()) ? "0" : total.ToString());
            oBESol.D_PDC_MONTO_MOVIL = Convert.ToDecimal(string.IsNullOrEmpty(valorMov.ToString()) ? "0" : valorMov.ToString());
            oBESol.GUID = G.ToString();
            dtrpta      = new BL_TBL_RequerimientoSubDetalle().uspINS_TBL_RequerimientoSubDetalle_PDC(oBESol);


            if (contador == registros)
            {
                ////**********************************************************
                //******** CREAR DIRECTORIO PROYECTO ******************************
                string Proyecto = Request.QueryString["Requ_Numero"].ToString();

                string rutaOBRA = FolderFTP + Proyecto.Substring(0, 5);

                // Si el directorio no existe, crearlo
                if (!Directory.Exists(rutaOBRA))//directorio OBRA
                {
                    Directory.CreateDirectory(rutaOBRA);
                }

                //DIRECTORIO  PDC
                string rutaSAT = Path.Combine(rutaOBRA, "SAT");
                if (!Directory.Exists(rutaSAT))//directorio final
                {
                    Directory.CreateDirectory(rutaSAT);
                }

                string DIRECTORIO_PDC = string.Empty;
                BL_TBL_RequerimientoSubDetalle objx = new BL_TBL_RequerimientoSubDetalle();
                DataTable dt = new DataTable();
                dt = objx.SP_LISTAR_ARCHIVOS_PDC_TODOS(txtPdc.Text.Trim());
                if (dt.Rows.Count > 0)
                {
                    DIRECTORIO_PDC = dt.Rows[0]["DIRECTORIO"].ToString();

                    //DIRECTORIO  CODIGO DE PDC
                    string rutaPDC_CODIGO = Path.Combine(rutaSAT, DIRECTORIO_PDC);
                    if (!Directory.Exists(rutaPDC_CODIGO))//directorio final
                    {
                        Directory.CreateDirectory(rutaPDC_CODIGO);
                    }

                    BL_TBL_RequerimientoSubDetalle obj = new BL_TBL_RequerimientoSubDetalle();
                    DataTable dtResultado = new DataTable();
                    dtResultado = obj.SP_LISTAR_ARCHIVOS_PDC(txtPdc.Text.Trim());
                    for (int i = 0; i < dtResultado.Rows.Count; i++)
                    {
                        string adjunto = dtResultado.Rows[i]["ARCHIVO"].ToString();
                        if (File.Exists(Path.Combine(ruta, adjunto)))
                        {
                            File.Copy(Path.Combine(ruta, adjunto), Path.Combine(rutaPDC_CODIGO, adjunto), true);
                        }
                    }
                }



                cleanMessage = "Registro exitoso.";

                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                datos();
                file();
                GrupoFile();
            }
        }
        return(dtrpta);
    }
    protected void cargar()
    {
        string cleanMessage = string.Empty;

        if (txtFechaLegajo.Text.Trim() == string.Empty)
        {
            cleanMessage = "Ingresar fecha de legajo";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }

        else
        {
            // Si el directorio no existe, crearlo
            if (!Directory.Exists(Server.MapPath(FolderAlquiler)))
            {
                Directory.CreateDirectory(FolderAlquiler);
            }

            String  fileExtension = string.Empty;
            Boolean fileOK        = false;
            string  fileArchivo   = string.Empty;
            string  Name          = string.Empty;
            if (FileUpload1.HasFile)
            {
                string fileName = FileUpload1.FileName.ToString();
                int    length   = FileUpload1.PostedFile.ContentLength;

                fileExtension = Path.GetExtension(FileUpload1.FileName);

                String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".txt" };
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        fileOK = true;
                    }
                }
            }

            if (fileOK)
            {
                try
                {
                    // Se carga la ruta física de la carpeta temp del sitio
                    string ruta = Server.MapPath(FolderAlquiler);

                    // Si el directorio no existe, crearlo
                    if (!Directory.Exists(ruta))
                    {
                        Directory.CreateDirectory(ruta);
                    }

                    string archivo = String.Format("{0}\\{1}", ruta, FileUpload1.PostedFile.FileName);
                    Name = FileUpload1.PostedFile.FileName;
                    // Verificar que el archivo no exista
                    if (File.Exists(archivo))
                    {
                        fileArchivo = BL_Session.CENTRO_COSTO + "LEG_" + DateTime.UtcNow.ToFileTimeUtc() + Path.GetExtension(FileUpload1.PostedFile.FileName);
                        FileUpload1.SaveAs(ruta + fileArchivo);
                    }

                    else
                    {
                        fileArchivo = BL_Session.CENTRO_COSTO + "LEG_" + Path.GetFileName(FileUpload1.FileName);
                        //FileUpload1.SaveAs(archivo);
                        FileUpload1.SaveAs(ruta + fileArchivo);
                    }
                }
                catch (Exception ex)
                {
                    cleanMessage = "Archivo no puedo ser cargado";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                }
            }
            ////////////////////////////////
            Requ_Numero      = Request.QueryString["Requ_Numero"].ToString();
            Reqd_CodLinea    = Request.QueryString["Reqd_CodLinea"].ToString();
            Reqs_Correlativo = Request.QueryString["Reqs_Correlativo"].ToString();


            BE_TBL_RequerimientoSubDetalle oBESol = new BE_TBL_RequerimientoSubDetalle();
            oBESol.Requ_Numero            = Requ_Numero;
            oBESol.Reqd_CodLinea          = Reqd_CodLinea;
            oBESol.Reqs_Correlativo       = Reqs_Correlativo;
            oBESol.D_DOCUMENTO_TIPO       = 0;
            oBESol.D_DOCUMENTO_RUTA       = FolderAlquiler;
            oBESol.D_DOCUMENTO_FILE       = fileArchivo;
            oBESol.D_DOC_MOVILIZACION     = 0;
            oBESol.D_DOCUMENTO_FECHA      = txtFechaLegajo.Text.Trim();
            oBESol.D_Prov_RUC             = "";
            oBESol.D_ATENCION_TIPO        = 0;
            oBESol.TIPO_OPERACION         = 1;
            oBESol.D_DOCUMENTO_FILENAME   = Name;
            oBESol.TIPO_FILE              = "";
            oBESol.D_ATENCION_COMENTARIOS = "";
            oBESol.D_FLG_OPERARIO         = "";
            oBESol.COD_GUID          = string.Empty;
            oBESol.D_FECHA_SALE_OBRA = "";
            DataTable dtrpta = new DataTable();
            dtrpta = new BL_TBL_RequerimientoSubDetalle().uspUPD_TBL_RequerimientoSubDetalle_Alquiler(oBESol);

            if (dtrpta.Rows.Count > 0)
            {
                //if (dtrpta.Rows[0]["PROCESO"].ToString() == "1")
                //{
                //    datos();
                //}
                //else
                //{

                //    cleanMessage = "Registro existo!";
                //    ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                //}

                datos();
                file();
                cleanMessage = "Registro existo!";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            }
        }
    }
    protected void btnAgregar_Click(object sender, ImageClickEventArgs e)
    {
        string Requ_Numero, Reqd_CodLinea, Reqs_Correlativo, cleanMessage, Reqs_ItemSecuencia, A_FASES_AMPLIACION;

        int intregistros = 0;

        if (GridView1.Rows.Count == 0)
        {
            cleanMessage = "No existe registros";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }



        decimal total    = 0;
        decimal valor    = 0;
        decimal valorMov = 0;

        string codigos = string.Empty;

        foreach (GridViewRow Fila in GridView1.Rows)
        {
            Label lblMontoAlq = ((Label)Fila.FindControl("lblMontoAlq"));
            Label lblMontoMov = ((Label)Fila.FindControl("lblMontoMov"));
            Label lblMontoAmp = ((Label)Fila.FindControl("lblMontoAmp"));
            total = total +

                    Convert.ToDecimal(string.IsNullOrEmpty(lblMontoAlq.Text) ? "0" : lblMontoAlq.Text) +
                    Convert.ToDecimal(string.IsNullOrEmpty(lblMontoMov.Text) ? "0" : lblMontoMov.Text) +
                    Convert.ToDecimal(string.IsNullOrEmpty(lblMontoAmp.Text) ? "0" : lblMontoAmp.Text);
        }


        Guid g = Guid.NewGuid();

        foreach (GridViewRow row in GridView1.Rows)
        {
            Label lblMontoAmp = ((Label)row.FindControl("lblMontoAmp"));
            //Label lblMontoAlq = ((Label)row.FindControl("lblMontoAlq"));
            Label           lblMontoMov = ((Label)row.FindControl("lblMontoMov"));
            Label           lblFases    = ((Label)row.FindControl("lblFases"));
            RadioButtonList rb          = (RadioButtonList)row.FindControl("rdoOpcion");

            Label lblposicionAlq = ((Label)row.FindControl("lblposicionAlq"));

            TextBox txtNuevaPosicion = ((TextBox)row.FindControl("txtNuevaPosicion"));

            Requ_Numero        = GridView1.DataKeys[row.RowIndex].Values[0].ToString(); // extrae key
            Reqd_CodLinea      = GridView1.DataKeys[row.RowIndex].Values[1].ToString(); // extrae key
            Reqs_Correlativo   = GridView1.DataKeys[row.RowIndex].Values[2].ToString(); // extrae key
            Reqs_ItemSecuencia = GridView1.DataKeys[row.RowIndex].Values[3].ToString(); // extrae key
            A_FASES_AMPLIACION = GridView1.DataKeys[row.RowIndex].Values[4].ToString(); // extrae key
            codigos           += Requ_Numero.Trim() + "." + Reqd_CodLinea.Trim() + "-" + Reqs_Correlativo.Trim() + ",";

            if (A_FASES_AMPLIACION == "1")
            {
                if (rb.SelectedValue == "P")
                {
                    //agregar monto

                    valorMov = Convert.ToDecimal(string.IsNullOrEmpty(lblMontoMov.Text) ? "0" : lblMontoMov.Text);
                    valor    = Convert.ToDecimal(string.IsNullOrEmpty(lblMontoAmp.Text) ? "0" : lblMontoAmp.Text);

                    BE_TBL_RequerimientoSubDetalle oBESol = new BE_TBL_RequerimientoSubDetalle();
                    oBESol.Requ_Numero      = Requ_Numero;
                    oBESol.Reqd_CodLinea    = Reqd_CodLinea;
                    oBESol.Reqs_Correlativo = Reqs_Correlativo;
                    oBESol.D_PDC            = txtPdc.Text.Trim();
                    //oBESol.D_PDC_FECHA = txtFechaPDC.Text;

                    oBESol.D_PDC_MONTO       = Convert.ToDecimal(string.IsNullOrEmpty(valor.ToString()) ? "0" : valor.ToString());
                    oBESol.D_PDC_MONTO_TOTAL = Convert.ToDecimal(string.IsNullOrEmpty(total.ToString()) ? "0" : total.ToString());
                    oBESol.D_PDC_MONTO_MOVIL = Convert.ToDecimal(string.IsNullOrEmpty(valorMov.ToString()) ? "0" : valorMov.ToString());
                    oBESol.GUID = g.ToString();
                    oBESol.A_FASES_AMPLIACION = lblFases.Text;
                    int dtrpta;
                    dtrpta = new BL_TBL_RequerimientoSubDetalle().uspINS_TBL_RequerimientoSubDetalle_AMPLIACION(oBESol);
                    if (dtrpta > 0)
                    {
                        intregistros++;
                    }
                }

                else if (rb.SelectedValue == "T/P")
                {
                    valorMov = Convert.ToDecimal(string.IsNullOrEmpty(lblMontoMov.Text) ? "0" : lblMontoMov.Text);
                    valor    = Convert.ToDecimal(string.IsNullOrEmpty(lblMontoAmp.Text) ? "0" : lblMontoAmp.Text);

                    if (txtNuevaPosicion.Text.Trim() == string.Empty)
                    {
                        cleanMessage = "Falta ingresar nueva posicion al req. " + Requ_Numero.Trim() + "." + Reqd_CodLinea.Trim() + "-" + Reqs_Correlativo.Trim();
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                    }
                    else
                    {
                        BL_TBL_RequerimientoSubDetalle obj = new BL_TBL_RequerimientoSubDetalle();
                        DataTable dtResultado = new DataTable();

                        codigos += Requ_Numero.Trim() + "." + Reqd_CodLinea.Trim() + "-" + Reqs_Correlativo.Trim() + ",";

                        dtResultado = obj.uspINS_TBL_GENERAR_AMPLIACION(
                            Requ_Numero,
                            Reqd_CodLinea,
                            Reqs_Correlativo,
                            lblFases.Text,
                            string.IsNullOrEmpty(lblposicionAlq.Text) ? "10" : lblposicionAlq.Text,
                            txtNuevaPosicion.Text.Trim(),
                            valor.ToString(),
                            total.ToString(),
                            txtPdc.Text.Trim(),
                            Reqs_ItemSecuencia
                            );
                        if (dtResultado.Rows.Count > 0)
                        {
                            BL_TBL_RequerimientoSubDetalle objx = new BL_TBL_RequerimientoSubDetalle();

                            string req = dtResultado.Rows[0]["ID"].ToString();
                            //string req = Requ_Numero.Trim() + "." + Reqd_CodLinea.Trim() + "-" + Reqs_Correlativo.Trim() + ",";
                            objx.USP_SEL_TBL_REQUERIMIENTO_CORREO_LIBERACION(req, "ALQUILER CARE", 21);

                            intregistros++;
                        }
                    }


                    String     datos         = string.Empty;
                    string     ArchivoFoto   = string.Empty;
                    String     fileExtension = string.Empty;
                    Boolean    fileOK        = false;
                    string     fileArchivo   = string.Empty;
                    string     Name          = string.Empty;
                    string     TipoArchivo   = "AMPLIACION";
                    FileUpload FileUpload1   = (FileUpload)row.FindControl("FileUpload1");



                    if (FileUpload1.HasFile)
                    {
                        string fileName = FileUpload1.FileName.ToString();
                        int    length   = FileUpload1.PostedFile.ContentLength;

                        fileExtension = Path.GetExtension(FileUpload1.FileName);

                        String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".txt" };
                        for (int i = 0; i < allowedExtensions.Length; i++)
                        {
                            if (fileExtension == allowedExtensions[i])
                            {
                                fileOK = true;
                            }
                        }
                    }

                    if (fileOK)
                    {
                        try
                        {
                            // Se carga la ruta física de la carpeta temp del sitio
                            string ruta = Server.MapPath(FolderAlquiler);

                            // Si el directorio no existe, crearlo
                            //if (!Directory.Exists(ruta))
                            //    Directory.CreateDirectory(ruta);

                            string archivo = String.Format("{0}\\{1}", ruta, FileUpload1.PostedFile.FileName);
                            Name = EliminarCaracteres.ReemplazarCaracteresEspeciales(FileUpload1.PostedFile.FileName);
                            // Verificar que el archivo no exista
                            if (File.Exists(archivo))
                            {
                                fileArchivo = EliminarCaracteres.ReemplazarCaracteresEspeciales(BL_Session.CENTRO_COSTO + "_" + TipoArchivo + "_" + DateTime.UtcNow.ToFileTimeUtc() + Path.GetExtension(FileUpload1.PostedFile.FileName));
                                FileUpload1.SaveAs(ruta + fileArchivo);
                            }

                            else
                            {
                                fileArchivo = EliminarCaracteres.ReemplazarCaracteresEspeciales(BL_Session.CENTRO_COSTO + "_" + TipoArchivo + "_" + Path.GetFileName(FileUpload1.FileName));
                                //FileUpload1.SaveAs(archivo);
                                FileUpload1.SaveAs(ruta + fileArchivo);
                            }
                        }
                        catch (Exception ex)
                        {
                            cleanMessage = "Archivo no puedo ser cargado";
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                        }
                    }
                }
            }
            else
            {
                cleanMessage = "Indicar tipo de ampliación";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            }
        }

        if (intregistros > 0)
        {
            codigos = string.Empty;

            Buscarrequerimientos();

            foreach (GridViewRow row in GridView1.Rows)
            {
                Requ_Numero      = GridView1.DataKeys[row.RowIndex].Values[0].ToString(); // extrae key
                Reqd_CodLinea    = GridView1.DataKeys[row.RowIndex].Values[1].ToString(); // extrae key
                Reqs_Correlativo = GridView1.DataKeys[row.RowIndex].Values[2].ToString(); // extrae key
                codigos         += Requ_Numero.Trim() + "." + Reqd_CodLinea.Trim() + "-" + Reqs_Correlativo.Trim() + ",";
            }
            BL_TBL_RequerimientoSubDetalle obj = new BL_TBL_RequerimientoSubDetalle();
            DataTable dtResultado = new DataTable();

            obj.USP_SEL_TBL_REQUERIMIENTO_CORREO_AMPLIACION(codigos, "ALQUILER CARE", 2);
            cleanMessage = "Actualización satisfactorio";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
    }