private void GuardarArchivo(int rev_cont, int emp_codi, string pro_adju, string fil_name) { BOGnRadju boRadju = new BOGnRadju(); string key = string.Concat(emp_codi, rev_cont); string[] file = pro_adju.Split(','); byte[] pro_adjun = file[1].Select(Convert.ToByte).ToArray(); var saveAttchment = boRadju.insertGnRadju((short)emp_codi, key, "CT_REVDO", "SCTREVDO", rev_cont, pro_adjun, fil_name, "S"); if (!saveAttchment.Item1) { throw new Exception(string.Format("Error insertando adjunto en documentos {0}", saveAttchment.Item2)); } }
public TOTransaction Post() { BOGnRadju boRadju = new BOGnRadju(); var httpRequest = HttpContext.Current.Request; int emp_codi = 0; int var_cont = 0; string tabla = ""; string programa = ""; try { if (httpRequest.Files.Count == 0) { throw new Exception("No se recibió ningún adjunto. Contacte con su administrador del sistema"); } foreach (string file in httpRequest.Files) { var postedFile = httpRequest.Files[file]; emp_codi = int.Parse(httpRequest.Form["EMP_CODI"]); emp_codi = new tools.General().GetEmpCodi(emp_codi); var_cont = int.Parse(httpRequest.Form["VAR_CONT"]); tabla = httpRequest.Form["VAR_TABL"]; programa = httpRequest.Form["VAR_PROG"]; string key = string.Concat(emp_codi, var_cont); var saveAttchment = boRadju.insertGnRadju((short)emp_codi, key, tabla, programa, var_cont, postedFile, "S"); if (!saveAttchment.Item1) { throw new Exception(string.Format("Error insertando adjunto en documentos {0}", saveAttchment.Item2)); } } } catch (Exception ex) { return(new TOTransaction() { retorno = 1, txtRetorno = ex.Message }); } return(new TOTransaction() { retorno = 0, txtRetorno = "" }); }
private void GuardarArchivo(int pro_cont, int emp_codi, byte[] pro_adju, string fil_name) { BOGnRadju boRadju = new BOGnRadju(); string key = string.Concat(emp_codi, pro_cont); string utfString = Encoding.UTF8.GetString(pro_adju, 0, pro_adju.Length); byte[] arrbyte = Convert.FromBase64String(utfString); var saveAttchment = boRadju.insertGnRadju((short)emp_codi, key, "CT_PROPO", "SCTPROPO", pro_cont, arrbyte, fil_name, "S"); if (!saveAttchment.Item1) { throw new Exception(string.Format("Error insertando adjunto en documentos {0}", saveAttchment.Item2)); } }
public TOTransaction Post() { BOGnRadju boRadju = new BOGnRadju(); var httpRequest = HttpContext.Current.Request; int emp_codi = 0; int inp_cont = 0; try { if (httpRequest.Files.Count == 0) { throw new Exception("No se recibió ningún adjunto. Contacte con su administrador del sistema"); } foreach (string file in httpRequest.Files) { var postedFile = httpRequest.Files[file]; emp_codi = int.Parse(httpRequest.Form["EMP_CODI"]); emp_codi = new tools.General().GetEmpCodi(emp_codi); inp_cont = int.Parse(httpRequest.Form["INP_CONT"]); PqInpqr pqr = new DAOPqInpqr().getPqInPqr(inp_cont, emp_codi).FirstOrDefault(); if (pqr == null) { throw new Exception("Registro no encontrado"); } // var filePath = HttpContext.Current.Server.MapPath("~/Upload/" + postedFile.FileName); string key = string.Concat(emp_codi, inp_cont); //Sube archivo a documentos var saveAttchment = boRadju.insertGnRadju((short)emp_codi, key, "PQ_INPQR", "SPQINPQR", inp_cont, postedFile, "S"); if (!saveAttchment.Item1) { throw new Exception(string.Format("Error insertando adjunto en documentos {0}", saveAttchment.Item2)); } //Sube archivo a workflow saveAttchment = boRadju.insertGnRadju((short)emp_codi, key, "PQ_INPQR", "SPQINPQR", pqr.cas_cont, postedFile, "W"); if (!saveAttchment.Item1) { throw new Exception(string.Format("Error insertando adjunto en flujo {0}", saveAttchment.Item2)); } } } catch (Exception ex) { DAOPqInpqr daoPqr = new DAOPqInpqr(); daoPqr.deletePqr(inp_cont); return(new TOTransaction() { retorno = 1, txtRetorno = ex.Message }); } return(new TOTransaction() { retorno = 0, txtRetorno = "" }); }