public JsonResult SaveArtContent(JObject jsonObj) { //_logger.LogInformation("开始运行"); AjaxRtnJsonData ajaxRtnJsonData = HandlerHelper.ActionWrap(() => { //参数 string Id = HandlerHelper.GetValue(jsonObj, "Id"); string ArtContent = HandlerHelper.GetValue(jsonObj, "ArtContent"); IFreeSql fsql = FreeSqlFactory.GetIFreeSql("rlfstock", FreeSql.DataType.Sqlite); StockArt source = fsql.Select <StockArt>().Where(t => t.Id == int.Parse(Id)).ToOne(); source.ArtContent = ArtContent; if (source != null) { fsql.Update <StockArt>().SetSource(source).UpdateColumns(a => a.ArtContent).ExecuteAffrows(); } return(null); }); //_logger.LogInformation("结束运行"); return(new JsonResult(ajaxRtnJsonData)); }
public JsonResult SaveDescription(JObject jsonObj) { //_logger.LogInformation("开始运行"); AjaxRtnJsonData ajaxRtnJsonData = HandlerHelper.ActionWrap(() => { //保存备注 string Id = HandlerHelper.GetValue(jsonObj, "Id"); string Description = HandlerHelper.GetValue(jsonObj, "Description"); IFreeSql fsql = FreeSqlFactory.GetIFreeSql("rlfstock", FreeSql.DataType.Sqlite); Company source = fsql.Select <Company>().Where(t => t.Id == int.Parse(Id, CultureInfo.CurrentCulture)).ToOne(); source.Description = Description; if (source != null) { fsql.Update <Company>().SetSource(source).UpdateColumns(a => a.Description).ExecuteAffrows(); } return(null); }); //_logger.LogInformation("结束运行"); return(new JsonResult(ajaxRtnJsonData)); }
public JsonResult Delete(JObject jsonObj) { //_logger.LogInformation("开始运行"); AjaxRtnJsonData ajaxRtnJsonData = HandlerHelper.ActionWrap(() => { //throw new BusinessException("asdfasdf"); //参数 string[] arrayId = HandlerHelper.GetValue(jsonObj, "Id").Split(','); IFreeSql fsql = FreeSqlFactory.GetIFreeSql("rlfstock", FreeSql.DataType.Sqlite); foreach (string Id in arrayId) { StockArt source = fsql.Select <StockArt>().Where(t => t.Id == int.Parse(Id)).ToOne(); source.Deleted = 1; fsql.Update <StockArt>().SetSource(source).UpdateColumns(a => a.Deleted).ExecuteAffrows(); } return(null); }); //_logger.LogInformation("结束运行"); return(new JsonResult(ajaxRtnJsonData)); }
public JsonResult SaveAnalysisContent(JObject jsonObj) { //_logger.LogInformation("Search 开始运行"); AjaxRtnJsonData ajaxRtnJsonData = HandlerHelper.ActionWrap(() => { //保存备注 string strId = jsonObj["Id"].ToString(); string strAnalysisContent = jsonObj["AnalysisContent"].ToString(); IFreeSql fsql = FreeSqlFactory.GetIFreeSql("rlfstock", FreeSql.DataType.Sqlite); PositionAnalysis source = fsql.Select <PositionAnalysis>().Where(t => t.Id == int.Parse(strId, CultureInfo.CurrentCulture)).ToOne(); source.AnalysisContent = strAnalysisContent; if (source != null) { fsql.Update <PositionAnalysis>().SetSource(source).UpdateColumns(a => a.AnalysisContent).ExecuteAffrows(); } return(null); }); //_logger.LogInformation("Search 结束运行"); return(new JsonResult(ajaxRtnJsonData)); }
public JsonResult SaveRow(JObject jsonObj) { //_logger.LogInformation("开始运行"); AjaxRtnJsonData ajaxRtnJsonData = HandlerHelper.ActionWrap(() => { //参数 string Id = HandlerHelper.GetValue(jsonObj, "Id"); string CompanyCode = HandlerHelper.GetValue(jsonObj, "CompanyCode"); string CompanyName = HandlerHelper.GetValue(jsonObj, "CompanyName"); string CompanyType = HandlerHelper.GetValue(jsonObj, "CompanyType"); string HoldCompanyName = HandlerHelper.GetValue(jsonObj, "HoldCompanyName"); string Tag = HandlerHelper.GetValue(jsonObj, "Tag"); string UserId = HandlerHelper.GetValue(jsonObj, "UserId"); //更新 IFreeSql fsql = FreeSqlFactory.GetIFreeSql("rlfstock", FreeSql.DataType.Sqlite); Company model = null; if (string.IsNullOrEmpty(Id)) { model = new Company(); } else { model = fsql.Select <Company>().Where(t => t.Id == int.Parse(Id, CultureInfo.CurrentCulture)).ToOne(); } //model.UserId = int.Parse(UserId); model.CompanyCode = CompanyCode; model.CompanyName = CompanyName; model.CompanyType = CompanyType; model.HoldCompanyName = HoldCompanyName; model.Tag = Tag; if (!string.IsNullOrEmpty(Id)) { fsql.Update <Company>().SetSource(model).ExecuteAffrows(); } else { if (string.IsNullOrWhiteSpace(UserId)) { throw new BusinessException("用户Id为空!"); } model.UserId = int.Parse(UserId); fsql.Insert <Company>(model).ExecuteAffrows(); } return(null); }); //_logger.LogInformation("结束运行"); return(new JsonResult(ajaxRtnJsonData)); }
public JsonResult RequestToken1(JObject jsonObj) { //_logger.LogInformation("RequestToken 开始运行"); string strAction = "RequestToken1"; AjaxRtnJsonData ajaxRtnJsonData = HandlerHelper.ActionWrap(strAction, jsonObj, (strAction, jsonObj) => { Dictionary <string, object> dictRtn = new Dictionary <string, object>(); string username = HandlerHelper.GetValue(jsonObj, "username"); string password = HandlerHelper.GetValue(jsonObj, "password"); LoginRequestDTO loginRequestDTO = new LoginRequestDTO() { Username = username, Password = password }; if (!ModelState.IsValid) { throw new BusinessException("无效请求!"); } string token; string userid; bool isAuth = _authService.IsAuthenticated(loginRequestDTO, out token, out userid); if (isAuth == false) { throw new BusinessException("用户名或密码错误!"); } dictRtn.Add("Token", token); dictRtn.Add("UserId", userid); return(dictRtn); }); //_logger.LogInformation("结束运行"); return(new JsonResult(ajaxRtnJsonData)); }
public JsonResult Upload(IFormFile file) { AjaxRtnJsonData ajaxRtnJsonData = HandlerHelper.ActionWrap(() => { Dictionary <string, object> dictRtn = new Dictionary <string, object>(); //NLog.LogManager.GetLogger("rlf").Debug("参数:"); if (file == null) { var files = Request.Form.Files; if (files == null || files.Count <= 0) { throw new BusinessException("参数为空!"); } else { file = files[0]; } } //if (jsonObj == null) //{ // throw new BusinessException("参数为空!"); //} var fileDir = @"C:\rlf\uploadspace\image"; if (!Directory.Exists(fileDir)) { Directory.CreateDirectory(fileDir); } //文件名称 string strExt = Path.GetExtension(file.FileName).ToLower(); string projectFileName = Path.GetFileNameWithoutExtension(file.FileName) + "_" + System.DateTime.Now.ToString("yyyyMMddhhmmss") + strExt; //上传的文件的路径 string filePath = fileDir + $@"\{projectFileName}"; using (FileStream fs = System.IO.File.Create(filePath)) { file.CopyTo(fs); fs.Flush(); } string strImgPath = $"http://image.rlf99.com/image/{projectFileName}"; dictRtn.Add("FileUrl", strImgPath); //文件类型 string strFileType = string.Empty; if (strExt.IndexOf("jpg") > -1 || strExt.IndexOf("jpeg") > -1 || strExt.IndexOf("png") > -1) { strFileType = "image"; } if (strExt.IndexOf("mp4") > -1 || strExt.IndexOf("avi") > -1 || strExt.IndexOf("mpeg") > -1) { strFileType = "video"; } if (strExt.IndexOf("mp3") > -1 || strExt.IndexOf("wav") > -1 || strExt.IndexOf("m4a") > -1) { strFileType = "audio"; } dictRtn.Add("FileType", strFileType); return(dictRtn); }); return(new JsonResult(ajaxRtnJsonData)); }
public JsonResult SaveRow(JObject jsonObj) { //_logger.LogInformation("开始运行"); AjaxRtnJsonData ajaxRtnJsonData = HandlerHelper.ActionWrap(() => { //参数 string Id = HandlerHelper.GetValue(jsonObj, "Id"); string TradeTime = HandlerHelper.GetValue(jsonObj, "TradeTime"); string CompanyCode = HandlerHelper.GetValue(jsonObj, "CompanyCode"); string CompanyName = HandlerHelper.GetValue(jsonObj, "CompanyName"); string AgentType = HandlerHelper.GetValue(jsonObj, "AgentType"); string TradeVol = HandlerHelper.GetValue(jsonObj, "TradeVol"); string TradePriceAverage = HandlerHelper.GetValue(jsonObj, "TradePriceAverage"); string TradePrice = HandlerHelper.GetValue(jsonObj, "TradePrice"); string Commission = HandlerHelper.GetValue(jsonObj, "Commission"); string TradeFees = HandlerHelper.GetValue(jsonObj, "TradeFees"); string StampTax = HandlerHelper.GetValue(jsonObj, "StampTax"); string TransferFees = HandlerHelper.GetValue(jsonObj, "TransferFees"); string TradeMkPlace = HandlerHelper.GetValue(jsonObj, "TradeMkPlace"); string Tag = HandlerHelper.GetValue(jsonObj, "Tag"); string UserId = HandlerHelper.GetValue(jsonObj, "UserId"); //更新/插入 IFreeSql fsql = FreeSqlFactory.GetIFreeSql("rlfstock", FreeSql.DataType.Sqlite); TradeLog tradelog = null; if (string.IsNullOrEmpty(Id)) { tradelog = new TradeLog(); } else { tradelog = fsql.Select <TradeLog>().Where(t => t.Id == int.Parse(Id, CultureInfo.CurrentCulture)).ToOne(); } //tradelog.UserId = int.Parse(UserId); tradelog.TradeTime = Convert.ToDateTime(TradeTime, CultureInfo.CurrentCulture); tradelog.CompanyCode = CompanyCode; tradelog.CompanyName = CompanyName; tradelog.AgentType = AgentType; tradelog.TradeVol = int.Parse(TradeVol, CultureInfo.CurrentCulture); tradelog.TradePriceAverage = float.Parse(TradePriceAverage, CultureInfo.CurrentCulture); tradelog.TradePrice = float.Parse(TradePrice, CultureInfo.CurrentCulture); tradelog.Commission = float.Parse(Commission, CultureInfo.CurrentCulture); tradelog.TradeFees = float.Parse(TradeFees, CultureInfo.CurrentCulture); tradelog.StampTax = float.Parse(StampTax, CultureInfo.CurrentCulture); tradelog.TransferFees = float.Parse(TransferFees, CultureInfo.CurrentCulture); tradelog.TradeMkPlace = TradeMkPlace; tradelog.Tag = Tag; if (!string.IsNullOrEmpty(Id)) { fsql.Update <TradeLog>().SetSource(tradelog).ExecuteAffrows(); } else { if (string.IsNullOrWhiteSpace(UserId)) { throw new BusinessException("用户Id为空!"); } tradelog.UserId = int.Parse(UserId); fsql.Insert <TradeLog>(tradelog).ExecuteAffrows(); } return(null); }); //_logger.LogInformation("结束运行"); return(new JsonResult(ajaxRtnJsonData)); }
public JsonResult SaveRow(JObject jsonObj) { //_logger.LogInformation("开始运行"); AjaxRtnJsonData ajaxRtnJsonData = HandlerHelper.ActionWrap(() => { //参数 string Id = HandlerHelper.GetValue(jsonObj, "Id"); string PositionStartTime = HandlerHelper.GetValue(jsonObj, "PositionStartTime"); string PositionEndTime = HandlerHelper.GetValue(jsonObj, "PositionEndTime"); string CompanyCode = HandlerHelper.GetValue(jsonObj, "CompanyCode"); string CompanyName = HandlerHelper.GetValue(jsonObj, "CompanyName"); string PositionVol = HandlerHelper.GetValue(jsonObj, "PositionVol"); string CostPrice = HandlerHelper.GetValue(jsonObj, "CostPrice"); string CurrentPrice = HandlerHelper.GetValue(jsonObj, "CurrentPrice"); string TradeMkPlace = HandlerHelper.GetValue(jsonObj, "TradeMkPlace"); string Tag = HandlerHelper.GetValue(jsonObj, "Tag"); string UserId = HandlerHelper.GetValue(jsonObj, "UserId"); //更新/插入 IFreeSql fsql = FreeSqlFactory.GetIFreeSql("rlfstock", FreeSql.DataType.Sqlite); PositionAnalysis model = null; if (string.IsNullOrEmpty(Id)) { model = new PositionAnalysis(); } else { model = fsql.Select <PositionAnalysis>().Where(t => t.Id == int.Parse(Id, CultureInfo.CurrentCulture)).ToOne(); //插入更新日志 if (model.Tag.IndexOf("更新日志") == -1) { model.Tag = "更新日志"; fsql.Insert <PositionAnalysis>(model).ExecuteAffrows(); } } //model.UserId = int.Parse(UserId); model.PositionStartTime = string.IsNullOrEmpty(PositionStartTime) ? (DateTime?)null : Convert.ToDateTime(PositionStartTime, CultureInfo.CurrentCulture); model.PositionEndTime = string.IsNullOrEmpty(PositionEndTime) ? (DateTime?)null : Convert.ToDateTime(PositionEndTime, CultureInfo.CurrentCulture); model.CompanyCode = CompanyCode; model.CompanyName = CompanyName; model.PositionVol = int.Parse(PositionVol, CultureInfo.CurrentCulture); model.CostPrice = float.Parse(CostPrice, CultureInfo.CurrentCulture); model.CurrentPrice = float.Parse(CurrentPrice, CultureInfo.CurrentCulture); model.TradeMkPlace = TradeMkPlace; model.Tag = Tag; if (!string.IsNullOrEmpty(Id)) { fsql.Update <PositionAnalysis>().SetSource(model).ExecuteAffrows(); } else { if (string.IsNullOrWhiteSpace(UserId)) { throw new BusinessException("用户Id为空!"); } model.UserId = int.Parse(UserId); fsql.Insert <PositionAnalysis>(model).ExecuteAffrows(); } return(null); }); //_logger.LogInformation("结束运行"); return(new JsonResult(ajaxRtnJsonData)); }