protected void ImportFile_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { HttpPostedFile userPostedFile = ImportFile.PostedFile; if (userPostedFile != null && userPostedFile.ContentLength > 0) { string ext = System.IO.Path.GetExtension(userPostedFile.FileName), fn = "LIMIT SIMULATION PL.xlt"; //pathurl = "../../debtchecking/Templates/Master"; string fullpath = ConfigurationSettings.AppSettings["TemplatePath"] + "\\" + fn; if (ext.ToLower() == ".xlt") { try { if (System.IO.File.Exists(fullpath)) { System.IO.File.Delete(fullpath); } userPostedFile.SaveAs(fullpath); /*object[] param = new object[] { Session["UserID"] }; * using (DbConnection myconn = new DbConnection((string)ConfigurationSettings.AppSettings["connString"].ToString())) * { * myconn.ExecNonQuery(sql_import, param, 600); * }*/ Response.Write("<script>alert('Upload Success.');</script>"); } catch { Response.Write("<script>alert('Upload Failed.');</script>"); } } } }
protected void upfile_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { HttpPostedFile userPostedFile = upfile.PostedFile; if (userPostedFile != null && userPostedFile.ContentLength > 0) { try { string filename = Path.GetFileName(userPostedFile.FileName); string fullpath = SvrPathPhysic + filename; if (!Directory.Exists(SvrPathPhysic)) { Directory.CreateDirectory(SvrPathPhysic); } userPostedFile.SaveAs(fullpath); Session["fn"] = fullpath; //this callback happen before any other vars is initialized, //hence, no correct cab for this file yet.. Session["fnuc"] = this.ClientID; //thus, put the currently uploaded filename to the session and move it at the page_load } catch (Exception ex) { string errmsg = ""; if (ex.Message.IndexOf("Last Query:") > 0) { errmsg = ex.Message.Substring(0, ex.Message.IndexOf("Last Query:")); } else { errmsg = ex.Message; } upfile.JSProperties["cp_alert"] = errmsg; } } }
protected void UploadControl_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { string fileName = CommonMethods.ReplaceSumniki(e.UploadedFile.FileName).Trim().Replace(" ", "_"); string resultExtension = Path.GetExtension(fileName); bool isPic = false, isxml = false; if (resultExtension.Equals(".png") || resultExtension.Equals(".jpg") || resultExtension.Equals(".jpeg")) { isPic = true; } else if (resultExtension.Equals(".xml")) { isxml = true; } string path = Server.MapPath(UploadDirectory); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string resultFileName = ReplaceFileInDestination ? fileName : Path.ChangeExtension(RandomFileName ? Path.GetRandomFileName() : fileName.Insert(fileName.IndexOf(resultExtension), DateTime.Now.Ticks.ToString()), resultExtension); string resultFileUrl = UploadDirectory + resultFileName; string resultFilePath = MapPath(resultFileUrl); e.UploadedFile.SaveAs(resultFilePath); string url = ResolveClientUrl(resultFileUrl); currentFile = new DocumentEntity { Url = url, Name = e.UploadedFile.FileName, isImage = isPic, isXML = isxml }; e.CallbackData = (ReplaceFileInDestination && FileAlreadyExist(e.UploadedFile.FileName)) ? null : JsonConvert.SerializeObject(currentFile); UploadComplete(this, EventArgs.Empty); }
protected void txtUpload_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { string counter = DateTime.Now.Ticks.ToString(); string ext = Path.GetExtension(e.UploadedFile.FileName); string replaced_icode = txtICode.Text.ToLower().Replace("\\", "X1").Replace("/", "X2").Replace(":", "X3").Replace("*", "X4").Replace("?", "X5").Replace("\"", "X6").Replace("<", "X7").Replace(">", "X8").Replace("|", "X9"); replaced_icode = replaced_icode.Replace("`", "Y001").Replace("~", "Y002").Replace("!", "Y1").Replace("@", "Y2").Replace("#", "Y3").Replace("$", "Y4").Replace("%", "Y5").Replace("^", "Y6").Replace("&", "Y7"); replaced_icode = replaced_icode.Replace("(", "Y9").Replace(")", "Y0").Replace("-", "Z1").Replace("+", "Z2").Replace("_", "Z3").Replace("=", "Z4").Replace("[", "Z5").Replace("]", "Z6").Replace("{", "Z7").Replace("}", "Z8").Replace(";", "Z9").Replace(",", "C1").Replace(".", "C2") + counter; string filename = replaced_icode + ext; txtImageFilename.Text = filename; string strSavePath = "~\\ItemImages\\" + filename; ///hdImageName.Text = strSavePath; //e.UploadedFile.SaveAs(Server.MapPath(strSavePath)); string url = ResolveClientUrl(filename);// + "?" + strSavePath + "?" + DateTime.Now.Ticks.ToString(); e.CallbackData = url; foreach (string filekey in HttpContext.Current.Request.Files.Keys) { HttpPostedFile file = HttpContext.Current.Request.Files[filekey]; if (file.ContentLength <= 0) { continue; //Skip unused file controls. } ImageJob i = new ImageJob(file, "~\\itemImages\\" + filename, new ImageResizer.ResizeSettings("width=500;height=400;format=png;mode=max")); i.CreateParentDirectory = true; //Auto-create the uploads directory. i.Build(); // AddImage(filename, strSavePath); } }
protected void UploadControl_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { if (e.UploadedFile.IsValid) { e.CallbackData = e.UploadedFile.FileNameInStorage; } }
protected void ucUploadPdf_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { if (e.IsValid) { Session["PdfFile"] = e.UploadedFile.FileBytes; } }
protected void ASPxUploadControl1_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { if (e.IsValid) { e.UploadedFile.SaveAs(MapPath("Attachments/" + e.UploadedFile.FileName)); } }
protected void ASPxUploadControl1_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { if (e.IsValid) { Session[SessionKey] = e.UploadedFile.FileBytes; e.CallbackData = e.UploadedFile.FileName; } }
protected void UploadControl_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { if (e.UploadedFile.IsValid) { string fileName = e.UploadedFile.FileName; e.UploadedFile.SaveAs(MapPath(RichEdit.WorkDirectory) + "\\" + fileName, true); e.CallbackData = fileName; } }
protected void ASPxUploadControl1_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { string fileName = e.UploadedFile.FileName; // save file to disk or database // string fullFileName = MapPath(uploadFolder) + fileName; // ASPxUploadControl1.SaveAs(fullFileName); e.CallbackData = fileName; }
public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { if (e.UploadedFile.IsValid) { var path = HttpContext.Current.Server.MapPath("~/content/excel/" + Guid.NewGuid().ToString() + ".xlsx"); e.UploadedFile.SaveAs(path); HttpContext.Current.Session["excel"] = new ExcelHelper(path).ExecuteReader(); System.IO.File.Delete(path); } }
protected void Upload_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { String uploadedFilePath = Server.MapPath("~/XlsTables/") + e.UploadedFile.FileName; e.UploadedFile.SaveAs(uploadedFilePath); if (!String.IsNullOrEmpty(FilePath)) { DocumentManager.CloseDocument(FilePath); } FilePath = uploadedFilePath; }
public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { if (e.UploadedFile.IsValid) { string resultFilePath = HttpContext.Current.Request.MapPath(UploadDirectory + e.UploadedFile.FileName); e.UploadedFile.SaveAs(resultFilePath, true); IUrlResolutionService urlResolver = sender as IUrlResolutionService; if (urlResolver != null) { e.CallbackData = urlResolver.ResolveClientUrl(resultFilePath); } } }
protected void ASPxUploadControl1_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { Session["AppointmentAttachment"] = e.UploadedFile.FileBytes; Session["AppointmentAttachmentFileName"] = e.UploadedFile.FileName; //CustomAppointmentFormTemplateContainer container = (CustomAppointmentFormTemplateContainer)Parent; //container.FormController.EditedAppointmentCopy.CustomFields["AppointmentAttachment"] = e.UploadedFile.FileBytes; //container.FormController.EditedAppointmentCopy.CustomFields["AppointmentAttachmentFileName"] = e.UploadedFile.FileName; ASPxUploadControl1.JSProperties["cpUploadedFileName"] = e.UploadedFile.FileName; }
public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { if (e.UploadedFile.IsValid) { // Save uploaded file to some location var fileName = e.UploadedFile.FileName; var extension = fileName.Substring(fileName.LastIndexOf('.') + 1); var folder = "~/Content/Logo/"; var generatedFileName = DateTime.Now.Ticks.ToString() + "." + extension; e.UploadedFile.SaveAs(System.Web.HttpContext.Current.Server.MapPath(folder) + generatedFileName); // Dosyayi istedigin yere kaydeder e.CallbackData = folder + generatedFileName; } }
protected void ASPxUploadControl2_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { TXT_PROGRESS.Text = "Please wait until this process has done, dont refresh / move from this page"; TXT_PROGRESS.ForeColor = System.Drawing.Color.Black; TXT_PROGRESS.Visible = true; DataTable dtStrukur = new DataTable(); batchId = DateTime.Now.ToString("yyMMddHHmmssfff"); string filename = MapPath("~/upload/Batch/") + batchId + "_" + e.UploadedFile.FileName; e.UploadedFile.SaveAs(filename, true); //string nameFile = new FileInfo(filename).Name; e.CallbackData = batchId + "#;" + filename + "#;" + Request.QueryString["tablename"]; }
public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { const string UploadDirectory = "~/Content/UploadedFiles/"; if (e.UploadedFile.IsValid) { MemoryStream ms = new MemoryStream(); string resultExtension = Path.GetExtension(e.UploadedFile.FileName); string resultFileName = Path.ChangeExtension(Path.GetRandomFileName(), resultExtension); string resultFileUrl = UploadDirectory + resultFileName; string resultFilePath = System.Web.HttpContext.Current.Server.MapPath("~/") + e.UploadedFile.FileName; e.UploadedFile.SaveAs(resultFilePath); e.CallbackData = resultFilePath; } }
protected void xmlUploadControl_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { try { string file = Convert.ToBase64String(e.UploadedFile.FileBytes); Session["xmlFileValidar"] = XMLUtils.base64Decode(file); this.alertMessages.Attributes["class"] = "alert alert-info"; this.alertMessages.InnerText = "Los datos fueron cargados correctamente!!!"; } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
protected void ASPxUploadControl1_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { try { string ruta = Server.MapPath("~/Content/Pictures/"); e.UploadedFile.SaveAs(ruta + e.UploadedFile.FileName); if (e.IsValid) { e.CallbackData = "OK"; } } catch (Exception) { throw; } }
protected void DocumentsUploadControl_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { try { string file = Convert.ToBase64String(e.UploadedFile.FileBytes); Session["xmlFile"] = XMLUtils.base64Decode(file); this.loadHTML(); //if (e.IsValid) // e.CallbackData = tempFileInfo.UniqueFileName + "|" + isSubmissionExpired; } catch (Exception ex) { throw new Exception(Utilidades.validarExepcionSQL(ex), ex.InnerException); } }
protected void ASPxUploadControl1_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { string fileName = ASPxUploadControl1.UploadedFiles[0].FileName; FileInfo fileInfo = new FileInfo(fileName); string resFileName = MapPath(UploadDirectory) + fileInfo.Name; UserCredential credential = Login(resFileName); if (credential == null) { return; } Session["credential"] = credential; const string redirecturi = @"Default.aspx"; e.CallbackData = redirecturi; }
public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { MVCxUploadControl upControl = sender as MVCxUploadControl; int ticketId = Convert.ToInt32(upControl.Request.Params["ticketID"]); if (e.UploadedFile.IsValid) { tcpjw3.oa.Models.tcpjwEntities db = new tcpjw3.oa.Models.tcpjwEntities(); TicketDiscount ticketDiscount = db.TicketDiscount.Where(t => t.TicketID == ticketId).FirstOrDefault(); string filePath = ticketDiscount.TicketBackImg; Uri uri = new Uri(filePath); //var fileName = Path.Combine(upControl.Request.MapPath("~/"), uri.AbsolutePath); //var fileName = upControl.Request.MapPath("~/")+uri.AbsolutePath; var fileName = "E:\\TCPJW_Developer\\Code\\TCPJW.OA" + uri.AbsolutePath;//路径先这样写 e.UploadedFile.SaveAs(fileName); //e.UploadedFile.SaveAs(Server.MapPath("~/") + uri.AbsolutePath); e.CallbackData = ticketDiscount.TicketBackImg; } }
protected void ASPxUploadControl1_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { e.CallbackData = String.Format("/Images/Publication/{0}", e.UploadedFile.FileName); string pathToFiles = Server.MapPath("/Images/Publication/"); if (e.IsValid) { var Id = Convert.ToInt32(PublicationGridView.GetRowValues(PublicationGridView.EditingRowVisibleIndex, "Id")); e.UploadedFile.SaveAs(Path.Combine(pathToFiles, e.UploadedFile.FileName)); using (BalancesEntities db = new BalancesEntities()) { var item = db.Publication.Find(Id); if (item != null) { item.ImageUrl = String.Format("/Images/Publication/{0}", e.UploadedFile.FileName); e.CallbackData = item.ImageUrl; } db.SaveChanges(); } } }
protected void ASPxUploadControl1_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { if (!e.UploadedFile.IsValid) { return; } // Here contentBytes should be saved to a database using (var stream = e.UploadedFile.FileContent) { if (!IsValidImage(stream)) { e.ErrorText = "Invalid image."; e.IsValid = false; } else { // We save it to a file for demonstration purposes string fileName = Server.MapPath("~/App_Data/UploadedData/avatar.jpg"); e.UploadedFile.SaveAs(fileName, true); } } }
public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { if (e.UploadedFile.IsValid) { int itemId = Convert.ToInt32(HttpContext.Current.Session["documentId"]); string resultFilePath = HttpContext.Current.Request.MapPath(UploadDirectory + e.UploadedFile.FileName); IUrlResolutionService urlResolver = (IUrlResolutionService)sender; if (urlResolver != null) { UploadedFileInfo fileInfo = new UploadedFileInfo() { Id = itemId, FileName = e.UploadedFile.FileName, FileContent = e.UploadedFile.FileBytes, ContentType = e.UploadedFile.ContentType }; SaveFileDetails(fileInfo); e.CallbackData += fileInfo.FileName; } } }
public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { UnitOfWork unitOfWork = new UnitOfWork(); if (e.UploadedFile.IsValid) { var files = HttpContext.Current.Server.MapPath($"~/filemanager/excel/{ System.IO.Path.GetRandomFileName() }"); Task.Run(new Action(async() => { e.UploadedFile.SaveAs(files); var dt = new Excel(files).ExecuteReader("select * from [sheet1$]"); foreach (DataRow dr in dt.Rows) { var question = new Question() { Question1 = dr["Question"].ToString(), Title = dr["Title"].ToString(), QuestionId = Guid.NewGuid(), ExamId = ExamId, DateCreated = DateTime.Now, Number = Convert.ToInt32(dr["Number"]), }; unitOfWork.QuestionRepo.Insert(question); unitOfWork.Save(); var choice = new Choice() { ChoiceId = Guid.NewGuid(), Choice1 = dr["A"].ToString(), QuestionId = question.QuestionId, IsAnswer = CheckDataRowIsNull(dr) == "A" ? true : false, DateCreated = DateTime.Now, ChoiceLetter = "A" }; unitOfWork.ChoiceRepo.Insert(choice); choice = new Choice() { ChoiceId = Guid.NewGuid(), Choice1 = dr["B"].ToString(), QuestionId = question.QuestionId, IsAnswer = CheckDataRowIsNull(dr) == "B" ? true : false, DateCreated = DateTime.Now, ChoiceLetter = "B" }; unitOfWork.ChoiceRepo.Insert(choice); try { choice = new Choice() { ChoiceId = Guid.NewGuid(), Choice1 = dr["C"].ToString(), QuestionId = question.QuestionId, IsAnswer = dr["Correct"].ToString() == "C" ? true : false, DateCreated = DateTime.Now, ChoiceLetter = "C" }; unitOfWork.ChoiceRepo.Insert(choice); choice = new Choice() { ChoiceId = Guid.NewGuid(), Choice1 = dr["D"].ToString(), QuestionId = question.QuestionId, IsAnswer = dr["Correct"].ToString() == "D" ? true : false, DateCreated = DateTime.Now, ChoiceLetter = "D" }; unitOfWork.ChoiceRepo.Insert(choice); } catch (Exception) { } await unitOfWork.SaveAsync(); } })); } }
public static void FileUploadComplete_marcaciones(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { int cont = 0; ro_empleado_info_list empleado_info_list = new ro_empleado_info_list(); ro_marcaciones_x_empleado_detLis_Info EmpleadoNovedadCargaMasiva_detLis_Info = new ro_marcaciones_x_empleado_detLis_Info(); List <ro_marcaciones_x_empleado_Info> lista_novedades = new List <ro_marcaciones_x_empleado_Info>(); decimal IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual); Stream stream = new MemoryStream(e.UploadedFile.FileBytes); if (stream.Length > 0) { IExcelDataReader reader = null; reader = ExcelReaderFactory.CreateOpenXmlReader(stream); DateTime Fecha_registro; DateTime marcacion; while (reader.Read()) { if (!reader.IsDBNull(0)) { if (cont != 0) { string cedua = reader.GetString(0); var empleado = empleado_info_list.get_list(IdTransaccionSession).Where(v => v.pe_cedulaRuc == cedua).FirstOrDefault(); if (empleado != null) { if (!reader.IsDBNull(2))// si tiene fehca de marcacion { Fecha_registro = Convert.ToDateTime(reader.GetDateTime(2)); if (!reader.IsDBNull(3))// si tiene entrada del primer turno { marcacion = Convert.ToDateTime(reader.GetValue(3)); if (marcacion.Hour != 0) { ro_marcaciones_x_empleado_Info info = new ro_marcaciones_x_empleado_Info { IdEmpleado = empleado.IdEmpleado, IdEmpresa = empleado.IdEmpresa, es_fechaRegistro = Fecha_registro, IdCalendadrio = Convert.ToInt32(Fecha_registro.ToString("ddMMyyyy")), IdNomina = empleado.IdTipoNomina, IdUsuario = SessionFixed.IdUsuario, es_Hora = new TimeSpan(marcacion.Hour, marcacion.Minute, 0), IdTipoMarcaciones = cl_enumeradores.eTipoMarcacionRRHH.IN1.ToString(), pe_NombreCompleato = empleado.Empleado, pe_cedula = cedua, EstadoBool = true, IdRegistro = cont++ }; lista_novedades.Add(info); } } if (!reader.IsDBNull(4))// si tiene salida del primer turno { marcacion = Convert.ToDateTime(reader.GetValue(4)); if (marcacion.Hour != 0) { ro_marcaciones_x_empleado_Info info = new ro_marcaciones_x_empleado_Info { IdEmpleado = empleado.IdEmpleado, IdEmpresa = empleado.IdEmpresa, es_fechaRegistro = Fecha_registro, IdCalendadrio = Convert.ToInt32(Fecha_registro.ToString("ddMMyyyy")), IdNomina = empleado.IdTipoNomina, IdUsuario = SessionFixed.IdUsuario, es_Hora = new TimeSpan(marcacion.Hour, marcacion.Minute, 0), IdTipoMarcaciones = cl_enumeradores.eTipoMarcacionRRHH.OUT1.ToString(), pe_NombreCompleato = empleado.Empleado, pe_cedula = cedua, EstadoBool = true, IdRegistro = cont++ }; lista_novedades.Add(info); } } if (!reader.IsDBNull(5))// si tiene entrada del segundo turno { marcacion = Convert.ToDateTime(reader.GetValue(5)); if (marcacion.Hour != 0) { ro_marcaciones_x_empleado_Info info = new ro_marcaciones_x_empleado_Info { IdEmpleado = empleado.IdEmpleado, IdEmpresa = empleado.IdEmpresa, es_fechaRegistro = Fecha_registro, IdCalendadrio = Convert.ToInt32(Fecha_registro.ToString("ddMMyyyy")), IdNomina = empleado.IdTipoNomina, IdUsuario = SessionFixed.IdUsuario, es_Hora = new TimeSpan(marcacion.Hour, marcacion.Minute, 0), IdTipoMarcaciones = cl_enumeradores.eTipoMarcacionRRHH.IN2.ToString(), pe_NombreCompleato = empleado.Empleado, pe_cedula = cedua, EstadoBool = true, IdRegistro = cont++ }; lista_novedades.Add(info); } } if (reader.IsDBNull(6))// si tiene salida del segundo turno { marcacion = Convert.ToDateTime(reader.GetValue(6)); if (marcacion.Hour != 0) { ro_marcaciones_x_empleado_Info info = new ro_marcaciones_x_empleado_Info { IdEmpleado = empleado.IdEmpleado, IdEmpresa = empleado.IdEmpresa, es_fechaRegistro = Fecha_registro, IdCalendadrio = Convert.ToInt32(Fecha_registro.ToString("ddMMyyyy")), IdNomina = empleado.IdTipoNomina, IdUsuario = SessionFixed.IdUsuario, es_Hora = new TimeSpan(marcacion.Hour, marcacion.Minute, 0), IdTipoMarcaciones = cl_enumeradores.eTipoMarcacionRRHH.OUT2.ToString(), pe_NombreCompleato = empleado.Empleado, pe_cedula = cedua, EstadoBool = true, IdRegistro = cont++ }; lista_novedades.Add(info); } } } } } cont++; } } EmpleadoNovedadCargaMasiva_detLis_Info.set_list(lista_novedades, Convert.ToDecimal(SessionFixed.IdTransaccionSession)); } }
public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { #region Variables fa_cliente_tipo_List ListaClienteTipo = new fa_cliente_tipo_List(); List <fa_cliente_tipo_Info> Lista_ClienteTipo = new List <fa_cliente_tipo_Info>(); fa_cliente_List ListaCliente = new fa_cliente_List(); List <fa_cliente_Info> Lista_Cliente = new List <fa_cliente_Info>(); fa_cliente_contactos_List List_fa_cliente_contactos = new fa_cliente_contactos_List(); List <fa_cliente_contactos_Info> Lista_ClienteContactos = new List <fa_cliente_contactos_Info>(); fa_cliente_x_fa_Vendedor_x_sucursal_list List_fa_cliente_x_fa_Vendedor_x_sucursal = new fa_cliente_x_fa_Vendedor_x_sucursal_list(); List <fa_cliente_x_fa_Vendedor_x_sucursal_Info> Lista_ClienteVendedor = new List <fa_cliente_x_fa_Vendedor_x_sucursal_Info>(); tb_persona_Bus bus_persona = new tb_persona_Bus(); int cont = 0; decimal IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual); int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa); #endregion Stream stream = new MemoryStream(e.UploadedFile.FileBytes); if (stream.Length > 0) { IExcelDataReader reader = null; reader = ExcelReaderFactory.CreateOpenXmlReader(stream); #region ClienteTipo while (reader.Read()) { if (!reader.IsDBNull(0) && cont > 0) { fa_cliente_tipo_Info info = new fa_cliente_tipo_Info { IdEmpresa = IdEmpresa, Idtipo_cliente = Convert.ToInt32(reader.GetValue(0)), Cod_cliente_tipo = Convert.ToString(reader.GetValue(1)), Descripcion_tip_cliente = Convert.ToString(reader.GetValue(2)), IdCtaCble_CXC_Cred = Convert.ToString(reader.GetValue(3)), IdUsuario = SessionFixed.IdUsuario }; Lista_ClienteTipo.Add(info); } else { cont++; } } ListaClienteTipo.set_list(Lista_ClienteTipo, IdTransaccionSession); #endregion cont = 0; //Para avanzar a la siguiente hoja de excel reader.NextResult(); #region Cliente var lst_persona = bus_persona.get_list(false); while (reader.Read()) { if (!reader.IsDBNull(0) && cont > 0) { var return_naturaleza = ""; var cedula_ruc = (Convert.ToString(reader.GetValue(3))).Trim(); tb_persona_Info info_persona = new tb_persona_Info(); tb_persona_Info info_persona_cliente = new tb_persona_Info(); info_persona = lst_persona.Where(q => q.pe_cedulaRuc == cedula_ruc).FirstOrDefault(); info_persona_cliente = info_persona; if (cl_funciones.ValidaIdentificacion(Convert.ToString(reader.GetValue(2)), Convert.ToString(reader.GetValue(4)), cedula_ruc, ref return_naturaleza)) { if (info_persona == null) { tb_persona_Info info_ = new tb_persona_Info { pe_Naturaleza = Convert.ToString(reader.GetValue(4)), pe_nombreCompleto = Convert.ToString(reader.GetValue(6)) + ' ' + Convert.ToString(reader.GetValue(7)), pe_razonSocial = Convert.ToString(reader.GetValue(5)), pe_apellido = Convert.ToString(reader.GetValue(6)), pe_nombre = Convert.ToString(reader.GetValue(7)), IdTipoDocumento = Convert.ToString(reader.GetValue(2)), pe_cedulaRuc = cedula_ruc, pe_direccion = Convert.ToString(reader.GetValue(9)), pe_telfono_Contacto = Convert.ToString(reader.GetValue(10)), pe_celular = Convert.ToString(reader.GetValue(11)), pe_correo = Convert.ToString(reader.GetValue(8)), }; info_persona_cliente = info_; } else { info_persona_cliente = bus_persona.get_info(info_persona.IdPersona); var x = Convert.ToString(reader.GetValue(4)); info_persona_cliente.pe_Naturaleza = x; info_persona_cliente.pe_nombreCompleto = Convert.ToString(reader.GetValue(6)) + ' ' + Convert.ToString(reader.GetValue(7)); info_persona_cliente.pe_razonSocial = Convert.ToString(reader.GetValue(5)); info_persona_cliente.pe_apellido = Convert.ToString(reader.GetValue(6)); info_persona_cliente.pe_nombre = Convert.ToString(reader.GetValue(7)); info_persona_cliente.IdTipoDocumento = Convert.ToString(reader.GetValue(2)); info_persona_cliente.pe_cedulaRuc = cedula_ruc; info_persona_cliente.pe_direccion = Convert.ToString(reader.GetValue(9)); info_persona_cliente.pe_telfono_Contacto = Convert.ToString(reader.GetValue(10)); info_persona_cliente.pe_celular = Convert.ToString(reader.GetValue(11)); info_persona_cliente.pe_correo = Convert.ToString(reader.GetValue(8)); } info_persona_cliente.pe_Naturaleza = return_naturaleza; info_persona_cliente.pe_nombreCompleto = (info_persona_cliente.pe_razonSocial != "" ? info_persona_cliente.pe_razonSocial : (info_persona_cliente.pe_apellido + ' ' + info_persona.pe_nombre)); var CtaCbleClase = Lista_ClienteTipo.Where(q => q.Idtipo_cliente == Convert.ToInt32(reader.GetValue(13))).FirstOrDefault(); fa_cliente_Info info = new fa_cliente_Info { IdEmpresa = IdEmpresa, IdPersona = info_persona_cliente.IdPersona, IdCliente = Convert.ToInt32(reader.GetValue(0)), Codigo = Convert.ToString(reader.GetValue(1)), Idtipo_cliente = Convert.ToInt32(reader.GetValue(13)), cl_plazo = Convert.ToInt32(reader.GetValue(15)), cl_Cupo = Convert.ToDouble(reader.GetValue(16)), IdCtaCble_cxc_Credito = CtaCbleClase == null ? null: CtaCbleClase.IdCtaCble_CXC_Cred, es_empresa_relacionada = (Convert.ToString(reader.GetValue(12)) == "SI") ? true : false, EsClienteExportador = false, IdNivel = 1, IdTipoCredito = "CON", FormaPago = "01", IdUsuario = SessionFixed.IdUsuario }; fa_cliente_contactos_Info info_cliente_contacto = new fa_cliente_contactos_Info { IdEmpresa = IdEmpresa, IdContacto = 1, IdCiudad = Convert.ToString(reader.GetValue(18)), IdParroquia = Convert.ToString(reader.GetValue(19)), Celular = Convert.ToString(reader.GetValue(11)), Correo = Convert.ToString(reader.GetValue(8)), Direccion = Convert.ToString(reader.GetValue(9)), Nombres = (Convert.ToString(reader.GetValue(4)) == "NATU") ? Convert.ToString(reader.GetValue(6)) + ' ' + Convert.ToString(reader.GetValue(7)) : Convert.ToString(reader.GetValue(5)), Telefono = Convert.ToString(reader.GetValue(10)), }; info.lst_fa_cliente_contactos = new List <fa_cliente_contactos_Info>(); info.lst_fa_cliente_contactos.Add(info_cliente_contacto); info.Lst_fa_cliente_x_fa_Vendedor_x_sucursal = new List <fa_cliente_x_fa_Vendedor_x_sucursal_Info>(); info.info_persona = info_persona_cliente; if (Lista_Cliente.Where(q => q.info_persona.pe_cedulaRuc == info_persona_cliente.pe_cedulaRuc).Count() == 0) { Lista_Cliente.Add(info); } } } else { cont++; } } ListaCliente.set_list(Lista_Cliente, IdTransaccionSession); #endregion } }
public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { #region Variables ba_Banco_Cuenta_List ListaBanco = new ba_Banco_Cuenta_List(); List <ba_Banco_Cuenta_Info> Lista_Banco = new List <ba_Banco_Cuenta_Info>(); ba_Banco_Cbte_List ListaCbte = new ba_Banco_Cbte_List(); List <ba_Cbte_Ban_Info> Lista_Cbte = new List <ba_Cbte_Ban_Info>(); tb_banco_Bus bus_banco = new tb_banco_Bus(); tb_sucursal_Bus bus_sucursal = new tb_sucursal_Bus(); int cont = 0; decimal IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual); int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa); #endregion Stream stream = new MemoryStream(e.UploadedFile.FileBytes); if (stream.Length > 0) { IExcelDataReader reader = null; reader = ExcelReaderFactory.CreateOpenXmlReader(stream); #region Banco while (reader.Read()) { if (!reader.IsDBNull(0) && cont > 0) { ba_Banco_Cuenta_Info info = new ba_Banco_Cuenta_Info { IdEmpresa = IdEmpresa, IdBanco = Convert.ToInt32(reader.GetValue(0)), IdBanco_Financiero = Convert.ToInt32(reader.GetValue(1)), ba_Tipo = Convert.ToString(reader.GetValue(2)), ba_Num_Cuenta = Convert.ToString(reader.GetValue(3)), ba_num_digito_cheq = Convert.ToInt32(reader.GetValue(4)), IdCtaCble = null, IdUsuario = SessionFixed.IdUsuario, }; #region GetInfo tb_banco_Info banco = bus_banco.get_info(info.IdBanco); info.ba_descripcion = banco.ba_descripcion + " " + info.ba_Tipo + " " + info.ba_Num_Cuenta; info.Imprimir_Solo_el_cheque = false; Lista_Banco.Add(info); #endregion } else { cont++; } } ListaBanco.set_list(Lista_Banco, IdTransaccionSession); #endregion cont = 0; //Para avanzar a la siguiente hoja de excel reader.NextResult(); #region Cbte while (reader.Read()) { if (!reader.IsDBNull(0) && cont > 0) { ba_Cbte_Ban_Info info = new ba_Cbte_Ban_Info { IdEmpresa = IdEmpresa, IdTipo_Persona = Convert.ToString(reader.GetValue(0)), Su_Descripcion = Convert.ToString(reader.GetValue(1)), IdBanco = Convert.ToInt32(reader.GetValue(2)), cb_Fecha = Convert.ToDateTime(reader.GetValue(3)), cb_Observacion = Convert.ToString(reader.GetValue(4)), cb_Valor = Convert.ToInt32(reader.GetValue(5)), IdUsuario = SessionFixed.IdUsuario, }; #region GetInfo tb_sucursal_Info sucursal = bus_sucursal.GetInfo(IdEmpresa, info.Su_Descripcion); info.Su_Descripcion = sucursal.Su_Descripcion; info.IdSucursal = sucursal.IdSucursal; Lista_Cbte.Add(info); #endregion } else { cont++; } } var ListCuenta = ListaBanco.get_list(IdTransaccionSession); var lst = (from q in ListCuenta join c in Lista_Cbte on q.IdBanco equals c.IdBanco select new ba_Cbte_Ban_Info { IdEmpresa = c.IdEmpresa, IdTipo_Persona = c.IdTipo_Persona, IdSucursal = c.IdSucursal, ba_descripcion = q.ba_descripcion, Su_Descripcion = c.Su_Descripcion, IdBanco = c.IdBanco, cb_Valor = c.cb_Valor, cb_Fecha = c.cb_Fecha, cb_Observacion = c.cb_Observacion }).ToList(); Lista_Cbte = lst; ListaCbte.set_list(Lista_Cbte, IdTransaccionSession); #endregion } }
protected void ASPxUploadControl2_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { Session["URLAdjunto"] = xUploadFiles(ASPxUploadControl2); }