public static void DeleteLayoutInfo(string userID, string frameID) { using (var clientCtx = new ClientDbContext()) { var layoutInfos = clientCtx.LayoutInfo.Where(t => t.UserID == userID && t.FrameID == frameID); clientCtx.LayoutInfo.RemoveRange(layoutInfos); clientCtx.SaveChanges(); } }
public static void DeleteAllColumnSettings(string userId, string tabID) { using (var clientCtx = new ClientDbContext()) { var columnInfos = clientCtx.ColumnSettingsInfo.Where(t => t.AccountID == userId && t.TabID == tabID); clientCtx.ColumnSettingsInfo.RemoveRange(columnInfos); clientCtx.SaveChanges(); } }
public static void DeleteFilterSettings(string id) { using (var clientCtx = new ClientDbContext()) { var filterinfo = clientCtx.FilterSettings.FirstOrDefault(t => t.Id == id); if (filterinfo != null) { clientCtx.FilterSettings.Remove(filterinfo); } clientCtx.SaveChanges(); } }
public static void DeleteColumnSettings(string userId, string tabID, int columnIdx) { using (var clientCtx = new ClientDbContext()) { var columnInfo = clientCtx.ColumnSettingsInfo.FirstOrDefault(t => t.AccountID == userId && t.ColumnIdx == columnIdx && t.TabID == tabID); if (columnInfo != null) { clientCtx.ColumnSettingsInfo.Remove(columnInfo); } clientCtx.SaveChanges(); } }
public static void DeleteOrderStatus(string userId, string tabID, int status) { using (var clientCtx = new ClientDbContext()) { var orderstatus = clientCtx.OrderStatusFilter.FirstOrDefault(t => t.AccountID == userId && t.Orderstatus == status && t.TabID == tabID); if (orderstatus != null) { clientCtx.OrderStatusFilter.Remove(orderstatus); } clientCtx.SaveChanges(); } }
public static void DeleteUserContracts(string userId, string tabID, string contract) { using (var clientCtx = new ClientDbContext()) { var contractinfo = clientCtx.MarketContract.FirstOrDefault(t => t.AccountID == userId && t.Contract == contract && t.TabID == tabID); if (contractinfo != null) { clientCtx.MarketContract.Remove(contractinfo); } clientCtx.SaveChanges(); } }
public static void SaveColumnSettings(string userID, string tabID, int columnIdx) { using (var clientCtx = new ClientDbContext()) { var columnInfo = clientCtx.ColumnSettingsInfo.FirstOrDefault(t => t.AccountID == userID && t.TabID == tabID && t.ColumnIdx == columnIdx); if (columnInfo == null) { columnInfo = new ColumnSettingsInfo { AccountID = userID, ColumnIdx = columnIdx, TabID = tabID, }; clientCtx.ColumnSettingsInfo.Add(columnInfo); clientCtx.SaveChanges(); } } }
public static void SaveOrderStatus(string userID, int status, string tabID) { using (var clientCtx = new ClientDbContext()) { var orderstatus = clientCtx.OrderStatusFilter.FirstOrDefault(t => t.AccountID == userID && t.Orderstatus == status && t.TabID == tabID); if (orderstatus == null) { orderstatus = new OrderStatusFilter { AccountID = userID, Orderstatus = status, TabID = tabID, }; clientCtx.OrderStatusFilter.Add(orderstatus); clientCtx.SaveChanges(); } } }
public static void SaveMarketContract(string userID, string contract, string tabID) { using (var clientCtx = new ClientDbContext()) { var marketcontract = clientCtx.MarketContract.FirstOrDefault(t => t.AccountID == userID && t.Contract == contract && t.TabID == tabID); if (marketcontract == null) { marketcontract = new MarketContract { AccountID = userID, Contract = contract, TabID = tabID, }; clientCtx.MarketContract.Add(marketcontract); clientCtx.SaveChanges(); } } }
public static void SaveLayoutInfo(string userID, string frameID, string layoutCFG) { using (var clientCtx = new ClientDbContext()) { var layoutInfo = clientCtx.LayoutInfo.FirstOrDefault(t => t.UserID == userID && t.FrameID == frameID); if (layoutInfo == null) { layoutInfo = new LayoutInfo { UserID = userID, FrameID = frameID, LayoutCFG = layoutCFG, }; clientCtx.LayoutInfo.Add(layoutInfo); } else { layoutInfo.LayoutCFG = layoutCFG; } clientCtx.SaveChanges(); } }
public static void SaveFilterSettings(string userID, string ctrlID, string id, string title, string exchange, string contract, string underlying, string portfolio) { using (var clientCtx = new ClientDbContext()) { var filterinfo = clientCtx.FilterSettings.FirstOrDefault(t => t.Id == id); if (filterinfo == null) { filterinfo = new FilterSettings { Id = id }; //insert new record clientCtx.FilterSettings.Add(filterinfo); } filterinfo.CtrlID = ctrlID; filterinfo.Title = title; filterinfo.Exchange = exchange; filterinfo.Underlying = underlying; filterinfo.Contract = contract; filterinfo.UserID = userID; filterinfo.Portfolio = portfolio; clientCtx.SaveChanges(); } }