public Window1(User user, Window mainWindow) { InitializeComponent(); Closing += WindowClosed; MyUser = user; this.MainWindow = mainWindow; _userLogic = new UserLogic(); _fileLogic = new FileLogic(); _configLogic = new ConfigLogic(); //if (!File.Exists("MyConfig.xml")) //{ // downloadPath = "download"; // uploadPath = "upload"; //} //if (!Directory.Exists(_configLogic.DownloadFolderPath)) // Directory.CreateDirectory(_configLogic.DownloadFolderPath); //if (!Directory.Exists(_configLogic.UploadFolderPath)) // Directory.CreateDirectory(_configLogic.UploadFolderPath); downloadPath = _configLogic.GetDownPath(); uploadPath = _configLogic.GetUpPath(); Task.Factory.StartNew((() => { _uploadLogic = new UploadLogic(); _uploadLogic.MyUploadEvent += updateUploadTransferListView; _uploadLogic.UploadListener(uploadPath); //_uploadLogic.UploadListener(""); })); _userLogic.RetrieveUserFilesLogic(MyUser, FileTransferListView); _userLogic.LoginFlagLogic(MyUser.UserName); }
public EditMyConfigWindow(User myUser, Window1 window1) { InitializeComponent(); _uploadLogic = new UploadLogic(); oldUser = myUser; this.window1 = window1; if (File.Exists("MyConfig.xml")) { userFromConfig = new ConfigLogic(); readXmlFile("MyConfig.xml", userFromConfig); setUserDetailsInTextBoxes(userFromConfig); } }
public JsonResult GetAttachament(int receivableAttachemntId) { AttachmentDownloadViewModel attToBeDownload = null; try { UploadLogic cl = new UploadLogic(db); attToBeDownload = cl.DownloadAttachment(receivableAttachemntId); } catch (Exception ex) { } //return attToBeDownload; return(Json(Utils.JsonResponseFactory.SuccessResponse(attToBeDownload), JsonRequestBehavior.AllowGet)); }
public JsonResult AddStudent(StudentCuFisier student) { try { Logic logic = new Logic(db); UploadLogic cl = new UploadLogic(db); student.student.UserId = User.Identity.GetUserId(); logic.AddStudent(student.student); student.uploadFile.FileType = student.uploadFile.fileByteArray.Substring(0, student.uploadFile.fileByteArray.IndexOf(",")); student.uploadFile.fileByteArray = student.uploadFile.fileByteArray.Substring(student.uploadFile.fileByteArray.IndexOf(",") + 1); student.uploadFile.IdStudent = student.student.Id; cl.AddAttachment(student.uploadFile); return(Json(Utils.JsonResponseFactory.SuccessResponse("Success"), JsonRequestBehavior.AllowGet)); } catch (Exception ex) { } return(Json(Utils.JsonResponseFactory.ErrorResponse("Error"), JsonRequestBehavior.AllowGet)); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime lifetime) { app.UseAuthentication(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStaticFiles(); app.UseCors("default"); app.UseMvc(); var confRegisterConsul = ConfigHelper.ReadConfigByName("IsRegisterConsul", ""); var IsRegisterConsul = false; Boolean.TryParse(confRegisterConsul, out IsRegisterConsul); //注册服务 if (IsRegisterConsul) { ServiceContract serviceEntity = new ServiceContract { IP = Configuration["Service:Ip"], Port = Convert.ToInt32(Configuration["Service:Port"]), ServiceName = Configuration["Service:Name"], ConsulIP = Configuration["Consul:IP"], ConsulPort = Convert.ToInt32(Configuration["Consul:Port"]) }; ConsulCommon.RegisterConsul(app, lifetime, serviceEntity); } string KafkaUploadTopic = ConfigHelper.ReadConfigByName("KafkaUploadTopic"); string KafkaMsgTopic = ConfigHelper.ReadConfigByName("KafkaMsgTopic"); UploadLogic uploadLogic = new UploadLogic(); //总署订阅消息 KafKaLogic.GetInstance().Pull((KafKaContract, topic) => { if (topic == KafkaUploadTopic) //总署订阅消息 { Task.Run(() => { uploadLogic.PullUploadMsg(KafKaContract); }); } else if (topic == KafkaMsgTopic) //隶属关订阅消息 { Task.Run(() => { uploadLogic.PullMsg(KafKaContract); }); } }); var model = new UploadContract(); model.InsertTime = DateTime.Now; var str = SerializeHelper.serializeToString(model); LogHelper.logInfo(str); //定时任务 QuartzLogic quartz = new QuartzLogic(); var cron = ConfigHelper.ReadConfigByName("QuartzTime"); quartz.ExecuteByCron <MyJobLogic>(cron); }
public UploadController() { _logic = new UploadLogic(); }
protected override void Initialize(RequestContext requestContext) { base.Initialize(requestContext); m_upload = new UploadLogic(m_serverDir); }
public async Task UploadToNightScout(SerializerSession session, CancellationToken cancelToken) { UploadLogic upLogic = new UploadLogic(session); await upLogic.Upload(cancelToken); }