public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO RemoveExt(Jinher.AMP.BTP.Deploy.ExpressCodeDTO dto) { ResultDTO result = new ResultDTO() { isSuccess = true }; if (dto == null || dto.Id == Guid.Empty) { result.isSuccess = false; result.Message = "参数不能为空"; return(result); } try { var id = dto.Id; var model = ExpressCode.ObjectSet().Where(s => s.Id == id).FirstOrDefault(); if (model != null) { model.EntityState = EntityState.Deleted; ContextFactory.CurrentThreadContext.SaveObject(model); ContextFactory.CurrentThreadContext.SaveChanges(); } } catch (Exception ex) { result.isSuccess = false; result.Message = "删除失败"; LogHelper.Error("删除快递异常", ex); } return(result); }
/// <summary> /// 收藏 /// </summary> /// <param name="appId"></param> /// <returns></returns> public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <System.Collections.Generic.List <Jinher.AMP.BTP.Deploy.ExpressCodeDTO> > GetAllExt(System.Guid appId) { ResultDTO <List <ExpressCodeDTO> > result = new ResultDTO <List <ExpressCodeDTO> >() { isSuccess = true }; try { result.Data = (from t in ExpressCollection.ObjectSet() where t.AppId == appId join e in ExpressCode.ObjectSet() on t.ExpCode equals e.ExpCode orderby e.ExpCode select new ExpressCodeDTO() { ExpCode = e.ExpCode, ExpCompanyName = e.ExpCompanyName }).ToList(); } catch (Exception ex) { result.isSuccess = false; result.Message = "查询失败"; LogHelper.Error("查询快递异常", ex); } return(result); }
public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <Jinher.AMP.BTP.Deploy.ExpressCodeDTO> SaveExt(Jinher.AMP.BTP.Deploy.ExpressCodeDTO dto) { ResultDTO <ExpressCodeDTO> result = new ResultDTO <ExpressCodeDTO>() { isSuccess = true }; if (dto == null || string.IsNullOrEmpty(dto.ExpCompanyName) || string.IsNullOrEmpty(dto.ExpCode)) { result.isSuccess = false; result.Message = "参数错误"; return(result); } try { dto.ExpCompanyName = dto.ExpCompanyName.Replace(" ", ""); var model = ExpressCode.ObjectSet().Where(d => (d.ExpCompanyName == dto.ExpCompanyName || d.ExpCode == dto.ExpCode) && d.Id != dto.Id).FirstOrDefault(); if (model != null) { result.isSuccess = false; result.Message = "重复名称或者编码"; } else { if (dto.Id != Guid.Empty) { model = ExpressCode.ObjectSet().Where(d => d.Id == dto.Id).FirstOrDefault(); if (model != null) { model.ExpCompanyName = dto.ExpCompanyName; model.ExpCode = dto.ExpCode; model.EntityState = EntityState.Modified; ContextFactory.CurrentThreadContext.SaveChanges(); } else { result.isSuccess = false; result.Message = "数据不存在"; } } else { dto.Id = Guid.NewGuid(); model.ExpCompanyName = dto.ExpCompanyName; model.ExpCode = dto.ExpCode; model.EntityState = EntityState.Added; ContextFactory.CurrentThreadContext.SaveObject(model); ContextFactory.CurrentThreadContext.SaveChanges(); } } result.Data = dto; } catch (Exception ex) { result.isSuccess = false; result.Message = "保存异常"; LogHelper.Error("保存快递异常", ex); } return(result); }
static void Main(string[] args) { Stopwatch sw = new Stopwatch(); //sw.Restart(); //for (int i = 0; i < 100000000; i++) //{ // IsEqual2("FUN"); //} //sw.Stop(); //Console.WriteLine("IsEqual2:" + sw.ElapsedMilliseconds); //sw.Restart(); //for (int i = 0; i < 100000000; i++) //{ // IsEqual1("FUN"); //} //sw.Stop(); //Console.WriteLine("IsEqual1:"+sw.ElapsedMilliseconds); //sw.Restart(); //for (int i = 0; i < 100000000; i++) //{ // IsEqual3("FUN"); //} //sw.Stop(); //Console.WriteLine("IsEqual3:" + sw.ElapsedMilliseconds); //Console.Read(); // string code = @"DIF:EMA(CLOSE,12)-EMA(CLOSE,26); //DEA:EMA(DIF,9); //MACD:(DIF-DEA)*2; //VAR1:(H+L)/2; //UP:REF(SMA(VAR1,5,1),3); //TEETH:REF(SMA(VAR1,8,1),5); //DOWN:REF(SMA(VAR1,13,1),8); //MFI:(H-L)*10000000/V; //MA1:MA((HIGH+LOW)/2,5); //MA2:MA((HIGH+LOW)/2,21); //AO:MA1-MA2; //AC:AO-MA( AO,5); //B0:IF H>HF OR ((AO<=0 AND REF(AO,1)<REF(AO,2) AND MFI<REF(MFI,1)*0.9 AND V>=REF(V,1)*1.1)) THEN TRUE ELSE FALSE END; //S0:IF (REF(LF,1)>0 AND LF=0) OR ((REF(UP,1)<UP AND AO>0 AND REF(AO,1)>REF(AO,2) AND (MFI<=REF(MFI,1)*0.9 AND V>=REF(V,1)*1.1))) THEN TRUE ELSE F END; //IF Profit<-10 AND Profit>-30 THEN SELL('sl') ELSE IF B0 AND NOT S0 THEN BUY('buy') ELSE IF NOT B0 AND S0 THEN SELL('sell') END END END;"; //CalculateModel.StockDataCalPool pool = new StockDataCalPool(null ,null,null,code,false); //pool.CallResult(); string code = "y:'wyyy'"; //var code = "x:if c<=6.5 then if c<6.4 then 6.4 else 6.5 end else if c<=7 then 7 else if c<=7.5 then 8 else 9 end end end"; //var stk = ATrade.Server.StockServer.GetStock("000952.sz"); //var quotes = ATrade.Server.StockServer.GetHisDayQuote("000952.sz").ToArray(); //StockDataCalPool pool = new StockDataCalPool(null, stk, quotes, code); //pool.CallResult(); //var code = "x:if c<=8.5 then if ref(c,1)<7.1 then 7.0 else 7.1 end end"; //var stk = ATrade.Server.StockServer.GetStock("000952.sz"); //var quotes = ATrade.Server.StockServer.GetHisDayQuote("000952.sz").ToArray(); //StockDataCalPool pool = new StockDataCalPool(null, stk, quotes, code); //pool.CallResult(); //var code = "x:if c>7 then if sum(sum(c,2))>100 then true else false end end"; //var stk = ATrade.Server.StockServer.GetStock("000952.sz"); //var quotes = ATrade.Server.StockServer.GetHisDayQuote("000952.sz").ToArray(); //StockDataCalPool pool = new StockDataCalPool(new ATrade.TradeBusiness.TestBusiness(), stk, quotes, code); ExpressCode xcode = new ExpressCode(code); //xcode.AnalyseExpress(); //xcode.CallResult(); sw.Restart(); for (int i = 0; i < 1000000; i++) { //LJC.FrameWork.Expression.ExpressHelper.ResolveCalStep(code, null); //pool.VarDataPool.Clear(); //pool.CallResult(); xcode.CallResult(); //var xxx= ParseDecimal("45558773.1548995",2); //var xxx = ToDecimal("45558773.1548995", 2); //var xxx=ToDecimal2("45558773.1548995", 2); } sw.Stop(); Console.WriteLine(sw.ElapsedMilliseconds); Console.WriteLine(LJC.FrameWork.CodeExpression.Comm.CallCount_ToDecimal); Console.Read(); }