public AlbumSlotModel(User_BookFmt <BookSlotData> fmt) : base(fmt.Detail.MstData) { this._fmt = fmt; }
public AlbumShipModel(User_BookFmt <BookShipData> fmt) { this._fmt = fmt; this._mst_data = this._fmt.Detail.MstData; }
public Api_Result <Dictionary <int, User_BookFmt <BookSlotData> > > PictureSlot() { Api_Result <Dictionary <int, User_BookFmt <BookSlotData> > > api_Result = new Api_Result <Dictionary <int, User_BookFmt <BookSlotData> > >(); var bookData = (from item in Comm_UserDatas.Instance.Slot_book.Values select new { id = item.Table_id, state = new List <int> { item.Flag1, item.Flag2, item.Flag3, item.Flag4, item.Flag5 } }).ToDictionary(x => x.id, y => y); if (type3Dict == null) { IEnumerable <int> enumerable = (from x in Mst_DataManager.Instance.Mst_Slotitem select x.Value.Type3).Distinct(); type3Dict = new Dictionary <int, List <int> >(); using (IEnumerator <int> enumerator = enumerable.GetEnumerator()) { int type3; while (enumerator.MoveNext()) { type3 = enumerator.Current; List <int> value = (from stypes in Mst_DataManager.Instance.Mst_stype.Values where stypes.Equip.Contains(type3) select stypes.Id).ToList(); type3Dict.Add(type3, value); } } } Dictionary <int, User_BookFmt <BookSlotData> > fmt = new Dictionary <int, User_BookFmt <BookSlotData> >(); List <Mst_slotitem> list = (from x in Mst_DataManager.Instance.Mst_Slotitem.Values where x.Sortno > 0 select x).ToList(); list.ForEach(delegate(Mst_slotitem dispItem) { if (bookData.ContainsKey(dispItem.Id)) { var anon = bookData[dispItem.Id]; string value2 = null; if (!tempSlotBookText.TryGetValue(anon.id, out value2)) { value2 = string.Empty; } List <int> ids = new List <int> { anon.id }; List <List <int> > state = new List <List <int> > { anon.state }; User_BookFmt <BookSlotData> user_BookFmt = new User_BookFmt <BookSlotData>(anon.id, ids, state, value2, null, type3Dict); fmt.Add(user_BookFmt.IndexNo, user_BookFmt); } else { fmt.Add(dispItem.Sortno, null); } }); api_Result.data = fmt; tempSlotBookText.Clear(); tempSlotBookText = null; return(api_Result); }
public Api_Result <Dictionary <int, User_BookFmt <BookShipData> > > PictureShip() { Api_Result <Dictionary <int, User_BookFmt <BookShipData> > > api_Result = new Api_Result <Dictionary <int, User_BookFmt <BookShipData> > >(); var dictionary = Enumerable.ToDictionary(Enumerable.Select(Comm_UserDatas.Instance.Ship_book.get_Values(), delegate(Mem_book item) { int arg_49_0 = item.Table_id; List <int> list4 = new List <int>(); list4.Add(item.Flag1); list4.Add(item.Flag2); list4.Add(item.Flag3); list4.Add(item.Flag4); list4.Add(item.Flag5); return(new { id = arg_49_0, state = list4 }); }), x => x.id, y => y); using (Dictionary <int, int> .Enumerator enumerator = this.tempMstShipBook.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <int, int> current = enumerator.get_Current(); if (dictionary.ContainsKey(current.get_Key())) { bool flag = dictionary.ContainsKey(current.get_Value()); if (dictionary.get_Item(current.get_Key()).state.get_Item(2) != 0 && flag) { dictionary.get_Item(current.get_Value()).state.set_Item(2, dictionary.get_Item(current.get_Key()).state.get_Item(2)); } } } } int bookMax = Mst_DataManager.Instance.Mst_const.get_Item(MstConstDataIndex.Book_max_ships).Int_value; List <Mst_ship> list = Enumerable.ToList <Mst_ship>(Enumerable.Where <Mst_ship>(Enumerable.OrderBy <Mst_ship, int>(Mst_DataManager.Instance.Mst_ship.get_Values(), (Mst_ship obj) => obj.Bookno), (Mst_ship x) => x.Bookno > 0 && x.Bookno <= bookMax)); Dictionary <int, User_BookFmt <BookShipData> > dictionary2 = new Dictionary <int, User_BookFmt <BookShipData> >(); HashSet <Mst_ship> hashSet = new HashSet <Mst_ship>(); using (List <Mst_ship> .Enumerator enumerator2 = list.GetEnumerator()) { while (enumerator2.MoveNext()) { Mst_ship current2 = enumerator2.get_Current(); if (!hashSet.Contains(current2)) { List <int> list2 = new List <int>(); List <List <int> > list3 = new List <List <int> >(); Mst_ship mst_ship = current2; bool flag2 = false; if (dictionary.ContainsKey(mst_ship.Id)) { list2.Add(current2.Id); list3.Add(dictionary.get_Item(current2.Id).state); flag2 = true; } hashSet.Add(mst_ship); for (int append_ship_id = current2.Append_ship_id; append_ship_id != 0; append_ship_id = Mst_DataManager.Instance.Mst_ship.get_Item(append_ship_id).Append_ship_id) { hashSet.Add(Mst_DataManager.Instance.Mst_ship.get_Item(append_ship_id)); if (dictionary.ContainsKey(append_ship_id)) { list2.Add(append_ship_id); list3.Add(dictionary.get_Item(append_ship_id).state); } } if (flag2) { string info = this.tempShipBookText.get_Item(list2.get_Item(0)); int ctype = Mst_DataManager.Instance.Mst_ship.get_Item(list2.get_Item(0)).Ctype; string cname = this.tempShipClass.get_Item(ctype); User_BookFmt <BookShipData> user_BookFmt = new User_BookFmt <BookShipData>(list2.get_Item(0), list2, list3, info, cname, null); if (Enumerable.Any <List <int> >(user_BookFmt.State, (List <int> x) => x.get_Item(2) != 0)) { user_BookFmt.State.ForEach(delegate(List <int> flags) { flags.set_Item(2, 1); }); } dictionary2.Add(user_BookFmt.IndexNo, user_BookFmt); } else { dictionary2.Add(current2.Bookno, null); } } } } api_Result.data = dictionary2; this.tempShipBookText.Clear(); this.tempShipBookText = null; this.tempShipClass.Clear(); this.tempShipClass = null; return(api_Result); }
public Api_Result <Dictionary <int, User_BookFmt <BookShipData> > > PictureShip() { Api_Result <Dictionary <int, User_BookFmt <BookShipData> > > api_Result = new Api_Result <Dictionary <int, User_BookFmt <BookShipData> > >(); var dictionary = (from item in Comm_UserDatas.Instance.Ship_book.Values select new { id = item.Table_id, state = new List <int> { item.Flag1, item.Flag2, item.Flag3, item.Flag4, item.Flag5 } }).ToDictionary(x => x.id, y => y); foreach (KeyValuePair <int, int> item in tempMstShipBook) { if (dictionary.ContainsKey(item.Key)) { bool flag = dictionary.ContainsKey(item.Value); if (dictionary[item.Key].state[2] != 0 && flag) { dictionary[item.Value].state[2] = dictionary[item.Key].state[2]; } } } int bookMax = Mst_DataManager.Instance.Mst_const[MstConstDataIndex.Book_max_ships].Int_value; List <Mst_ship> list = (from obj in Mst_DataManager.Instance.Mst_ship.Values orderby obj.Bookno select obj into x where x.Bookno > 0 && x.Bookno <= bookMax select x).ToList(); Dictionary <int, User_BookFmt <BookShipData> > dictionary2 = new Dictionary <int, User_BookFmt <BookShipData> >(); HashSet <Mst_ship> hashSet = new HashSet <Mst_ship>(); foreach (Mst_ship item2 in list) { if (!hashSet.Contains(item2)) { List <int> list2 = new List <int>(); List <List <int> > list3 = new List <List <int> >(); Mst_ship mst_ship = item2; bool flag2 = false; if (dictionary.ContainsKey(mst_ship.Id)) { list2.Add(item2.Id); list3.Add(dictionary[item2.Id].state); flag2 = true; } hashSet.Add(mst_ship); for (int append_ship_id = item2.Append_ship_id; append_ship_id != 0; append_ship_id = Mst_DataManager.Instance.Mst_ship[append_ship_id].Append_ship_id) { hashSet.Add(Mst_DataManager.Instance.Mst_ship[append_ship_id]); if (dictionary.ContainsKey(append_ship_id)) { list2.Add(append_ship_id); list3.Add(dictionary[append_ship_id].state); } } if (flag2) { string info = tempShipBookText[list2[0]]; int ctype = Mst_DataManager.Instance.Mst_ship[list2[0]].Ctype; string cname = tempShipClass[ctype]; User_BookFmt <BookShipData> user_BookFmt = new User_BookFmt <BookShipData>(list2[0], list2, list3, info, cname, null); if (user_BookFmt.State.Any((List <int> x) => x[2] != 0)) { user_BookFmt.State.ForEach(delegate(List <int> flags) { flags[2] = 1; }); } dictionary2.Add(user_BookFmt.IndexNo, user_BookFmt); } else { dictionary2.Add(item2.Bookno, null); } } } api_Result.data = dictionary2; tempShipBookText.Clear(); tempShipBookText = null; tempShipClass.Clear(); tempShipClass = null; return(api_Result); }