public Result <List <Model.DB.AccountGroup> > List() { UserRoleEnum role = (UserRoleEnum)int.Parse(UserRA.Get(user_id.ToString(), "role")); List <Model.DB.AccountGroup> lst = AccountGroupDA.List(role == UserRoleEnum.Administrator ? 0 : user_id); return(Result(lst)); }
public Result <List <Base> > List4Undirected() { UserRoleEnum role = (UserRoleEnum)int.Parse(UserRA.Get(user_id.ToString(), "role")); List <Model.Common.Base> lst = UnitDA.List4Undirected(role == UserRoleEnum.Administrator ? 0 : user_id); return(Result(lst)); }
public Result <List <Base> > List4Filter() { UserRoleEnum role = (UserRoleEnum)int.Parse(UserRA.Get(user_id.ToString(), "role")); List <Base> lst = UnitDA.List <Base>(role == UserRoleEnum.Administrator ? 0 : user_id); return(Result(lst)); }
public Result UpdateStatusTrade(StatusTradeEnum status) { int status_trade = MonitorRA.GetStatusTrade(); if (status_trade == 0) { if (status != StatusTradeEnum.Opening) { return(Result(ApiResultEnum.Failed)); } //开盘 if (!LogTradeDA.Open(UserRA.Get(user_id.ToString(), "name"))) { return(Result(ApiResultEnum.Failed)); } MonitorRA.SetStatusTrade((int)status); OpenCloseBiz.Open(); } else { if (status == StatusTradeEnum.Opening) { OpenCloseBiz.Open(); return(Result(ApiResultEnum.Success)); } else if (status == StatusTradeEnum.Recovery) { MonitorRA.SetStatusTrade((int)StatusTradeEnum.Opening); } else if (status == StatusTradeEnum.Pause) { MonitorRA.SetStatusTrade((int)status); } else { //收盘 if (!LogTradeDA.Close(UserRA.Get(user_id.ToString(), "name"))) { return(Result(ApiResultEnum.Failed)); } MonitorRA.SetStatusTrade((int)status); OpenCloseBiz.Close(); } } return(Result(ApiResultEnum.Success)); }
public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext) { string platform = WebOperationContext.Current.IncomingRequest.Headers["platform"]; string token = WebOperationContext.Current.IncomingRequest.Headers["token"]; if (string.IsNullOrWhiteSpace(token) || string.IsNullOrWhiteSpace(platform)) { throw new ApiException(ApiResultEnum.InvalidRequest, "Invalid Request"); } else { string[] uit = token.Split('-'); string user_token = UserRA.Get(uit[0], "platform_" + platform); if (string.IsNullOrWhiteSpace(user_token) || uit[1] != user_token) { throw new ApiException(ApiResultEnum.NotLoggedIn, "Not Logged In"); } } return(null); }
//检查系统和用户是否满足下单条件 public static ApiResultEnum CheckStatus(Order model) { StatusOrderEnum status_order = (StatusOrderEnum)int.Parse(UserRA.Get(model.user_id.ToString(), "status_order")); if (status_order == StatusOrderEnum.Forbidden) { return(ApiResultEnum.Order_User_Forbidden_Order); } if (model.type_enum == OrderTypeEnum.Buy && status_order == StatusOrderEnum.NoBuying) { return(ApiResultEnum.Order_User_NoBuying_Order); } StatusTradeEnum status_trade = (StatusTradeEnum)MonitorRA.GetStatusTrade(); if (status_trade == StatusTradeEnum.Closed) { return(ApiResultEnum.Order_Closed); } else if (status_trade == StatusTradeEnum.Pause) { return(ApiResultEnum.Order_Paused); } BlockInfo block = StockInfoBiz.GetBlock(model.code); if (block == null) { return(ApiResultEnum.Order_Code_Error); } if (model.price == 0) { return(ApiResultEnum.Order_Price_Error); } if (model.count == 0) { return(ApiResultEnum.Order_Count_Error); } return(ApiResultEnum.Success); }