예제 #1
0
 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();
     }
 }
예제 #2
0
 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();
     }
 }
예제 #3
0
 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();
     }
 }
예제 #4
0
 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();
     }
 }
예제 #5
0
 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();
     }
 }
예제 #6
0
 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();
     }
 }
예제 #7
0
 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();
         }
     }
 }
예제 #8
0
 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();
         }
     }
 }
예제 #9
0
 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();
         }
     }
 }
예제 #10
0
 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();
     }
 }
예제 #11
0
 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();
     }
 }