/// <summary> /// Get the items in a directory /// </summary> /// <param name="DirectoryFullName">Directory name (e.g. "directory\subdirectory" or "." for the root)</param> /// <param name="ExcludeNavigationDots">When posted as true, return list will not contains "." and ".."</param> /// <returns>A list of the items name</returns> public List <String> GetItemList(String DirectoryFullName, Boolean ExcludeNavigationDots) { DirectoryFullName = CorrectPath(DirectoryFullName); System.Collections.Generic.List <String> content = this._nfsInterface.GetItemList(DirectoryFullName); if (ExcludeNavigationDots) { int dotIdx, ddotIdx; dotIdx = content.IndexOf("."); if (dotIdx > -1) { content.RemoveAt(dotIdx); } ddotIdx = content.IndexOf(".."); if (ddotIdx > -1) { content.RemoveAt(ddotIdx); } } return(content); }
static int _m_IndexOf(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Generic.List <string> gen_to_be_invoked = (System.Collections.Generic.List <string>)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 2 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)) { string _item = LuaAPI.lua_tostring(L, 2); int gen_ret = gen_to_be_invoked.IndexOf( _item); LuaAPI.xlua_pushinteger(L, gen_ret); return(1); } if (gen_param_count == 3 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)) { string _item = LuaAPI.lua_tostring(L, 2); int _index = LuaAPI.xlua_tointeger(L, 3); int gen_ret = gen_to_be_invoked.IndexOf( _item, _index); LuaAPI.xlua_pushinteger(L, gen_ret); return(1); } if (gen_param_count == 4 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4)) { string _item = LuaAPI.lua_tostring(L, 2); int _index = LuaAPI.xlua_tointeger(L, 3); int _count = LuaAPI.xlua_tointeger(L, 4); int gen_ret = gen_to_be_invoked.IndexOf( _item, _index, _count); LuaAPI.xlua_pushinteger(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to System.Collections.Generic.List<string>.IndexOf!")); }
static int _m_IndexOf(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Generic.List <int> __cl_gen_to_be_invoked = (System.Collections.Generic.List <int>)translator.FastGetCSObj(L, 1); int __gen_param_count = LuaAPI.lua_gettop(L); if (__gen_param_count == 2 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)) { int item = LuaAPI.xlua_tointeger(L, 2); int __cl_gen_ret = __cl_gen_to_be_invoked.IndexOf(item); LuaAPI.xlua_pushinteger(L, __cl_gen_ret); return(1); } if (__gen_param_count == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)) { int item = LuaAPI.xlua_tointeger(L, 2); int index = LuaAPI.xlua_tointeger(L, 3); int __cl_gen_ret = __cl_gen_to_be_invoked.IndexOf(item, index); LuaAPI.xlua_pushinteger(L, __cl_gen_ret); return(1); } if (__gen_param_count == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4)) { int item = LuaAPI.xlua_tointeger(L, 2); int index = LuaAPI.xlua_tointeger(L, 3); int count = LuaAPI.xlua_tointeger(L, 4); int __cl_gen_ret = __cl_gen_to_be_invoked.IndexOf(item, index, count); LuaAPI.xlua_pushinteger(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to System.Collections.Generic.List<int>.IndexOf!")); }
/// <summary> /// Property helper for Files & WordFiles, ensures the data retrieved /// from those two properties is 'in sync' /// </summary> private void PrepareForSerialization() { if (_SerializePreparationDone) { return; } _FileList = new List <File>(); _WordfileArray = new CatalogWordFile[_Index.Count]; Word[] wordArray = new Word[_Index.Count]; _Index.Values.CopyTo(wordArray, 0); // go through all the words for (int i = 0; i < wordArray.Length; i++) { // first, add all files to the 'flist' collection foreach (File f in wordArray[i].Files) { if (!_FileList.Contains(f)) { _FileList.Add(f); } } // now go through again and use the indexes CatalogWordFile wf = new CatalogWordFile(); wf.Text = wordArray[i].Text; foreach (File f in wordArray[i].Files) { wf.FileIds.Add(_FileList.IndexOf(f)); } _WordfileArray[i] = wf; } _SerializePreparationDone = true; }
// Время поиска элемента в списке List<Organization> public double timeSearchListOrg(Organization or) { double start = DateTime.Now.Ticks; int i = Org.IndexOf(or); return((DateTime.Now.Ticks - start) * 1000); }
// Время поиска элемента в списке List<string> public double timeSearchListStr(String s) { double start = DateTime.Now.Ticks; str.IndexOf(s); return((DateTime.Now.Ticks - start) * 1000); }
public void UpdateGamesProperties() { var steam = new Steam(_db.GetAll().steamKey, _db.GetAll().steamId); try { var allSteamGames = Steam.GetFromSteam().Result.response.games; foreach (var steamGame in allSteamGames) { var gameFound = games.Find(g => g.Name == steamGame.name && g.Store == "Steam"); if (gameFound != null) { games[games.IndexOf(gameFound)].PlayedTime = steamGame.playtime_forever; //games[games.IndexOf(gameFound)].SteamOriginalImageURL = steamGame.img_logo_url + ".jpg"; } } int id = 1; foreach (var savedGame in games) { savedGame.GameID = id++; } // _db.SaveJson(games, @"docs/games/games.json"); // return Ok(); } catch (Exception error) { // return StatusCode(500, error); } }
private void DoStyle(Style style, Row row) { if (style == null) { return; } StyleInfo si = style.GetStyleInfo(r, row); // tw.Write(@"\plain"); // reset current attributes // Handle the font if (!_Fonts.Contains(si.FontFamily)) { _Fonts.Add(si.FontFamily); } int fc = _Fonts.IndexOf(si.FontFamily); tw.Write(@"\f{0} ", fc); if (si.IsFontBold()) { tw.Write(@"\b"); } if (si.FontStyle == FontStyleEnum.Italic) { tw.Write(@"\i"); } switch (si.TextDecoration) { case TextDecorationEnum.Underline: tw.Write(@"\ul"); break; case TextDecorationEnum.LineThrough: tw.Write(@"\strike"); break; default: break; } tw.Write(@"\fs{0}", (int)Math.Round(si.FontSize * 2, 0)); // font size // Handle the color int ic; if (!_Colors.Contains(si.Color)) { _Colors.Add(si.Color); } ic = _Colors.IndexOf(si.Color) + 1; tw.Write(@"\cf{0} ", ic); }
public uint IndexOf(ItemType item) { if (Contains(item)) { return((uint)items.IndexOf(item)); } else { throw new Exception(); } }
/// <summary> /// 搜索指定的对象的索引位置(名称唯一模式时,按名称匹配)。 /// </summary> /// <param name="item">为null直接返回-1。</param> /// <returns>返回搜索到的索引位置,未找到时返回-1。</returns> public int IndexOf(IParameterInfo item) { if (item == null || _list.Count == 0) { return(-1); } if (_nameOnly) { StringComparison comparison = _ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal; return(_list.FindIndex(p => string.Equals(p.Name, item.Name, comparison))); } return(_list.IndexOf(item)); }
static public int IndexOf(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 2) { System.Collections.Generic.List <WWWRequest> self = (System.Collections.Generic.List <WWWRequest>)checkSelf(l); WWWRequest a1; checkType(l, 2, out a1); var ret = self.IndexOf(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 3) { System.Collections.Generic.List <WWWRequest> self = (System.Collections.Generic.List <WWWRequest>)checkSelf(l); WWWRequest a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); var ret = self.IndexOf(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 4) { System.Collections.Generic.List <WWWRequest> self = (System.Collections.Generic.List <WWWRequest>)checkSelf(l); WWWRequest a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); System.Int32 a3; checkType(l, 4, out a3); var ret = self.IndexOf(a1, a2, a3); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function IndexOf to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
public System.Collections.Generic.List <string> GetAllPorts() { //List all com port simulated by Bluetooth that connected with Cubinote List <String> allPorts = new System.Collections.Generic.List <String>(); try { ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_PnPEntity WHERE Caption LIKE '%Bluetooth%'"); foreach (ManagementObject queryObj in searcher.Get()) { if (queryObj["Caption"] != null && queryObj["Caption"].ToString().Contains("(COM")) { String portName = queryObj["Caption"].ToString(); int ipos = portName.LastIndexOf("COM"); if (ipos < 0) { continue; } portName = portName.Substring(ipos); ipos = portName.IndexOf(")"); if (ipos < 0) { continue; } portName = portName.Substring(0, ipos); if (allPorts.IndexOf(portName) == -1) { CubinoteBLE SDK = new CubinoteBLE(); String result = SDK.CubinoteBLE_GetStatus(portName); if (result.StartsWith("1880") || result.StartsWith("{")) { //Connected with Cubintoe allPorts.Add(portName); comboBox1.Items.Add(portName); } } } } } catch (ManagementException e) { ; } return(allPorts); }
public void Ripristina(int id) { int index; lock (this) { if (__list_ids_files.Contains(id)) { return; } if ((index = __list_deleted_ids.IndexOf(id)) == -1) { throw new ArgumentException("L'id fornito non appartiene ad alcun file"); } __list_ids_files.Add(id); __list_deleted_ids.RemoveAt(index); __file_list = new FileUtente[__list_ids_files.Count]; __deleted_list = new FileUtente[__list_deleted_ids.Count]; } }
static StackObject *IndexOf_4(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); global::UIButton @item = (global::UIButton)typeof(global::UIButton).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Collections.Generic.List <global::UIButton> instance_of_this_method = (System.Collections.Generic.List <global::UIButton>) typeof(System.Collections.Generic.List <global::UIButton>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.IndexOf(@item); __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method; return(__ret + 1); }
private void ClipboardChanged(object sender, EventArgs e) { String clipboardText; try { // Handle your clipboard update here, debug logging example: if (Clipboard.ContainsText()) { clipboardText = Clipboard.GetText(TextDataFormat.UnicodeText); if (!clipboardText.Equals(currentItem)) //make sure that if you click an item, it can differentiate from the item that was copied // it goes into this multiple times after writing to clipboard, so that is how I stopped it { if (!actualClipboard.Contains(clipboardText)) { //if it has the thing already actualClipboard.Insert(0, clipboardText); if (actualClipboard.Count > 10) { actualClipboard.RemoveAt(10); } } else { MoveToTop(actualClipboard.IndexOf(clipboardText)); } Repopulate(); } } else { justWroteToClipboard = false; } } catch (Exception err) { //do nothing } }
public void AddDonatedTroop(long did, int id, int value, int level) { DonationSlot donationSlot = m_vUnitDonation.Find((Predicate <DonationSlot>)(t => { if (t.ID == id) { return(t.UnitLevel == level); } return(false); })); if (donationSlot != null) { int index = m_vUnitDonation.IndexOf(donationSlot); donationSlot.Count = donationSlot.Count + value; this.m_vUnitDonation[index] = donationSlot; } else { this.m_vUnitDonation.Add(new DonationSlot(did, id, value, level)); } }
private void parseDataFile() { string data = this.dataFile.text.Replace("\r\n", "\n").Trim(); System.Collections.Generic.List <string> values = new System.Collections.Generic.List <string>(); int index = this.parseLine(data, values, 0); int num2 = values.IndexOf(this.currentLanguage.ToString()); if (num2 >= 0) { System.Collections.Generic.List <string> list2 = new System.Collections.Generic.List <string>(); while (index < data.Length) { index = this.parseLine(data, list2, index); if (list2.Count != 0) { string str2 = list2[0]; string str3 = (num2 >= list2.Count) ? string.Empty : list2[num2]; this.strings[str2] = str3; } } } }
/// <summary> /// Insert string element into history or move it to the top /// </summary> /// <param name="list">String list</param> /// <param name="element">String element</param> /// <param name="insensitive">Ignore case</param> /// <returns>String list</returns> public static List <string> Insert(System.Collections.Generic.List <string> list, string element, bool insensitive) { if (list == null) { return(null); } if (String.IsNullOrEmpty(element)) { return(list); } if (!insensitive) { int index = list.IndexOf(element); if (index >= 0) { list.RemoveAt(index); } } else { for (int i = list.Count - 1; i >= 0; i--) { if (0 == String.Compare(list[i], element, insensitive)) { list.RemoveAt(i); } } } int offset = 0; if (list.Count > 0 && list[0] == "") { offset++; } list.Insert(offset, element); return(list); }
public static void nvk_setTongHopChanDoan_ByIdKhamBenh(string IdKhamBenh, ref string nvk_listMaIcd, ref string nvk_listMoTaIcd) { if (IdKhamBenh == null || IdKhamBenh == "") { return; } string nvk_sq = @" SELECT distinct a.MOTACD_edit,b.maicd FROM KHAMBENH a left JOIN CHANDOANICD b ON a.KETLUAN=b.IDICD WHERE a.ketluan>0 AND A.IdKhamBenh=" + IdKhamBenh + @" union ALL SELECT distinct b.MOTACD_edit,c.maicd FROM KHAMBENH A inner JOIN CHANDOANPHOIHOP B ON a.IDKHAMBENH=B.IDKHAMBENH LEFT JOIN CHANDOANICD C ON c.IDICD=b.IDICD WHERE A.IdKhamBenh=" + IdKhamBenh; DataTable dt_cd = DataAcess.Connect.GetTable(nvk_sq); System.Collections.Generic.List <String> lstC = new System.Collections.Generic.List <string>(); if (dt_cd != null && dt_cd.Rows.Count > 0) { nvk_listMoTaIcd = ""; nvk_listMaIcd = ""; for (int i = 0; i < dt_cd.Rows.Count; i++) { if (lstC.IndexOf(dt_cd.Rows[i]["maicd"].ToString()) == -1) { nvk_listMaIcd += " " + dt_cd.Rows[i]["maicd"].ToString() + " -"; nvk_listMoTaIcd += " " + dt_cd.Rows[i]["MOTACD_edit"].ToString() + " -"; lstC.Add(nvk_listMaIcd); } } nvk_listMaIcd = nvk_listMaIcd.TrimEnd('-'); nvk_listMoTaIcd = nvk_listMoTaIcd.TrimEnd('-'); } }
static void FindDups(string strFilename) { var lStrings = new System.Collections.Generic.List <string>(); using (var objStream = new System.IO.StreamReader(strFilename, System.Text.Encoding.UTF8)) { if (objStream != null) { Console.WriteLine("Begin check dupe strings...\n"); while (!objStream.EndOfStream) { var strNewString = objStream.ReadLine(); var intFoundDupeIndex = lStrings.IndexOf(strNewString); var longProgress = objStream.BaseStream.Position / (objStream.BaseStream.Length / 100); Console.CursorLeft = 0; Console.Write(longProgress.ToString("D3") + "%"); if (intFoundDupeIndex != -1) { Console.CursorLeft = 0; Console.WriteLine("Found dupe: " + intFoundDupeIndex.ToString() + " = " + (lStrings.Count - 1)); } else { lStrings.Add(strNewString); } } objStream.Close(); } } lStrings.Clear(); Console.WriteLine("\n\nEnd"); Console.ReadKey(); }
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { StandardValuesCollection dataSourceNames = _standardValues; if (null == _standardValues) { // Get the sources rowset for the SQLOLEDB enumerator DataTable table = (new OleDbEnumerator()).GetElements(); DataColumn column2 = table.Columns["SOURCES_NAME"]; DataColumn column5 = table.Columns["SOURCES_TYPE"]; //DataColumn column4 = table.Columns["SOURCES_DESCRIPTION"]; System.Collections.Generic.List <string> providerNames = new System.Collections.Generic.List <string>(table.Rows.Count); foreach (DataRow row in table.Rows) { int sourceType = (int)row[column5]; if (DBSOURCETYPE_DATASOURCE_TDP == sourceType || DBSOURCETYPE_DATASOURCE_MDP == sourceType) { string progid = (string)row[column2]; if (!OleDbConnectionString.IsMSDASQL(progid.ToLowerInvariant())) { if (0 > providerNames.IndexOf(progid)) { providerNames.Add(progid); } } } } // Create the standard values collection that contains the sources dataSourceNames = new StandardValuesCollection(providerNames); _standardValues = dataSourceNames; } return(dataSourceNames); }
/// <summary> /// Multithread Methode um Dateien zu analisieren /// </summary> /// <param name="directory"></param> /// <created>janzen_d,2018-09-18</created> private void ThreadTWEquipmentCheck(object directory) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.XmlResolver = null; xmlDocument.Load(directory.ToString()); if (xmlDocument != null) { XmlNode xmlNodeAcc = xmlDocument.SelectSingleNode("EQUIPMENT/ACC_CONF/acc[@mainAppPrefix]"); if (xmlNodeAcc != null) { string[] strRow = new string[11]; listXmlEquipment.Add(xmlDocument); strRow[3] = directory.ToString(); strRow[4] = listXmlEquipment.IndexOf(xmlDocument).ToString(); strRow[5] = xmlNodeAcc.Attributes["mainAppPrefix"].Value.ToString(); XmlNodeList xmlNodeLvls = xmlDocument.SelectNodes("//groups/*[@name]"); XmlNodeList xmlNodeAuth = xmlDocument.SelectNodes("//groups/*[@authorityValue]"); if (xmlNodeLvls.Count > 0) // Mit Gruppen suffix { foreach (XmlNode xmlNodeLvl in xmlNodeLvls) { string tmp = null; try { tmp = xmlNodeLvl.Attributes["name"].Value; } catch (Exception) { throw; } if (tmp != null) { switch (xmlNodeLvl.Name) { case "Level2": strRow[6] = tmp; break; case "Level3": strRow[7] = tmp; break; case "Level4": strRow[8] = tmp; break; case "Level11": strRow[9] = tmp; break; case "Level15": strRow[10] = tmp; break; default: break; } } } } else if (xmlNodeAuth.Count > 0) // Keine Gruppen Suffix konfiguriert { foreach (XmlNode xmlNodeLvl in xmlNodeAuth) { string tmp = null; try { tmp = xmlNodeLvl.Attributes["authorityValue"].Value; } catch (Exception) // TODO { throw; } if (tmp != null) { switch (xmlNodeLvl.Name) { case "Level2": strRow[6] = xmlNodeLvl.Name; break; case "Level3": strRow[7] = xmlNodeLvl.Name; break; case "Level4": strRow[8] = xmlNodeLvl.Name; break; case "Level11": strRow[9] = xmlNodeLvl.Name; break; case "Level15": strRow[10] = xmlNodeLvl.Name; break; default: break; } } } } this.AddRow(strRow); } } }
public int IndexOf(ListViewGroupEx item) => list.IndexOf(item);
public static PXRedirectRequiredException CreatePOOrders2( System.Collections.Generic.List <POFixedDemand> list, DateTime?PurchDate, bool extSort) { POOrderEntry docgraph = PXGraph.CreateInstance <POOrderEntry>(); docgraph.Views.Caches.Add(typeof(POOrderEntry.SOLineSplit3)); POSetup current = docgraph.POSetup.Current; DocumentList <POOrder> documentList1 = new DocumentList <POOrder>((PXGraph)docgraph); Dictionary <string, DocumentList <POLine> > dictionary = new Dictionary <string, DocumentList <POLine> >(); list.Sort((Comparison <POFixedDemand>)((a, b) => { string empty1 = string.Empty; string empty2 = string.Empty; string str; if (a.PlanType == "90") { PX.Objects.IN.InventoryItem inventoryItem = PX.Objects.IN.InventoryItem.PK.Find((PXGraph)docgraph, a.InventoryID); str = string.Format("ZZ.{0}", inventoryItem == null ? (object)string.Empty : (object)inventoryItem.InventoryCD); } else { POOrderEntry.SOLineSplit3 soLineSplit3 = (POOrderEntry.SOLineSplit3)PXSelectBase <POOrderEntry.SOLineSplit3, PXSelect <POOrderEntry.SOLineSplit3, Where <POOrderEntry.SOLineSplit3.planID, Equal <Required <POOrderEntry.SOLineSplit3.planID> > > > .Config> .Select((PXGraph)docgraph, (object)a.PlanID); str = soLineSplit3 == null ? string.Empty : string.Format("{0}.{1}.{2:D7}", (object)soLineSplit3.OrderType, (object)soLineSplit3.OrderNbr, (object)soLineSplit3.SortOrder.GetValueOrDefault()); } string strB; if (b.PlanType == "90") { PX.Objects.IN.InventoryItem inventoryItem = PX.Objects.IN.InventoryItem.PK.Find((PXGraph)docgraph, b.InventoryID); strB = string.Format("ZZ.{0}", inventoryItem == null ? (object)string.Empty : (object)inventoryItem.InventoryCD); } else { POOrderEntry.SOLineSplit3 soLineSplit3 = (POOrderEntry.SOLineSplit3)PXSelectBase <POOrderEntry.SOLineSplit3, PXSelect <POOrderEntry.SOLineSplit3, Where <POOrderEntry.SOLineSplit3.planID, Equal <Required <POOrderEntry.SOLineSplit3.planID> > > > .Config> .Select((PXGraph)docgraph, (object)b.PlanID); strB = soLineSplit3 == null ? string.Empty : string.Format("{0}.{1}.{2:D7}", (object)soLineSplit3.OrderType, (object)soLineSplit3.OrderNbr, (object)soLineSplit3.SortOrder.GetValueOrDefault()); } return(str.CompareTo(strB)); })); POOrder poOrder1 = (POOrder)null; bool flag1 = false; foreach (POFixedDemand demand in list) { if (!(demand.FixedSource != "P")) { string OrderType = demand.PlanType == "6D" ? "DP" : (demand.PlanType == "6E" ? "DP" : "RO"); string str1 = (string)null; int? nullable1 = demand.VendorID; int num1; if (nullable1.HasValue) { nullable1 = demand.VendorLocationID; num1 = !nullable1.HasValue ? 1 : 0; } else { num1 = 1; } if (num1 != 0) { PXProcessing <POFixedDemand> .SetWarning(list.IndexOf(demand), "Vendor and vendor location should be defined."); } else { PXErrorLevel pxErrorLevel = PXErrorLevel.RowInfo; string empty = string.Empty; try { PX.Objects.SO.SOOrder soOrder = (PX.Objects.SO.SOOrder) PXSelectBase <PX.Objects.SO.SOOrder, PXSelect <PX.Objects.SO.SOOrder, Where <PX.Objects.SO.SOOrder.noteID, Equal <Required <PX.Objects.SO.SOOrder.noteID> > > > .Config> .Select((PXGraph)docgraph, (object)demand.RefNoteID); POOrderEntry.SOLineSplit3 soLineSplit3 = (POOrderEntry.SOLineSplit3) PXSelectBase <POOrderEntry.SOLineSplit3, PXSelect <POOrderEntry.SOLineSplit3, Where <POOrderEntry.SOLineSplit3.planID, Equal <Required <POOrderEntry.SOLineSplit3.planID> > > > .Config> .Select((PXGraph)docgraph, (object)demand.PlanID); string str2 = (string)null; string str3 = (string)null; if (demand.PlanType == "6B" || demand.PlanType == "6E") { str2 = soLineSplit3.POType; str3 = soLineSplit3.PONbr; } System.Collections.Generic.List <FieldLookup> fieldLookupList1 = new System.Collections.Generic.List <FieldLookup>() { (FieldLookup) new FieldLookup <POOrder.orderType>((object)OrderType), (FieldLookup) new FieldLookup <POOrder.vendorID>((object)demand.VendorID), (FieldLookup) new FieldLookup <POOrder.vendorLocationID>((object)demand.VendorLocationID), (FieldLookup) new FieldLookup <POOrder.bLOrderNbr>((object)str3) }; if (OrderType == "RO") { bool?projectPerDocument = docgraph.apsetup.Current.RequireSingleProjectPerDocument; bool flag2 = true; if (projectPerDocument.GetValueOrDefault() == flag2 & projectPerDocument.HasValue) { nullable1 = demand.ProjectID; int?nullable2 = nullable1.HasValue ? nullable1 : ProjectDefaultAttribute.NonProject(); fieldLookupList1.Add((FieldLookup) new FieldLookup <POOrder.projectID>((object)nullable2)); } int num2; if (poOrder1 != null && poOrder1.ShipDestType == "L") { nullable1 = poOrder1.SiteID; num2 = !nullable1.HasValue ? 1 : 0; } else { num2 = 0; } if (num2 == 0) { fieldLookupList1.Add((FieldLookup) new FieldLookup <POOrder.siteID>((object)demand.POSiteID)); } } else if (OrderType == "DP") { fieldLookupList1.Add((FieldLookup) new FieldLookup <POOrder.sOOrderType>((object)soLineSplit3.OrderType)); fieldLookupList1.Add((FieldLookup) new FieldLookup <POOrder.sOOrderNbr>((object)soLineSplit3.OrderNbr)); } else { fieldLookupList1.Add((FieldLookup) new FieldLookup <POOrder.shipToBAccountID>((object)soOrder.CustomerID)); fieldLookupList1.Add((FieldLookup) new FieldLookup <POOrder.shipToLocationID>((object)soOrder.CustomerLocationID)); fieldLookupList1.Add((FieldLookup) new FieldLookup <POOrder.siteID>((object)demand.POSiteID)); } poOrder1 = documentList1.Find(fieldLookupList1.ToArray()) ?? new POOrder(); if (poOrder1.OrderNbr == null) { docgraph.Clear(); poOrder1.OrderType = OrderType; poOrder1 = PXCache <POOrder> .CreateCopy(docgraph.Document.Insert(poOrder1)); poOrder1.VendorID = demand.VendorID; poOrder1.VendorLocationID = demand.VendorLocationID; poOrder1.SiteID = demand.POSiteID; nullable1 = demand.ProjectID; if (nullable1.HasValue) { poOrder1.ProjectID = demand.ProjectID; } poOrder1.OrderDate = PurchDate; poOrder1.BLType = str2; poOrder1.BLOrderNbr = str3; if (OrderType == "DP" | extSort) { poOrder1.SOOrderType = soLineSplit3.OrderType; poOrder1.SOOrderNbr = soLineSplit3.OrderNbr; } if (!string.IsNullOrEmpty(poOrder1.BLOrderNbr)) { POOrder poOrder2 = (POOrder)PXSelectBase <POOrder, PXSelect <POOrder, Where <POOrder.orderType, Equal <Current <POOrder.bLType> >, And <POOrder.orderNbr, Equal <Current <POOrder.bLOrderNbr> > > > > .Config> .SelectSingleBound((PXGraph)docgraph, new object[1] { (object)poOrder1 }); if (poOrder2 != null) { poOrder1.VendorRefNbr = poOrder2.VendorRefNbr; } } if (OrderType == "DP") { poOrder1.ShipDestType = "C"; poOrder1.ShipToBAccountID = soOrder.CustomerID; poOrder1.ShipToLocationID = soOrder.CustomerLocationID; } else if (current.ShipDestType == "S") { poOrder1.ShipDestType = "S"; poOrder1.SiteID = demand.POSiteID; } if (PXAccess.FeatureInstalled <PX.Objects.CS.FeaturesSet.multicurrency>()) { docgraph.currencyinfo.Current.CuryID = (string)null; } poOrder1 = docgraph.Document.Update(poOrder1); if (OrderType == "DP") { SOAddress soAddress = (SOAddress)PXSelectBase <SOAddress, PXSelect <SOAddress, Where <SOAddress.addressID, Equal <Required <PX.Objects.SO.SOOrder.shipAddressID> > > > .Config> .Select((PXGraph)docgraph, (object)soOrder.ShipAddressID); bool?isDefaultAddress = soAddress.IsDefaultAddress; bool flag2 = false; if (isDefaultAddress.GetValueOrDefault() == flag2 & isDefaultAddress.HasValue) { SharedRecordAttribute.CopyRecord <POOrder.shipAddressID>(docgraph.Document.Cache, (object)poOrder1, (object)soAddress, true); } SOContact soContact = (SOContact)PXSelectBase <SOContact, PXSelect <SOContact, Where <SOContact.contactID, Equal <Required <PX.Objects.SO.SOOrder.shipContactID> > > > .Config> .Select((PXGraph)docgraph, (object)soOrder.ShipContactID); bool?isDefaultContact = soContact.IsDefaultContact; bool flag3 = false; if (isDefaultContact.GetValueOrDefault() == flag3 & isDefaultContact.HasValue) { SharedRecordAttribute.CopyRecord <POOrder.shipContactID>(docgraph.Document.Cache, (object)poOrder1, (object)soContact, true); } DateTime?expectedDate = poOrder1.ExpectedDate; DateTime?requestDate = soOrder.RequestDate; if (expectedDate.HasValue & requestDate.HasValue && expectedDate.GetValueOrDefault() < requestDate.GetValueOrDefault()) { poOrder1 = PXCache <POOrder> .CreateCopy(poOrder1); poOrder1.ExpectedDate = soOrder.RequestDate; poOrder1 = docgraph.Document.Update(poOrder1); } } } else if (!docgraph.Document.Cache.ObjectsEqual((object)docgraph.Document.Current, (object)poOrder1)) { docgraph.Document.Current = (POOrder)docgraph.Document.Search <POOrder.orderNbr>((object)poOrder1.OrderNbr, (object)poOrder1.OrderType); } poOrder1.UpdateVendorCost = new bool?(false); POLine poLine1 = (POLine)null; DocumentList <POLine> documentList2; if (!dictionary.TryGetValue(demand.PlanType, out documentList2)) { documentList2 = dictionary[demand.PlanType] = new DocumentList <POLine>((PXGraph)docgraph); } if (OrderType == "RO" && demand.PlanType != "6B") { System.Collections.Generic.List <FieldLookup> fieldLookupList2 = new System.Collections.Generic.List <FieldLookup>(); fieldLookupList2.Add((FieldLookup) new FieldLookup <POLine.vendorID>((object)demand.VendorID)); fieldLookupList2.Add((FieldLookup) new FieldLookup <POLine.vendorLocationID>((object)demand.VendorLocationID)); fieldLookupList2.Add((FieldLookup) new FieldLookup <POLine.siteID>((object)demand.POSiteID)); fieldLookupList2.Add((FieldLookup) new FieldLookup <POLine.inventoryID>((object)demand.InventoryID)); fieldLookupList2.Add((FieldLookup) new FieldLookup <POLine.subItemID>((object)demand.SubItemID)); fieldLookupList2.Add((FieldLookup) new FieldLookup <POLine.requestedDate>((object)(DateTime?)soLineSplit3?.ShipDate)); int?nullable2; if (soLineSplit3 == null) { nullable1 = new int?(); nullable2 = nullable1; } else { nullable2 = soLineSplit3.ProjectID; } fieldLookupList2.Add((FieldLookup) new FieldLookup <POLine.projectID>((object)nullable2)); int?nullable3; if (soLineSplit3 == null) { nullable1 = new int?(); nullable3 = nullable1; } else { nullable3 = soLineSplit3.TaskID; } fieldLookupList2.Add((FieldLookup) new FieldLookup <POLine.taskID>((object)nullable3)); int?nullable4; if (soLineSplit3 == null) { nullable1 = new int?(); nullable4 = nullable1; } else { nullable4 = soLineSplit3.CostCodeID; } fieldLookupList2.Add((FieldLookup) new FieldLookup <POLine.costCodeID>((object)nullable4)); int?nullable5; if (soLineSplit3 == null) { nullable1 = new int?(); nullable5 = nullable1; } else { nullable5 = soLineSplit3.LineNbr; } fieldLookupList2.Add((FieldLookup) new FieldLookup <POLine.lineNbr>((object)nullable5)); System.Collections.Generic.List <FieldLookup> fieldLookupList3 = fieldLookupList2; bool?nullable6 = current.CopyLineDescrSO; bool flag2 = true; if (nullable6.GetValueOrDefault() == flag2 & nullable6.HasValue && soLineSplit3 != null) { fieldLookupList3.Add((FieldLookup) new FieldLookup <POLine.tranDesc>((object)soLineSplit3.TranDesc)); poLine1 = documentList2.Find(fieldLookupList3.ToArray()); int num2; if (poLine1 != null) { nullable6 = current.CopyLineNoteSO; bool flag3 = true; if (nullable6.GetValueOrDefault() == flag3 & nullable6.HasValue) { num2 = PXNoteAttribute.GetNote(docgraph.Caches[typeof(POLine)], (object)poLine1) != null ? 1 : (PXNoteAttribute.GetNote(docgraph.Caches[typeof(POOrderEntry.SOLineSplit3)], (object)soLineSplit3) != null ? 1 : 0); goto label_67; } } num2 = 0; label_67: if (num2 != 0) { poLine1 = (POLine)null; } } else { poLine1 = documentList2.Find(fieldLookupList3.ToArray()); } } POLine dest = poLine1 ?? new POLine(); POLine copy1; if (dest.OrderNbr == null) { docgraph.FillPOLineFromDemand(dest, demand, OrderType, soLineSplit3); POLine line = docgraph.Transactions.Insert(dest); bool? copyLineNoteSo = current.CopyLineNoteSO; bool flag2 = true; if (copyLineNoteSo.GetValueOrDefault() == flag2 & copyLineNoteSo.HasValue && soLineSplit3 != null) { PXNoteAttribute.SetNote(docgraph.Transactions.Cache, (object)line, PXNoteAttribute.GetNote(docgraph.Caches[typeof(POOrderEntry.SOLineSplit3)], (object)soLineSplit3)); } if (docgraph.onCopyPOLineFields != null) { docgraph.onCopyPOLineFields(demand, line); } copy1 = PXCache <POLine> .CreateCopy(line); documentList2.Add(copy1); } else { copy1 = PXCache <POLine> .CreateCopy((POLine)PXSelectBase <POLine, PXSelect <POLine, Where <POLine.orderType, Equal <Current <POOrder.orderType> >, And <POLine.orderNbr, Equal <Current <POOrder.orderNbr> >, And <POLine.lineNbr, Equal <Current <POLine.lineNbr> > > > > > .Config> .SelectSingleBound((PXGraph)docgraph, new object[1] { (object)dest })); POLine poLine2 = copy1; Decimal?orderQty1 = poLine2.OrderQty; Decimal?orderQty2 = demand.OrderQty; poLine2.OrderQty = orderQty1.HasValue & orderQty2.HasValue ? new Decimal?(orderQty1.GetValueOrDefault() + orderQty2.GetValueOrDefault()) : new Decimal?(); } if (demand.PlanType == "6B" || demand.PlanType == "6E") { str1 = demand.PlanType == "6B" ? "66" : "6D"; demand.FixedSource = "P"; copy1.POType = soLineSplit3.POType; copy1.PONbr = soLineSplit3.PONbr; copy1.POLineNbr = soLineSplit3.POLineNbr; POLine poLine2 = (POLine)PXSelectBase <POLine, PXSelect <POLine, Where <POLine.orderType, Equal <Current <POLine.pOType> >, And <POLine.orderNbr, Equal <Current <POLine.pONbr> >, And <POLine.lineNbr, Equal <Current <POLine.pOLineNbr> > > > > > .Config> .SelectSingleBound((PXGraph)docgraph, new object[1] { (object)copy1 }); if (poLine2 != null) { Decimal?nullable2 = demand.PlanQty; Decimal?baseOpenQty = poLine2.BaseOpenQty; if (nullable2.GetValueOrDefault() > baseOpenQty.GetValueOrDefault() & (nullable2.HasValue & baseOpenQty.HasValue)) { POLine poLine3 = copy1; Decimal?orderQty = poLine3.OrderQty; nullable2 = demand.OrderQty; poLine3.OrderQty = orderQty.HasValue & nullable2.HasValue ? new Decimal?(orderQty.GetValueOrDefault() - nullable2.GetValueOrDefault()) : new Decimal?(); if (string.Equals(copy1.UOM, poLine2.UOM)) { POLine poLine4 = copy1; nullable2 = poLine4.OrderQty; Decimal?openQty = poLine2.OpenQty; poLine4.OrderQty = nullable2.HasValue & openQty.HasValue ? new Decimal?(nullable2.GetValueOrDefault() + openQty.GetValueOrDefault()) : new Decimal?(); } else { PXDBQuantityAttribute.CalcBaseQty <POLine.orderQty>(docgraph.Transactions.Cache, (object)copy1); POLine poLine4 = copy1; Decimal?baseOrderQty = poLine4.BaseOrderQty; nullable2 = poLine2.BaseOpenQty; poLine4.BaseOrderQty = baseOrderQty.HasValue & nullable2.HasValue ? new Decimal?(baseOrderQty.GetValueOrDefault() + nullable2.GetValueOrDefault()) : new Decimal?(); PXDBQuantityAttribute.CalcTranQty <POLine.orderQty>(docgraph.Transactions.Cache, (object)copy1); } pxErrorLevel = PXErrorLevel.RowWarning; empty += PXMessages.LocalizeFormatNoPrefixNLA("Order Quantity reduced to Blanket Order: '{0}' Open Qty. for this item", (object)copy1.PONbr); } copy1.CuryUnitCost = poLine2.CuryUnitCost; copy1.UnitCost = poLine2.UnitCost; } } copy1.SiteID = POCreate_Extension.GetWasrehouseByBranch((PXGraph)docgraph, copy1.BranchID); short? vleadTime = docgraph.location.Current.VLeadTime; POLine poLine5 = copy1; DateTime dateTime = soLineSplit3.ShipDate.Value; ref DateTime local = ref dateTime; short? nullable7 = vleadTime; nullable1 = nullable7.HasValue ? new int?((int)nullable7.GetValueOrDefault()) : new int?(); int num3 = 0; double num4 = nullable1.GetValueOrDefault() > num3 & nullable1.HasValue ? (double)-vleadTime.Value : -14.0; DateTime?nullable8 = new DateTime?(local.AddDays(num4)); poLine5.RequestedDate = nullable8; POLine poLine6 = docgraph.Transactions.Update(copy1); PXCache cach = docgraph.Caches[typeof(INItemPlan)]; POCreate_Extension.CreateSplitDemand2(cach, demand); cach.SetStatus((object)demand, PXEntryStatus.Updated); demand.SupplyPlanID = poLine6.PlanID; if (str1 != null) { cach.RaiseRowDeleted((object)demand); demand.PlanType = str1; cach.RaiseRowInserted((object)demand); } if (soLineSplit3 != null) { int num2; if (demand.AlternateID != null) { nullable1 = demand.InventoryID; num2 = nullable1.HasValue ? 1 : 0; } else { num2 = 0; } if (num2 != 0) { PXSelectBase <INItemXRef> pxSelectBase = (PXSelectBase <INItemXRef>) new PXSelect <INItemXRef, Where <INItemXRef.inventoryID, Equal <Required <INItemXRef.inventoryID> >, And <INItemXRef.alternateID, Equal <Required <INItemXRef.alternateID> > > > >((PXGraph)docgraph); INItemXRef inItemXref1 = (INItemXRef)pxSelectBase.Select((object)demand.InventoryID, (object)demand.AlternateID); if (inItemXref1 != null && inItemXref1.AlternateType == "GLBL") { int num5; if (poLine6.AlternateID != null) { nullable1 = poLine6.InventoryID; num5 = nullable1.HasValue ? 1 : 0; } else { num5 = 0; } if (num5 != 0) { INItemXRef inItemXref2 = (INItemXRef)pxSelectBase.Select((object)poLine6.InventoryID, (object)poLine6.AlternateID); if (inItemXref2 != null && inItemXref2.AlternateType == "GLBL") { poLine6.AlternateID = demand.AlternateID; } } else { poLine6.AlternateID = demand.AlternateID; } } } soLineSplit3.POType = poLine6.OrderType; soLineSplit3.PONbr = poLine6.OrderNbr; soLineSplit3.POLineNbr = poLine6.LineNbr; soLineSplit3.RefNoteID = docgraph.Document.Current.NoteID; PX.Objects.SO.SOLine soLine = SelectFrom <PX.Objects.SO.SOLine> .Where <PX.Objects.SO.SOLine.orderType.IsEqual <P.AsString> .And <PX.Objects.SO.SOLine.orderNbr.IsEqual <P.AsString> .And <PX.Objects.SO.SOLine.lineNbr.IsEqual <P.AsInt> > > > .View.ReadOnly.Select((PXGraph)docgraph, (object)soLineSplit3.OrderType, (object)soLineSplit3.OrderNbr, (object)soLineSplit3.LineNbr); POLineExt extension1 = poLine6.GetExtension <POLineExt>(); SOLineExt extension2 = soLine.GetExtension <SOLineExt>(); extension1.UsrEndCustomerID = extension2.UsrEndCustomerID; extension1.UsrNonStockItem = extension2.UsrNonStockItem; extension1.UsrProjectNbr = extension2.UsrProjectNbr; if (!string.IsNullOrEmpty(extension2.UsrProjectNbr)) { FLXProject flxProject = SelectFrom <FLXProject> .Where <FLXProject.projectNbr.IsEqual <P.AsString> > .View.ReadOnly.Select((PXGraph)docgraph, (object)extension2.UsrProjectNbr); extension1.UsrCust2Factory = flxProject.Cust2Factory; extension1.UsrFactoryPN = flxProject.FactoryPN; } docgraph.GetExtension <POOrderEntry_Extension>().UpdateSOLine(soLineSplit3, docgraph.Document.Current.VendorID, true); docgraph.FixedDemand.Cache.SetStatus((object)soLineSplit3, PXEntryStatus.Updated); } if (docgraph.Transactions.Cache.IsInsertedUpdatedDeleted) { using (PXTransactionScope transactionScope = new PXTransactionScope()) { docgraph.Save.Press(); if (demand.PlanType == "90") { docgraph.Replenihment.Current = (INReplenishmentOrder)docgraph.Replenihment.Search <INReplenishmentOrder.noteID>((object)demand.RefNoteID); if (docgraph.Replenihment.Current != null) { INReplenishmentLine copy2 = PXCache <INReplenishmentLine> .CreateCopy(docgraph.ReplenishmentLines.Insert(new INReplenishmentLine())); copy2.InventoryID = poLine6.InventoryID; copy2.SubItemID = poLine6.SubItemID; copy2.UOM = poLine6.UOM; copy2.VendorID = poLine6.VendorID; copy2.VendorLocationID = poLine6.VendorLocationID; copy2.Qty = poLine6.OrderQty; copy2.POType = poLine6.OrderType; copy2.PONbr = docgraph.Document.Current.OrderNbr; copy2.POLineNbr = poLine6.LineNbr; copy2.SiteID = demand.POSiteID; copy2.PlanID = demand.PlanID; docgraph.ReplenishmentLines.Update(copy2); docgraph.Caches[typeof(INItemPlan)].Delete((object)demand); docgraph.Save.Press(); } } transactionScope.Complete(); } if (pxErrorLevel == PXErrorLevel.RowInfo) { PXProcessing <POFixedDemand> .SetInfo(list.IndexOf(demand), PXMessages.LocalizeFormatNoPrefixNLA("Purchase Order '{0}' created.", (object)docgraph.Document.Current.OrderNbr) + "\r\n" + empty); } else { PXProcessing <POFixedDemand> .SetWarning(list.IndexOf(demand), PXMessages.LocalizeFormatNoPrefixNLA("Purchase Order '{0}' created.", (object)docgraph.Document.Current.OrderNbr) + "\r\n" + empty); } if (documentList1.Find((object)docgraph.Document.Current) == null) { documentList1.Add(docgraph.Document.Current); } } }
public int indexOf(T t) { return(_list.IndexOf(t)); }
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { StandardValuesCollection dataSourceNames = _standardValues; if (null == _standardValues) { // Get the sources rowset for the SQLOLEDB enumerator DataTable table = (new OleDbEnumerator()).GetElements(); DataColumn column2 = table.Columns["SOURCES_NAME"]; DataColumn column5 = table.Columns["SOURCES_TYPE"]; //DataColumn column4 = table.Columns["SOURCES_DESCRIPTION"]; System.Collections.Generic.List<string> providerNames = new System.Collections.Generic.List<string>(table.Rows.Count); foreach(DataRow row in table.Rows) { int sourceType = (int)row[column5]; if (DBSOURCETYPE_DATASOURCE_TDP == sourceType || DBSOURCETYPE_DATASOURCE_MDP == sourceType) { string progid = (string)row[column2]; if (!OleDbConnectionString.IsMSDASQL(progid.ToLower(CultureInfo.InvariantCulture))) { if (0 > providerNames.IndexOf(progid)) { providerNames.Add(progid); } } } } // Create the standard values collection that contains the sources dataSourceNames = new StandardValuesCollection(providerNames); _standardValues = dataSourceNames; } return dataSourceNames; }
public int IndexOf(T item) { return(list.IndexOf(item)); }
private void Setup() { if (!this.locked) { if (this.recurseLock) { Debug.LogError("Recursion in setup hit itself, some VisClass has super set to something which references itself", this); } else { this.recurseLock = true; System.Collections.Generic.List <VisQuery> list = new System.Collections.Generic.List <VisQuery>(); HashSet <VisQuery> hset = new HashSet <VisQuery>(); Dictionary <string, VisQuery> dictionary = new Dictionary <string, VisQuery>(); if (this._super != null) { this._super.Setup(); if (this.keys != null) { for (int i = 0; i < this.keys.Length; i++) { string str = this.keys[i]; if (!string.IsNullOrEmpty(str)) { int num2; VisQuery query = this.values[i]; if (this._super.members.TryGetValue(str, out num2)) { VisQuery item = this._super.instance[num2]; if (item == query) { if (item != null) { hset.Add(item); dictionary.Add(str, item); } } else if (query != null) { dictionary.Add(str, query); hset.Add(query); } } else if (query != null) { dictionary.Add(str, query); hset.Add(query); } } } } this.BuildMembers(list, hset); } else { for (int j = 0; j < this.keys.Length; j++) { string str2 = this.keys[j]; if (!string.IsNullOrEmpty(str2)) { VisQuery query3 = this.values[j]; if (query3 != null) { dictionary.Add(str2, query3); if (hset.Add(query3)) { list.Add(query3); } } } } } this.members = new Dictionary <string, int>(dictionary.Count); foreach (KeyValuePair <string, VisQuery> pair in dictionary) { this.members.Add(pair.Key, list.IndexOf(pair.Value)); } this.instance = list.ToArray(); this.recurseLock = false; this.locked = true; } } }
/// <summary> /// Property helper for Files & WordFiles, ensures the data retrieved /// from those two properties is 'in sync' /// </summary> private void PrepareForSerialization() { if (_SerializePreparationDone) return; _FileList = new List<File>(); _WordfileArray = new CatalogWordFile[_Index.Count]; Word[] wordArray = new Word[_Index.Count]; _Index.Values.CopyTo(wordArray, 0); // go through all the words for (int i = 0; i < wordArray.Length; i++) { // first, add all files to the 'flist' collection foreach (File f in wordArray[i].Files) { if (!_FileList.Contains(f)) { _FileList.Add(f); } } // now go through again and use the indexes CatalogWordFile wf = new CatalogWordFile(); wf.Text = wordArray[i].Text; foreach (File f in wordArray[i].Files) { wf.FileIds.Add(_FileList.IndexOf(f)); } _WordfileArray[i] = wf; } _SerializePreparationDone = true; }
private void FixList() { StoreDBEntities storeDBEntities = new StoreDBEntities(); System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>(); System.Collections.Generic.List<long> list2 = new System.Collections.Generic.List<long>(); System.Collections.Generic.List<long> list3 = new System.Collections.Generic.List<long>(); System.Collections.Generic.List<DailyTransaction> list4 = ( from x in storeDBEntities.DailyTransactions orderby x.Date select x).ToList<DailyTransaction>(); for (int i = 0; i < list4.Count; i++) { if (!list.Contains(list4[i].Date)) { list.Add(list4[i].Date); list2.Add(0L); list3.Add(0L); } if (list4[i].Payment) { System.Collections.Generic.List<long> list5; int index; (list5 = list2)[index = list.IndexOf(list4[i].Date)] = list5[index] + list4[i].Price; } else { System.Collections.Generic.List<long> list6; int index2; (list6 = list3)[index2 = list.IndexOf(list4[i].Date)] = list6[index2] + list4[i].Price; } } ListViewItem[] array = new ListViewItem[list.Count]; for (int j = 0; j < list.Count; j++) { long num = list2[j] - list3[j]; array[j] = new ListViewItem(new string[] { list[j], list2[j].ToString("0,0"), list3[j].ToString("0,0"), ((num > 0L) ? "+" : "") + num.ToString("0,0") }); if (num != 0L) { array[j].SubItems[3].ForeColor = System.Drawing.Color.OrangeRed; } } this.lstAllTrans.Items.Clear(); this.lstAllTrans.Items.AddRange(array); lstAllTrans.EnsureVisible(lstAllTrans.Items.Count - 1); Utilities.ListViewFixColumns(lstAllTrans); }
/// <summary> /// Imports (create) a document from a xmlrepresentation of a document, used by the packager /// </summary> /// <param name="ParentId">The id to import to</param> /// <param name="Creator">Creator of the new document</param> /// <param name="Source">Xmlsource</param> public static int Import(int ParentId, User Creator, XmlElement Source) { // check what schema is used for the xml bool sourceIsLegacySchema = Source.Name.ToLower() == "node" ? true : false; // check whether or not to create a new document int id = int.Parse(Source.GetAttribute("id")); Document d = null; if (Document.IsDocument(id)) { try { // if the parent is the same, we'll update the existing document. Else we'll create a new document below d = new Document(id); if (d.ParentId != ParentId) d = null; } catch { } } // document either didn't exist or had another parent so we'll create a new one if (d == null) { string nodeTypeAlias = sourceIsLegacySchema ? Source.GetAttribute("nodeTypeAlias") : Source.Name; d = MakeNew( Source.GetAttribute("nodeName"), DocumentType.GetByAlias(nodeTypeAlias), Creator, ParentId); } else { // update name of the document d.Text = Source.GetAttribute("nodeName"); } d.CreateDateTime = DateTime.Parse(Source.GetAttribute("createDate")); // Properties string propertyXPath = sourceIsLegacySchema ? "data" : "* [not(@isDoc)]"; foreach (XmlElement n in Source.SelectNodes(propertyXPath)) { string propertyAlias = sourceIsLegacySchema ? n.GetAttribute("alias") : n.Name; Property prop = d.getProperty(propertyAlias); string propValue = xmlHelper.GetNodeValue(n); if (prop != null) { // only update real values if (!String.IsNullOrEmpty(propValue)) { //test if the property has prevalues, of so, try to convert the imported values so they match the new ones SortedList prevals = cms.businesslogic.datatype.PreValues.GetPreValues(prop.PropertyType.DataTypeDefinition.Id); //Okey we found some prevalue, let's replace the vals with some ids if (prevals.Count > 0) { System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>(propValue.Split(',')); foreach (DictionaryEntry item in prevals) { string pval = ((umbraco.cms.businesslogic.datatype.PreValue)item.Value).Value; string pid = ((umbraco.cms.businesslogic.datatype.PreValue)item.Value).Id.ToString(); if (list.Contains(pval)) list[list.IndexOf(pval)] = pid; } //join the list of new values and return it as the new property value System.Text.StringBuilder builder = new System.Text.StringBuilder(); bool isFirst = true; foreach (string str in list) { if (!isFirst) builder.Append(","); builder.Append(str); isFirst = false; } prop.Value = builder.ToString(); } else prop.Value = propValue; } } else { LogHelper.Warn<Document>(String.Format("Couldn't import property '{0}' as the property type doesn't exist on this document type", propertyAlias)); } } d.Save(); // Subpages string subXPath = sourceIsLegacySchema ? "node" : "* [@isDoc]"; foreach (XmlElement n in Source.SelectNodes(subXPath)) Import(d.Id, Creator, n); return d.Id; }
public int IndexOf(ListViewGroupEx item) { return(list.IndexOf(item)); }
public int ReisenIndexOf(Reise r) { return(dieReisen.IndexOf(r)); }
private bool CreateTransaction() { if (total > 0) { // Are you sure you want to save these amounts.... DialogResult result = DialogResult.None; using (frmMessage dialog = new frmMessage(LSRetailPosis.ApplicationLocalizer.Language.Translate(1953), System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question)) { LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog); result = dialog.DialogResult; } if (result == System.Windows.Forms.DialogResult.Yes) { TenderLineItem tenderLine; int i = 0; //counter variable for the int Array // Did we count cash? if (cashCounted) { TenderViewModel cashViewTender = gridSource.First(tender => tender.TenderOperationType == PosisOperations.PayCash); string cashTenderId = cashViewTender.TenderTypeId; string cashTenderDesc = cashViewTender.TenderName; string cashTenderCode = ApplicationSettings.Terminal.StoreCurrency; decimal totalCashAmount = gridSource.Sum(tender => tender.TenderOperationType == PosisOperations.PayCash ? tender.Total : 0m); //This allows the operator to recount a given number of times. if (transaction is TenderDeclarationTransaction) { int rowHandle = gridSource.IndexOf(cashViewTender); if (NeedForRecount(cashTenderId, totalCashAmount, cashTenderDesc, ref i)) { // Select the cash row if (rowHandle != -1) { gvTenders.SelectRow(rowHandle); } return(false); } else { // Disable the cash tender row cashViewTender.Enabled = false; gvTenders.InvalidateRow(rowHandle); i++; //proceed to the next counter that belongs to the next tendertype. } } //Adding a Tenderline (or not) if (totalCashAmount > 0) { tenderLine = (TenderLineItem)Dialog.InternalApplication.BusinessLogic.Utility.CreateTenderLineItem(); tenderLine.Amount = totalCashAmount; tenderLine.TenderTypeId = cashTenderId; tenderLine.Description = cashTenderDesc; tenderLine.ExchrateMST = Dialog.InternalApplication.Services.Currency.ExchangeRate(transaction.StoreCurrencyCode) * 100; tenderLine.CompanyCurrencyAmount = Dialog.InternalApplication.Services.Currency.CurrencyToCurrency(transaction.StoreCurrencyCode, ApplicationSettings.Terminal.CompanyCurrency, totalCashAmount); tenderLine.CurrencyCode = transaction.StoreCurrencyCode; transaction.Add(tenderLine); } } // Did we count other tenders? if (otherTendersCounted) { List <TenderViewModel> otherTenders = gridSource.FindAll( tender => tender.TenderOperationType != PosisOperations.PayCash && tender.TenderOperationType != PosisOperations.PayCurrency); foreach (TenderViewModel otherCount in otherTenders) { if (transaction is TenderDeclarationTransaction) { int rowHandle = gridSource.IndexOf(otherCount); if (NeedForRecount(otherCount.TenderTypeId, otherCount.Total, otherCount.TenderName, ref i)) { // Select the row if (rowHandle != -1) { gvTenders.SelectRow(rowHandle); } return(false); } else { // Disable the row otherCount.Enabled = false; gvTenders.InvalidateRow(rowHandle); i++; } } if (otherCount.Total > 0) { tenderLine = (TenderLineItem)Dialog.InternalApplication.BusinessLogic.Utility.CreateTenderLineItem(); tenderLine.Amount = otherCount.Total; tenderLine.TenderTypeId = otherCount.TenderTypeId; tenderLine.Description = otherCount.TenderName; tenderLine.ExchrateMST = Dialog.InternalApplication.Services.Currency.ExchangeRate(transaction.StoreCurrencyCode) * 100; tenderLine.CompanyCurrencyAmount = Dialog.InternalApplication.Services.Currency.CurrencyToCurrency(transaction.StoreCurrencyCode, ApplicationSettings.Terminal.CompanyCurrency, otherCount.Total); tenderLine.CurrencyCode = transaction.StoreCurrencyCode; transaction.Add(tenderLine); } } } // Did we count foreign currency? if (foreignCurrencyCounted) { List <TenderViewModel> currencyTenders = gridSource.FindAll(tender => tender.TenderOperationType == PosisOperations.PayCurrency); foreach (TenderViewModel currencyCount in currencyTenders) { //Convert to StoreCurrency... decimal currAmountInStoreCurr = Dialog.InternalApplication.Services.Currency.CurrencyToCurrency( currencyCount.Currency, ApplicationSettings.Terminal.StoreCurrency, currencyCount.Total); if (transaction is TenderDeclarationTransaction) { int rowHandle = gridSource.IndexOf(currencyCount); if (NeedForRecount(currencyCount.TenderTypeId, currAmountInStoreCurr, currencyCount.Currency, ref i)) { // Select the row if (rowHandle != -1) { gvTenders.SelectRow(rowHandle); } return(false); } else { // Disable the row currencyCount.Enabled = false; gvTenders.InvalidateRow(rowHandle); i++; } } if (currencyCount.Total > 0) { tenderLine = (TenderLineItem)Dialog.InternalApplication.BusinessLogic.Utility.CreateTenderLineItem(); tenderLine.Amount = currencyCount.Total; tenderLine.ForeignCurrencyAmount = currAmountInStoreCurr; tenderLine.CompanyCurrencyAmount = Dialog.InternalApplication.Services.Currency.CurrencyToCurrency(currencyCount.Currency, ApplicationSettings.Terminal.CompanyCurrency, currencyCount.Total); tenderLine.ExchangeRate = ((Dialog.InternalApplication.Services.Currency.ExchangeRate(currencyCount.Currency)) / (Dialog.InternalApplication.Services.Currency.ExchangeRate(ApplicationSettings.Terminal.StoreCurrency))) * 100; tenderLine.ExchrateMST = Dialog.InternalApplication.Services.Currency.ExchangeRate(currencyCount.Currency) * 100; tenderLine.TenderTypeId = currencyCount.TenderTypeId; tenderLine.Description = currencyCount.TenderName; tenderLine.CurrencyCode = currencyCount.Currency; transaction.Add(tenderLine); } } } return(true); } else { return(false); } } // No amount has been entered yet using (frmMessage frm = new frmMessage(LSRetailPosis.ApplicationLocalizer.Language.Translate(1959), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand)) { LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(frm); } return(false); }
/// <summary> /// チェックリストを統合し、string[][]型で返す。 /// </summary> /// <returns></returns> private string[][] mergeMemberC83() { var result = new System.Collections.Generic.List<string[]>(); var recordCircle = new System.Collections.Generic.List<int>(); var Color = new Color(); string[] header = { "Header", "ComicMarketCD-ROMCatalog", "ComicMarket83", "UTF-8", VERSION }; result.Add(header); foreach (ListViewItem item in memberList.Items) { DataContainer obj = item.Tag as DataContainer; if (obj == null) continue; for (int i = 0; i < obj.data.GetLength(0); i++) { if (obj.data[i][0] != "Circle") continue; try { if (recordCircle.IndexOf(int.Parse(obj.data[i][1])) < 0) { result.Add(obj.data[i]); recordCircle.Add(int.Parse(obj.data[i][1])); } else { int m = recordCircle.IndexOf(int.Parse(obj.data[i][1])) + 1; string[] tmp = result.ToArray()[m]; int tmp1 = int.Parse(tmp[2]); int tmp2 = int.Parse(obj.data[i][2]); if (tmp1 == 0) tmp1 = 10; if (tmp2 == 0) tmp2 = 10; if (tmp1 > tmp2) tmp1 = tmp2; if (tmp1 >= 10) tmp1 = 0; tmp[2] = tmp1.ToString(); tmp[17] += obj.data[i][17]; result.RemoveAt(result.Count); result.Add(tmp); } } catch (Exception) { continue; } } } foreach (Color item in Settings.colorSettings) { if (item.label == null) continue; string[] tmpcolor = { "Color", item.number.ToString(), Color.ToBGRColor(item.checkcolor), Color.ToBGRColor(item.printcolor), item.label }; result.Add(tmpcolor); } return result.ToArray(); }