/// <summary> Reads a stem dictionary. Each line contains: /// <pre>word<b>\t</b>stem</pre> /// (i.e. two tab seperated words) /// /// </summary> /// <returns> stem dictionary that overrules the stemming algorithm /// </returns> /// <throws> IOException </throws> public static System.Collections.Hashtable GetStemDict(System.IO.FileInfo wordstemfile) { if (wordstemfile == null) throw new System.NullReferenceException("wordstemfile may not be null"); System.Collections.Hashtable result = new System.Collections.Hashtable(); System.IO.StreamReader br = null; System.IO.StreamReader fr = null; try { fr = new System.IO.StreamReader(wordstemfile.FullName, System.Text.Encoding.Default); br = new System.IO.StreamReader(fr.BaseStream, fr.CurrentEncoding); System.String line; char[] tab = {'\t'}; while ((line = br.ReadLine()) != null) { System.String[] wordstem = line.Split(tab, 2); result[wordstem[0]] = wordstem[1]; } } finally { if (fr != null) fr.Close(); if (br != null) br.Close(); } return result; }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.Regional model) { StringBuilder strSql=new StringBuilder(); strSql.Append("insert into regional("); strSql.Append("RegionalID,RegionalName,RegionalCode,SubRegionalID,RegionalLevel,Orders,LastModifyTime,IsValid,Memo)"); strSql.Append(" values ("); strSql.Append("@RegionalID,@RegionalName,@RegionalCode,@SubRegionalID,@RegionalLevel,@Orders,@LastModifyTime,@IsValid,@Memo)"); MySqlParameter[] parameters = { new MySqlParameter("@RegionalID", MySqlDbType.VarChar,50), new MySqlParameter("@RegionalName", MySqlDbType.VarChar,50), new MySqlParameter("@RegionalCode", MySqlDbType.VarChar,50), new MySqlParameter("@SubRegionalID", MySqlDbType.VarChar,50), new MySqlParameter("@RegionalLevel", MySqlDbType.VarChar,50), new MySqlParameter("@LastModifyTime", MySqlDbType.DateTime), new MySqlParameter("@IsValid", MySqlDbType.Bit), new MySqlParameter("@Memo", MySqlDbType.VarChar,50), new MySqlParameter("@Orders", MySqlDbType.Int32)}; parameters[0].Value = model.RegionalID; parameters[1].Value = model.RegionalName; parameters[2].Value = model.RegionalCode; parameters[3].Value = model.SubRegionalID; parameters[4].Value = model.RegionalLevel; parameters[5].Value = model.LastModifyTime; parameters[6].Value = model.IsValid; parameters[7].Value = model.Memo; parameters[8].Value = model.Orders; StringBuilder strSql1 = new StringBuilder(); strSql1.Append("insert into T_SYSCODEDETIAL("); strSql1.Append("SYSCodeID,SYSCodeDetialID,SYSCodeDetialContext,LastModifyTime,IsValid,Memo)"); strSql1.Append(" values ("); strSql1.Append("@SYSCodeID,@SYSCodeDetialID,@SYSCodeDetialContext,@LastModifyTime,@IsValid,@Memo)"); MySqlParameter[] parameters1 = { new MySqlParameter("@SYSCodeID", MySqlDbType.VarChar,50), new MySqlParameter("@SYSCodeDetialID", MySqlDbType.VarChar,50), new MySqlParameter("@SYSCodeDetialContext", MySqlDbType.VarChar,50), new MySqlParameter("@LastModifyTime", MySqlDbType.DateTime), new MySqlParameter("@IsValid", MySqlDbType.Bit,1), new MySqlParameter("@Memo", MySqlDbType.VarChar,50)}; parameters1[0].Value = "Region"; parameters1[1].Value = model.RegionalID; parameters1[2].Value = model.RegionalName; parameters1[3].Value = DateTime.Now; parameters1[4].Value = model.IsValid; parameters1[5].Value = model.Memo; System.Collections.Hashtable sqlStringList = new System.Collections.Hashtable(); sqlStringList.Add(strSql, parameters); sqlStringList.Add(strSql1, parameters1); try { DbHelperMySQL.ExecuteSqlTran(sqlStringList); return true; } catch { return false; } }
/// <summary> Constructor for Discipline.</summary> public Discipline() { number = - 1; name = "undefined"; //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'" category = new System.Collections.Hashtable(); }
public DVCore(DoubleVisionForm owner) { lst_dvf_FileList = new List<DVFile>(); m_hashtableResults = new System.Collections.Hashtable(); que_str_Locations = new Queue<String>(); dvf_Form = owner; }
static ImageFile () { name_table = new System.Collections.Hashtable (); name_table [".svg"] = typeof (FSpot.Svg.SvgFile); name_table [".gif"] = typeof (ImageFile); name_table [".bmp"] = typeof (ImageFile); name_table [".jpeg"] = typeof (JpegFile); name_table [".jpg"] = typeof (JpegFile); name_table [".png"] = typeof (FSpot.Png.PngFile); name_table [".cr2"] = typeof (FSpot.Tiff.Cr2File); name_table [".nef"] = typeof (FSpot.Tiff.NefFile); name_table [".pef"] = typeof (FSpot.Tiff.NefFile); name_table [".raw"] = typeof (FSpot.Tiff.NefFile); name_table [".kdc"] = typeof (FSpot.Tiff.NefFile); name_table [".arw"] = typeof (FSpot.Tiff.NefFile); name_table [".tiff"] = typeof (FSpot.Tiff.TiffFile); name_table [".tif"] = typeof (FSpot.Tiff.TiffFile); name_table [".orf"] = typeof (FSpot.Tiff.NefFile); name_table [".srf"] = typeof (FSpot.Tiff.NefFile); name_table [".dng"] = typeof (FSpot.Tiff.DngFile); name_table [".crw"] = typeof (FSpot.Ciff.CiffFile); name_table [".ppm"] = typeof (FSpot.Pnm.PnmFile); name_table [".mrw"] = typeof (FSpot.Mrw.MrwFile); name_table [".raf"] = typeof (FSpot.Raf.RafFile); name_table [".x3f"] = typeof (FSpot.X3f.X3fFile); }
public EntryPoint( EasyHook.RemoteHooking.IContext context, String channelName, CaptureConfig config) { // Get reference to IPC to host application // Note: any methods called or events triggered against _interface will execute in the host process. _interface = EasyHook.RemoteHooking.IpcConnectClient<CaptureInterface>(channelName); // We try to ping immediately, if it fails then injection fails _interface.Ping(); #region Allow client event handlers (bi-directional IPC) // Attempt to create a IpcServerChannel so that any event handlers on the client will function correctly System.Collections.IDictionary properties = new System.Collections.Hashtable(); properties["name"] = channelName; properties["portName"] = channelName + Guid.NewGuid().ToString("N"); // random portName so no conflict with existing channels of channelName System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider binaryProv = new System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider(); binaryProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; System.Runtime.Remoting.Channels.Ipc.IpcServerChannel _clientServerChannel = new System.Runtime.Remoting.Channels.Ipc.IpcServerChannel(properties, binaryProv); System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(_clientServerChannel, false); #endregion }
public override void Flush(System.Collections.IDictionary threadsAndFields, SegmentWriteState state) { lock (this) { if (tvx != null) { if (state.numDocsInStore > 0) // In case there are some final documents that we // didn't see (because they hit a non-aborting exception): Fill(state.numDocsInStore - docWriter.GetDocStoreOffset()); tvx.Flush(); tvd.Flush(); tvf.Flush(); } System.Collections.IEnumerator it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator(); while (it.MoveNext()) { System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry) it.Current; System.Collections.IEnumerator it2 = ((System.Collections.ICollection) entry.Value).GetEnumerator(); while (it2.MoveNext()) { TermVectorsTermsWriterPerField perField = (TermVectorsTermsWriterPerField) ((System.Collections.DictionaryEntry) it2.Current).Key; perField.termsHashPerField.Reset(); perField.ShrinkHash(); } TermVectorsTermsWriterPerThread perThread = (TermVectorsTermsWriterPerThread) entry.Key; perThread.termsHashPerThread.Reset(true); } } }
private string Top10Types() { System.Collections.Hashtable ht = new System.Collections.Hashtable(); foreach (DataRow dr in m_dtReport.Select("", "Frequency DESC", DataViewRowState.CurrentRows)) { string type = (string)dr["Type"]; if (!ht.Contains(dr["Type"].ToString())) ht[type] = 0; ht[type] = (int)ht[type] + (int)dr["Frequency"]; } System.Collections.ArrayList indices = range(ht.Values.Count); indices.Sort( new Comparer( ht ) ); System.Collections.ArrayList keys = new System.Collections.ArrayList(ht.Keys); System.Collections.ArrayList top10 = new System.Collections.ArrayList(); for (int i = 0; i < 10; i++) { string key = (string)keys[(int)indices[i]]; top10.Add(key + ": " + ht[key]); } string[] output = new string[top10.Count]; for (int i = 0; i < top10.Count; i++) { output[i] = (string)top10[i]; } return "Top10 Types Used " + string.Join(",", output); }
/// <summary> /// Gets an instance of a <see cref="Messager"/> to use to talk to the running instance of the client. /// </summary> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_gmdGameModeInfo">The descriptor of the game mode for which mods are being managed.</param> /// <returns>An instance of a <see cref="Messager"/> to use to talk to the running instance of the client, /// or <c>null</c> if no valid <see cref="Messager"/> could be created.</returns> public static IMessager GetMessager(EnvironmentInfo p_eifEnvironmentInfo, IGameModeDescriptor p_gmdGameModeInfo) { if (m_cchMessagerChannel == null) { System.Collections.IDictionary properties = new System.Collections.Hashtable(); properties["exclusiveAddressUse"] = false; m_cchMessagerChannel = new IpcClientChannel(); ChannelServices.RegisterChannel(m_cchMessagerChannel, true); } else throw new InvalidOperationException("The IPC Channel has already been created as a CLIENT."); string strMessagerUri = String.Format("ipc://{0}-{1}IpcServer/{1}Listener", p_eifEnvironmentInfo.Settings.ModManagerName, p_gmdGameModeInfo.ModeId); IMessager msgMessager = null; try { Trace.TraceInformation(String.Format("Getting listener on: {0}", strMessagerUri)); msgMessager = (IMessager)Activator.GetObject(typeof(IMessager), strMessagerUri); //Just because a messager has been returned, dosn't mean it exists. //All you've really done at this point is create an object wrapper of type "Messager" which has the same methods, properties etc... //You wont know if you've got a real object, until you invoke something, hence the post (Power on self test) method. msgMessager.Post(); } catch (RemotingException e) { Trace.TraceError("Could not get Messager: {0}", strMessagerUri); TraceUtil.TraceException(e); return null; } return new MessagerClient(msgMessager); }
public int MajorityElement(int[] nums) { System.Collections.Hashtable ht = new System.Collections.Hashtable(); for (int i = 0; i < nums.Length; i++) { if (!ht.ContainsKey(nums[i])) { ht.Add(nums[i], 1); } else { ht[nums[i]] = (int)ht[nums[i]] + 1; } } foreach (System.Collections.DictionaryEntry item in ht) { if ((int)item.Value > nums.Length / 2) { return (int)item.Key; } } return 0; }
public FreeTabCtrl() { SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); UpdateStyles(); InitializeComponent(); if (normalImage == null) { hoverImage = FreeTab.Properties.Resources.tab_hover; normalImage = FreeTab.Properties.Resources.tab_normal; focusedImage = FreeTab.Properties.Resources.tab_pushed; } this.TabPanel.Location = this.Location; this.TabContent.Location = new Point(this.Location.X, this.Location.Y + normalImage.Height + top_padding); tabArray = new System.Collections.ArrayList(); tabHash = new System.Collections.Hashtable(); normal_height = normalImage.Height - click_stretch*2; normal_Y = this.TabContent.Location.Y - normal_height; this.Resize += new EventHandler(FreeTabCtrl_Resize); //setActivate(0); }
/// <summary> /// 添加CC_Movement对象(即:一条记录) /// </summary> public object AddWithReturn(CC_Movement cC_Movement) { string sql = "INSERT INTO CC_Movement () VALUES ();SELECT @@IDENTITY AS ReturnID;"; int Re = 0; //SQL日志记录 var RunMethod = System.Reflection.MethodBase.GetCurrentMethod(); System.Collections.Hashtable param = new System.Collections.Hashtable(); string Ex = string.Empty; foreach (System.Collections.DictionaryEntry item in idb.GetParameters()) { param.Add(item.Key, item.Value); } object obj=null; try { obj = idb.ReturnValue(sql); Ex = obj.ToString(); } catch (Exception ex) { Ex = ex.Message; } finally { SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType +"." + RunMethod.Name,Ex); } return obj; }
public UserControlFolderSelector() { InitializeComponent(); m_VisitedDirsPaths = new System.Collections.Hashtable(); m_ActivPath = ""; /// /// Load user preferencies /// try { if (string.IsNullOrEmpty( Properties.Settings.Default.LastUsedPath ) == false && new DirectoryInfo(Properties.Settings.Default.LastUsedPath).Exists) { ActualPath = Properties.Settings.Default.LastUsedPath; } if (Properties.Settings.Default.VisitedPaths != null && Properties.Settings.Default.VisitedPaths.Count > 0) { int i = 0; string[] paths = new string[Properties.Settings.Default.VisitedPaths.Count]; foreach (string path in Properties.Settings.Default.VisitedPaths) { paths[i++] = path; } Paths = paths; } } catch { } }
public static string GetTableAlias(string tableName) { if (__tableNames == null) { DataSet _data = new DataSet(); _data.ReadXml(System.Configuration.ConfigurationManager.AppSettings["PathXMLAlias"]); __tableNames = new System.Collections.Hashtable(); foreach (DataRow row in _data.Tables[0].Rows) { if (!__tableNames.ContainsKey(row["name"].ToString().ToLower().Trim())) { __tableNames.Add(row["name"].ToString().ToLower().Trim(), row["alias"].ToString()); } } } if (__tableNames.ContainsKey(tableName)) { return __tableNames[tableName].ToString(); } return tableName; }
/// <summary> /// 添加CC_Movement对象(即:一条记录) /// </summary> public int Add(CC_Movement cC_Movement) { string sql = "INSERT INTO CC_Movement () VALUES ()"; int Re = 0; //SQL日志记录 var RunMethod = System.Reflection.MethodBase.GetCurrentMethod(); System.Collections.Hashtable param = new System.Collections.Hashtable(); string Ex = string.Empty; foreach (System.Collections.DictionaryEntry item in idb.GetParameters()) { param.Add(item.Key, item.Value); } try { Re = idb.ExeCmd(sql); Ex = Re.ToString(); } catch (Exception ex) { Ex = ex.Message; } finally { SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType +"." + RunMethod.Name,Ex); } return Re; }
public bool ContainsDuplicate(int[] nums) { if (nums == null || nums.Length < 2) { return false; } System.Collections.Hashtable ht = new System.Collections.Hashtable(); bool result = false; for (int i = 0; i < nums.Length; i++) { if (!ht.ContainsKey(nums[i])) { ht.Add(nums[i], i); } else { result = true; break; } } return result; }
public void Init() { mohidWaterEngineWrapper = new MohidWaterEngineWrapper(); System.Collections.Hashtable ht = new System.Collections.Hashtable(); ht.Add("FilePath", @"D:\MohidProjects\Studio\20_OpenMI\Sample Estuary\exe\nomfich.dat"); mohidWaterEngineWrapper.Initialize(ht); }
protected override System.Collections.Hashtable setWEADisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId) { //serMeg.setAlarmMeg("WIS�T����ƪ���������g��!!"); System.Collections.Hashtable outputs = new System.Collections.Hashtable(); string meg = ""; switch (secType) { case 45: //�@�� meg = "�@���C��"; break; case 46: //�j�� meg = "�j���C��"; break; case 47: //���B meg = "���B�C��"; break; default: //��L meg = "�t�C����"; break; } byte[] colors = new byte[4] { 32, 32, 32, 32 }; if (devNames == null) return null; foreach (RemoteInterface.HC.FetchDeviceData devName in devNames) { RemoteInterface.HC.CMSOutputData output = new RemoteInterface.HC.CMSOutputData(0, 0, 0, meg, colors); outputs.Add(devName.DevName, output); } return outputs; }
public static DataTable LoadFullSummary(int locationId, int thermostatId, DateTime startDate, DateTime endDate, int timezoneDifference) { DataTable cycles = LoadSummary(thermostatId, startDate, endDate,timezoneDifference); DataTable weather = OutsideConditions.LoadSummary(locationId, startDate, endDate, timezoneDifference); DataTable result = new DataTable(); result.Columns.Add("LogDate", typeof(DateTime)); result.Columns.Add("OutsideMin", typeof(int)); result.Columns.Add("OutsideMax", typeof(int)); System.Collections.Hashtable cycleTypes = new System.Collections.Hashtable(); foreach (DataRow row in cycles.Rows) { string cycleType = Convert.ToString(row["cycle_type"]); if (!cycleTypes.Contains(cycleType)) cycleTypes.Add(cycleType, cycleType); } foreach (string cycleType in cycleTypes.Keys) { result.Columns.Add(cycleType + "_CycleCount", typeof(int)); result.Columns.Add(cycleType + "_TotalSeconds", typeof(double)); result.Columns.Add(cycleType + "_AverageSeconds", typeof(double)); } System.Collections.Hashtable dateHash = new System.Collections.Hashtable(); foreach (DataRow row in cycles.Rows) { string cycleType = Convert.ToString(row["cycle_type"]); int cycleCount = Convert.ToInt32(row["cycle_count"]); int totalSeconds = Convert.ToInt32(row["total_seconds"]); double averageSeconds = Convert.ToDouble(totalSeconds) / Convert.ToDouble(cycleCount); DateTime logDate = Convert.ToDateTime(row["log_date"]); bool newDate = !dateHash.Contains(logDate); DataRow resultRow=null; if (newDate) resultRow = result.NewRow(); else resultRow = result.Rows[Convert.ToInt32(dateHash[logDate])]; resultRow[cycleType + "_CycleCount"] = cycleCount; resultRow[cycleType + "_TotalSeconds"] = totalSeconds; resultRow[cycleType + "_AverageSeconds"] = averageSeconds; if (newDate) { resultRow["LogDate"] = logDate; result.Rows.Add(resultRow); dateHash.Add(logDate, result.Rows.Count - 1); } } foreach (DataRow row in weather.Rows) { DateTime logDate = Convert.ToDateTime(row["log_date"]); bool newDate = !dateHash.Contains(logDate); if (!newDate) { DataRow resultRow = result.Rows[Convert.ToInt32(dateHash[logDate])]; resultRow["OutsideMin"] = Convert.ToInt32(row["MinDegrees"]); resultRow["OutsideMax"] = Convert.ToInt32(row["MaxDegrees"]); } } return result; }
protected void btnSearch_click(object sender, EventArgs e) { string strLeaseType = string.Empty; if (rbdBuy.Checked) { strLeaseType = "S"; } else { strLeaseType = "R"; } if (Session["SearchParams"] != null) Session.Remove("SearchParams"); System.Collections.Hashtable objSearchParams = new System.Collections.Hashtable(); objSearchParams.Add("Property", (ddlPropertType.SelectedValue.ToString()).Contains("-1") ? "-1" : ddlPropertType.SelectedValue.ToString()); objSearchParams.Add("Location", ddlLocation.SelectedValue.ToString()); objSearchParams.Add("City", ddlCity.SelectedValue.ToString()); objSearchParams.Add("Bedroom", txtBedroooms.Text); objSearchParams.Add("LeaseType", strLeaseType.ToString()); objSearchParams.Add("Budget", txtBudgetfrom.Text); //objSearchParams.Add("BudgetTo", txtBudgetTo.Text); objSearchParams.Add("Individual", (chkIndividual.Checked ? "I" : string.Empty)); objSearchParams.Add("Dealers", (chkDealers.Checked ? "D" : string.Empty)); objSearchParams.Add("Builders", (chkBuilders.Checked ? "B" : string.Empty)); objSearchParams.Add("User", "0"); SiteHelper.SearchParams = objSearchParams; CurrentSession.SearchType = "SReq"; Response.Redirect("/SearchResults.aspx?Search=Req"); }
public Header(System.Data.SQLite.SQLiteConnection connection) { System.Collections.Hashtable hash = null; using (var sqlcommand = connection.CreateCommand()) { sqlcommand.CommandText = clientBuildCommand; using (var reader = sqlcommand.ExecuteReader()) { var total = reader.RecordsAffected; hash = new System.Collections.Hashtable(total); while (reader.Read()) { hash[reader.GetString(0)] = reader.GetValue(1); } reader.Close(); } } ClientBuild = (ClientBuild)int.Parse((string)hash["clientBuild"]); AccountName = (string)hash["accountName"]; RealmName = (string)hash["realmName"]; RealmServer = (string)hash["realmServer"]; //connection.Close(); }
/// <summary> /// Sets up the services remoting channel /// </summary> public void Start() { try { System.Collections.Hashtable props = new System.Collections.Hashtable(); props["typeFilterLevel"] = "Full"; // Both formatters only use the typeFilterLevel property BinaryClientFormatterSinkProvider cliFormatter = new BinaryClientFormatterSinkProvider(props, null); BinaryServerFormatterSinkProvider srvFormatter = new BinaryServerFormatterSinkProvider(props, null); // The channel requires these to be set that it can found by name by clients props["name"] = "SyslogConsole"; props["portName"] = "SyslogConsole"; props["authorizedGroup"] = "Everyone"; // Create the channel channel = new IpcChannel(props, cliFormatter, srvFormatter); channel.IsSecured = false; // Register the channel in the Windows IPC list ChannelServices.RegisterChannel(channel, false); // Register the channel for remoting use RemotingConfiguration.RegisterWellKnownServiceType(typeof(ClientMethods), "Server", WellKnownObjectMode.Singleton); // Assign the event to a handler Listener.MessageReceived += new Listener.MessageReceivedEventHandler(Listener_MessageReceived); } catch (Exception ex) { EventLogger.LogEvent("Could not create a named pipe because: " + ex.Message + Environment.NewLine + "Communication with the GUI console will be disabled.", System.Diagnostics.EventLogEntryType.Warning); } }
public override System.Collections.BitArray Bits(IndexReader reader) { if (cache == null) { cache = new System.Collections.Hashtable(); } lock (cache.SyncRoot) { // check cache System.Collections.BitArray cached = (System.Collections.BitArray) cache[reader]; if (cached != null) { return cached; } } System.Collections.BitArray bits = new System.Collections.BitArray((reader.MaxDoc() % 64 == 0?reader.MaxDoc() / 64:reader.MaxDoc() / 64 + 1) * 64); new IndexSearcher(reader).Search(query, new AnonymousClassHitCollector(bits, this)); lock (cache.SyncRoot) { // update cache cache[reader] = bits; } return bits; }
public static void RunExample(String[] arg) { try { //Create a new JSch instance JSch jsch=new JSch(); //Prompt for username and server host Console.WriteLine("Please enter the user and host info at the popup window..."); String host = InputForm.GetUserInput ("Enter username@hostname", Environment.UserName+"@localhost"); String user=host.Substring(0, host.IndexOf('@')); host=host.Substring(host.IndexOf('@')+1); //Create a new SSH session Session session=jsch.getSession(user, host, 22); // username and password will be given via UserInfo interface. UserInfo ui=new MyUserInfo(); session.setUserInfo(ui); //Add AES128 as default cipher in the session config store System.Collections.Hashtable config=new System.Collections.Hashtable(); config.Add("cipher.s2c", "aes128-cbc,3des-cbc"); config.Add("cipher.c2s", "aes128-cbc,3des-cbc"); session.setConfig(config); //Connect to remote SSH server session.connect(); //Open a new Shell channel on the SSH session Channel channel=session.openChannel("shell"); //Redirect standard I/O to the SSH channel channel.setInputStream(Console.OpenStandardInput()); channel.setOutputStream(Console.OpenStandardOutput()); //Connect the channel channel.connect(); Console.WriteLine("-- Shell channel is connected using the {0} cipher", session.getCipher()); //Wait till channel is closed while(!channel.isClosed()) { System.Threading.Thread.Sleep(500); } //Disconnect from remote server channel.disconnect(); session.disconnect(); } catch(Exception e) { Console.WriteLine(e.Message); } }
public FieldProperty(Element element, MappingElement parent, string name, ClassName type, ClassName implementationClassName, bool nullable, ClassName foreignClass, SupportClass.SetSupport foreignKeys, MultiMap metaattribs) : base(element, parent) { InitWith(name, type, implementationClassName, nullable, id, false, foreignClass, foreignKeys, metaattribs); }
public virtual void TestStopList() { System.Collections.Hashtable stopWordsSet = new System.Collections.Hashtable(); stopWordsSet.Add("good", "good"); stopWordsSet.Add("test", "test"); stopWordsSet.Add("analyzer", "analyzer"); // {{Aroush how can we copy 'stopWordsSet' to 'System.String[]'? System.String[] arrStopWordsSet = new System.String[3]; arrStopWordsSet[0] = "good"; arrStopWordsSet[1] = "test"; arrStopWordsSet[2] = "analyzer"; // Aroush}} StopAnalyzer newStop = new StopAnalyzer(arrStopWordsSet); System.IO.StringReader reader = new System.IO.StringReader("This is a good test of the english stop analyzer"); TokenStream stream = newStop.TokenStream("test", reader); Assert.IsTrue(stream != null); Token token = null; try { while ((token = stream.Next()) != null) { System.String text = token.TermText(); Assert.IsTrue(stopWordsSet.Contains(text) == false); } } catch (System.IO.IOException e) { Assert.IsTrue(false); } }
private static void Initialize() { VALUE_TO_ECI = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable(29)); NAME_TO_ECI = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable(29)); // TODO figure out if these values are even right! addCharacterSet(0, "Cp437"); addCharacterSet(1, new System.String[]{"ISO8859_1", "ISO-8859-1"}); addCharacterSet(2, "Cp437"); addCharacterSet(3, new System.String[]{"ISO8859_1", "ISO-8859-1"}); addCharacterSet(4, "ISO8859_2"); addCharacterSet(5, "ISO8859_3"); addCharacterSet(6, "ISO8859_4"); addCharacterSet(7, "ISO8859_5"); addCharacterSet(8, "ISO8859_6"); addCharacterSet(9, "ISO8859_7"); addCharacterSet(10, "ISO8859_8"); addCharacterSet(11, "ISO8859_9"); addCharacterSet(12, "ISO8859_10"); addCharacterSet(13, "ISO8859_11"); addCharacterSet(15, "ISO8859_13"); addCharacterSet(16, "ISO8859_14"); addCharacterSet(17, "ISO8859_15"); addCharacterSet(18, "ISO8859_16"); addCharacterSet(20, new System.String[]{"SJIS", "Shift_JIS"}); }
/// <summary> Loads a text file and adds every line as an entry to a HashSet (omitting /// leading and trailing whitespace). Every line of the file should contain only /// one word. The words need to be in lowercase if you make use of an /// Analyzer which uses LowerCaseFilter (like GermanAnalyzer). /// /// </summary> /// <param name="wordfile">File containing the wordlist /// </param> /// <returns> A HashSet with the file's words /// </returns> public static System.Collections.Hashtable GetWordSet(System.IO.FileInfo wordfile) { System.Collections.Hashtable result = new System.Collections.Hashtable(); System.IO.StreamReader freader = null; System.IO.StreamReader lnr = null; try { freader = new System.IO.StreamReader(wordfile.FullName, System.Text.Encoding.Default); lnr = new System.IO.StreamReader(freader.BaseStream, freader.CurrentEncoding); System.String word = null; while ((word = lnr.ReadLine()) != null) { System.String trimedWord = word.Trim(); result.Add(trimedWord, trimedWord); } } finally { if (lnr != null) lnr.Close(); if (freader != null) freader.Close(); } return result; }
public VisualEnvironmentCompiler(InvokeDegegate beginInvoke, SetFlagDelegate setCompilingButtonsEnabled, SetFlagDelegate setCompilingDebugEnabled, SetTextDelegate setStateText, SetTextDelegate addTextToCompilerMessages, ToolStripMenuItem pluginsMenuItem, ToolStrip pluginsToolStrip, ExecuteSourceLocationActionDelegate ExecuteSLAction, ExecuteVisualEnvironmentCompilerActionDelegate ExecuteVECAction, PascalABCCompiler.Errors.ErrorsStrategyManager ErrorsManager, RunManager RunnerManager, DebugHelper DebugHelper,UserOptions UserOptions,System.Collections.Hashtable StandartDirectories, Dictionary<string, CodeFileDocumentControl> OpenDocuments, IWorkbench workbench) { this.StandartDirectories = StandartDirectories; this.ErrorsManager = ErrorsManager; this.ChangeVisualEnvironmentState += new ChangeVisualEnvironmentStateDelegate(onChangeVisualEnvironmentState); SetCompilingButtonsEnabled = setCompilingButtonsEnabled; SetDebugButtonsEnabled = setCompilingDebugEnabled; SetStateText = setStateText; AddTextToCompilerMessages = addTextToCompilerMessages; this.beginInvoke = beginInvoke; this.ExecuteSLAction=ExecuteSLAction; this.ExecuteVECAction = ExecuteVECAction; PluginsMenuItem = pluginsMenuItem; PluginsToolStrip = pluginsToolStrip; PluginsController = new VisualPascalABCPlugins.PluginsController(this, PluginsMenuItem, PluginsToolStrip, workbench); this.RunnerManager = RunnerManager; this.DebugHelper = DebugHelper; DebugHelper.Starting += new DebugHelper.DebugHelperActionDelegate(DebugHelper_Starting); DebugHelper.Exited += new DebugHelper.DebugHelperActionDelegate(DebugHelper_Exited); RunnerManager.Starting += new RunManager.RunnerManagerActionDelegate(RunnerManager_Starting); RunnerManager.Exited += new RunManager.RunnerManagerActionDelegate(RunnerManager_Exited); this.CodeCompletionParserController = WorkbenchServiceFactory.CodeCompletionParserController; this.CodeCompletionParserController.visualEnvironmentCompiler = this; this.UserOptions = UserOptions; this.OpenDocuments = OpenDocuments; }
public static void CheckHits_(Query query, System.String defaultFieldName, Searcher searcher, int[] results, TestCase testCase) { Hits hits = searcher.Search(query); System.Collections.Hashtable correct = new System.Collections.Hashtable(); for (int i = 0; i < results.Length; i++) { correct.Add((System.Int32) results[i], null); } System.Collections.Hashtable actual = new System.Collections.Hashtable(); for (int i = 0; i < hits.Length(); i++) { actual.Add((System.Int32) hits.Id(i), null); } //Assert.AreEqual(correct, actual, query.ToString(defaultFieldName)); if (correct.Count != 0) { System.Collections.IDictionaryEnumerator iter = correct.GetEnumerator(); bool status = false; while (iter.MoveNext()) { status = actual.ContainsKey(iter.Key); if (status == false) break; } Assert.IsTrue(status, query.ToString(defaultFieldName)); } }
/// <summary> /// /// </summary> /// <param name="hs"></param> /// <returns></returns> public int DelSysCodeType(System.Collections.Hashtable hs) { return(0); }
/// <summary> /// 更新Meeting_Come对象(即:一条记录 /// </summary> public int Update(Meeting_Come meeting_Come) { StringBuilder sbParameter = new StringBuilder(); StringBuilder sb = new StringBuilder(); sb.Append(@"UPDATE Meeting_Come SET "); if (meeting_Come.MeetingCome_Code_IsChanged) { sbParameter.Append("MeetingCome_Code=@MeetingCome_Code, "); } if (meeting_Come.MeetingCome_MeetCode_IsChanged) { sbParameter.Append("MeetingCome_MeetCode=@MeetingCome_MeetCode, "); } if (meeting_Come.MeetingCome_User_IsChanged) { sbParameter.Append("MeetingCome_User=@MeetingCome_User, "); } if (meeting_Come.MeetingCome_Remark_IsChanged) { sbParameter.Append("MeetingCome_Remark=@MeetingCome_Remark, "); } if (meeting_Come.MeetingCome_Date_IsChanged) { sbParameter.Append("MeetingCome_Date=@MeetingCome_Date, "); } if (meeting_Come.Stat_IsChanged) { sbParameter.Append("Stat=@Stat, "); } if (meeting_Come.CreateDate_IsChanged) { sbParameter.Append("CreateDate=@CreateDate, "); } if (meeting_Come.UpdateDate_IsChanged) { sbParameter.Append("UpdateDate=@UpdateDate, "); } if (meeting_Come.DeleteDate_IsChanged) { sbParameter.Append("DeleteDate=@DeleteDate "); } sb.Append(sbParameter.ToString().Trim().TrimEnd(',')); sb.Append(" WHERE 1=1 AND ((Stat is null) or (Stat=0)) and MeetingCome_ID=@MeetingCome_ID; "); string sql = sb.ToString(); if (meeting_Come.MeetingCome_Code_IsChanged) { if (string.IsNullOrEmpty(meeting_Come.MeetingCome_Code)) { idb.AddParameter("@MeetingCome_Code", DBNull.Value); } else { idb.AddParameter("@MeetingCome_Code", meeting_Come.MeetingCome_Code); } } if (meeting_Come.MeetingCome_MeetCode_IsChanged) { if (string.IsNullOrEmpty(meeting_Come.MeetingCome_MeetCode)) { idb.AddParameter("@MeetingCome_MeetCode", DBNull.Value); } else { idb.AddParameter("@MeetingCome_MeetCode", meeting_Come.MeetingCome_MeetCode); } } if (meeting_Come.MeetingCome_User_IsChanged) { if (string.IsNullOrEmpty(meeting_Come.MeetingCome_User)) { idb.AddParameter("@MeetingCome_User", DBNull.Value); } else { idb.AddParameter("@MeetingCome_User", meeting_Come.MeetingCome_User); } } if (meeting_Come.MeetingCome_Remark_IsChanged) { if (string.IsNullOrEmpty(meeting_Come.MeetingCome_Remark)) { idb.AddParameter("@MeetingCome_Remark", DBNull.Value); } else { idb.AddParameter("@MeetingCome_Remark", meeting_Come.MeetingCome_Remark); } } if (meeting_Come.MeetingCome_Date_IsChanged) { if (meeting_Come.MeetingCome_Date == DateTime.MinValue) { idb.AddParameter("@MeetingCome_Date", DBNull.Value); } else { idb.AddParameter("@MeetingCome_Date", meeting_Come.MeetingCome_Date); } } if (meeting_Come.Stat_IsChanged) { if (meeting_Come.Stat == 0) { idb.AddParameter("@Stat", 0); } else { idb.AddParameter("@Stat", meeting_Come.Stat); } } if (meeting_Come.CreateDate_IsChanged) { if (meeting_Come.CreateDate == DateTime.MinValue) { idb.AddParameter("@CreateDate", DBNull.Value); } else { idb.AddParameter("@CreateDate", meeting_Come.CreateDate); } } if (meeting_Come.UpdateDate_IsChanged) { if (meeting_Come.UpdateDate == DateTime.MinValue) { idb.AddParameter("@UpdateDate", DBNull.Value); } else { idb.AddParameter("@UpdateDate", meeting_Come.UpdateDate); } } if (meeting_Come.DeleteDate_IsChanged) { if (meeting_Come.DeleteDate == DateTime.MinValue) { idb.AddParameter("@DeleteDate", DBNull.Value); } else { idb.AddParameter("@DeleteDate", meeting_Come.DeleteDate); } } idb.AddParameter("@MeetingCome_ID", meeting_Come.MeetingCome_ID); int Re = 0; //SQL日志记录 var RunMethod = System.Reflection.MethodBase.GetCurrentMethod(); System.Collections.Hashtable param = new System.Collections.Hashtable(); string Ex = "0"; foreach (System.Collections.DictionaryEntry item in idb.GetParameters()) { param.Add(item.Key, item.Value); } try { Re = idb.ExeCmd(sql); Ex = Re.ToString(); } catch (Exception ex) { Ex = ex.Message; } SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex); return(Re); }
/// <summary> /// 添加Meeting_Come对象(即:一条记录) /// </summary> public int Add(Meeting_Come meeting_Come) { string sql = "INSERT INTO Meeting_Come (MeetingCome_Code,MeetingCome_MeetCode,MeetingCome_User,MeetingCome_Remark,MeetingCome_Date,Stat,CreateDate,UpdateDate,DeleteDate) VALUES (@MeetingCome_Code,@MeetingCome_MeetCode,@MeetingCome_User,@MeetingCome_Remark,@MeetingCome_Date,@Stat,@CreateDate,@UpdateDate,@DeleteDate)"; if (string.IsNullOrEmpty(meeting_Come.MeetingCome_Code)) { idb.AddParameter("@MeetingCome_Code", DBNull.Value); } else { idb.AddParameter("@MeetingCome_Code", meeting_Come.MeetingCome_Code); } if (string.IsNullOrEmpty(meeting_Come.MeetingCome_MeetCode)) { idb.AddParameter("@MeetingCome_MeetCode", DBNull.Value); } else { idb.AddParameter("@MeetingCome_MeetCode", meeting_Come.MeetingCome_MeetCode); } if (string.IsNullOrEmpty(meeting_Come.MeetingCome_User)) { idb.AddParameter("@MeetingCome_User", DBNull.Value); } else { idb.AddParameter("@MeetingCome_User", meeting_Come.MeetingCome_User); } if (string.IsNullOrEmpty(meeting_Come.MeetingCome_Remark)) { idb.AddParameter("@MeetingCome_Remark", DBNull.Value); } else { idb.AddParameter("@MeetingCome_Remark", meeting_Come.MeetingCome_Remark); } if (meeting_Come.MeetingCome_Date == DateTime.MinValue) { idb.AddParameter("@MeetingCome_Date", DBNull.Value); } else { idb.AddParameter("@MeetingCome_Date", meeting_Come.MeetingCome_Date); } if (meeting_Come.Stat == 0) { idb.AddParameter("@Stat", 0); } else { idb.AddParameter("@Stat", meeting_Come.Stat); } if (meeting_Come.CreateDate == DateTime.MinValue) { idb.AddParameter("@CreateDate", DBNull.Value); } else { idb.AddParameter("@CreateDate", meeting_Come.CreateDate); } if (meeting_Come.UpdateDate == DateTime.MinValue) { idb.AddParameter("@UpdateDate", DBNull.Value); } else { idb.AddParameter("@UpdateDate", meeting_Come.UpdateDate); } if (meeting_Come.DeleteDate == DateTime.MinValue) { idb.AddParameter("@DeleteDate", DBNull.Value); } else { idb.AddParameter("@DeleteDate", meeting_Come.DeleteDate); } int Re = 0; //SQL日志记录 var RunMethod = System.Reflection.MethodBase.GetCurrentMethod(); System.Collections.Hashtable param = new System.Collections.Hashtable(); string Ex = "0"; foreach (System.Collections.DictionaryEntry item in idb.GetParameters()) { param.Add(item.Key, item.Value); } try { Re = idb.ExeCmd(sql); Ex = Re.ToString(); } catch (Exception ex) { Ex = ex.Message; } SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex); return(Re); }
// this function is required to initiate payment public string initiatePaymentAPI(string aAmount, String Firstname, String Email, String Phone, String Productinfo, String Surl, String Furl, String Txnid) { env = ckv.easebuzzenv; string[] hashVarsSeq; string hash_string = string.Empty; string saltvalue = ckv.easebuzzsalt; string amount = aAmount; string firstname = Firstname; string email = Email; string phone = Phone; string productinfo = Productinfo; string surl = Surl; string furl = Furl; string udf1 = ""; string udf2 = ""; string udf3 = ""; string udf4 = ""; string udf5 = ""; // Generate transaction ID -> make sure this is unique for all transactions Random rnd = new Random(); string strHash = Easebuzz_Generatehash512(rnd.ToString() + DateTime.Now); //txnid = strHash.ToString().Substring(0, 20); txnid = Txnid; string paymentUrl = getURL(); // Get configs from web config easebuzz_action_url = paymentUrl; // + "/pay/secure"; // generate hash table System.Collections.Hashtable data = new System.Collections.Hashtable(); // adding values in gash table for data post data.Add("txnid", txnid); data.Add("key", ckv.easebuzzkey); string AmountForm = Convert.ToDecimal(amount.Trim()).ToString("g29");// eliminating trailing zeros amount = AmountForm; data.Add("amount", amount); data.Add("firstname", firstname.Trim()); data.Add("email", email.Trim()); data.Add("phone", phone.Trim()); data.Add("productinfo", productinfo.Trim()); data.Add("surl", surl.Trim()); data.Add("furl", furl.Trim()); data.Add("udf1", udf1.Trim()); data.Add("udf2", udf2.Trim()); data.Add("udf3", udf3.Trim()); data.Add("udf4", udf4.Trim()); data.Add("udf5", udf5.Trim()); // generate hash hashVarsSeq = "key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10".Split('|'); // spliting hash sequence from config hash_string = ""; foreach (string hash_var in hashVarsSeq) { hash_string = hash_string + (data.ContainsKey(hash_var) ? data[hash_var].ToString() : ""); hash_string = hash_string + '|'; } hash_string += salt; // appending SALT gen_hash = Easebuzz_Generatehash512(hash_string).ToLower(); //generating hash data.Add("hash", gen_hash); System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var client = new RestClient("https://pay.easebuzz.in/payment/initiateLink"); var request = new RestRequest(Method.POST); request.AddHeader("cache-control", "no-cache"); request.AddHeader("content-type", "application/x-www-form-urlencoded"); string postdata = "firstname=" + firstname + "&amount=" + amount + "&email=" + email + "&productinfo=FastagRecharge&phone=" + phone + "&surl=https://payment.tollpay.in/success.aspx&furl=https://payment.tollpay.in/success.aspx&txnid=" + txnid + "&key=" + ckv.easebuzzkey + "&udf1=&udf2=&udf3=&udf4=&udf4=&udf5=&udf6=&udf7=&udf8=&udf9=&udf10=&hash=" + gen_hash; request.AddParameter("application/x-www-form-urlencoded", postdata, ParameterType.RequestBody); IRestResponse response = client.Execute(request); clsRespEaseBuzz obj = JsonConvert.DeserializeObject <clsRespEaseBuzz>(response.Content); if (obj.status == 1) { DP_TPEntities db = new DP_TPEntities(); PaymentGatewayResponse pgr = new PaymentGatewayResponse(); pgr.firstname = firstname; pgr.email = email; pgr.CreatedDate = DateTime.Now; pgr.phone = phone; pgr.amount = Convert.ToDecimal(amount); pgr.txnid = txnid; db.PaymentGatewayResponses.Add(pgr); db.SaveChanges(); string strForm = easebuzz_action_url + obj.data; //Easebuzz_PreparePOSTForm(easebuzz_action_url, data); return(strForm); } else { DP_TPEntities db = new DP_TPEntities(); PaymentGatewayResponse pgr = new PaymentGatewayResponse(); pgr.firstname = firstname; pgr.email = email; pgr.CreatedDate = DateTime.Now; pgr.phone = phone; pgr.amount = Convert.ToDecimal(amount); pgr.txnid = txnid; db.PaymentGatewayResponses.Add(pgr); db.SaveChanges(); return(response.Content); } }
public object GetDataWithFilter(int iRequesterID, System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification) { // keep log entry fwBLL.WriteLog(iRequesterID, 0, "get price list"); return(factory.GetDataWithFilter(filters, pageSize, pageIndex, orderBy, orderDirection, out totalRows, out notification)); }
private LinqHashSet(System.Collections.Hashtable h) { Inner = h; }
/// <summary> /// /// </summary> /// <param name="hs"></param> /// <returns></returns> public int UpdateSysCodeType(System.Collections.Hashtable hs) { throw new Exception("The method or operation is not implemented."); }
/// <summary> /// 获得主模板的内容 /// </summary> /// <param name="ht">模板变量的数组</param> /// <returns>返回模板内容的html</returns> public string GetHtml(System.Collections.Hashtable ht) { string spacerssurl = ""; if (Discuz.Config.GeneralConfigs.GetConfig().Aspxrewrite == 1) { spacerssurl = string.Format("spacerss-{0}{1}", ((SpaceConfigInfo)ht["config"]).UserID.ToString(), Discuz.Config.GeneralConfigs.GetConfig().Extname); } else { spacerssurl = string.Format("rss.aspx?uid={0}&type=space", ((SpaceConfigInfo)ht["config"]).UserID.ToString()); } StringBuilder builder = new StringBuilder(); builder.AppendFormat(@"<html> <head> <meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" /> <meta name=""keywords"" content=""ASP.net,论坛,space,blog,{0}"" /> <meta name=""description"" content=""{0} {1}"" /> <meta name=""generator"" content=""Discuz!NT"" /> <meta name=""copyright"" content=""Comsenz Inc."" /> <meta http-equiv=""x-ua-compatible"" content=""ie=7"" /> <meta name=""MSSmartTagsPreventParsing"" content=""True"" /> <meta http-equiv=""MSThemeCompatible"" content=""Yes"" />", (ht["config"] as SpaceConfigInfo).Spacetitle, ht["spacename"].ToString()); builder.AppendFormat("<title>{0} - {1} - Powered by Discuz!NT</title>", ((TabInfo)ht["currenttab"]).TabName, ((SpaceConfigInfo)ht["config"]).Spacetitle); builder.AppendFormat("<link href=\"{0}space/skins/themes/space.css\" rel=\"stylesheet\" type=\"text/css\" id=\"css\" />", ht["forumpath"].ToString()); builder.AppendFormat("<link rel=\"stylesheet\" type=\"text/css\" href=\"{0}space/skins/themes/{1}/style.css\" />", ht["forumpath"].ToString(), ((SpaceConfigInfo)ht["config"]).ThemePath); builder.AppendFormat("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"{0} 最新日志\" href=\"{1}tools/{2}\" />", ((SpaceConfigInfo)ht["config"]).Spacetitle, ht["forumpath"].ToString(), spacerssurl); builder.AppendFormat("<script type=\"text/javascript\">var forumpath=\"{0}space/\";var aspxrewrite = \"{1}\";</script><script type=\"text/javascript\" src=\"{0}space/javascript/space.js\"></script>", ht["forumpath"].ToString(), Discuz.Config.GeneralConfigs.GetConfig().Aspxrewrite); builder.AppendFormat("\r\n<script>var domain = document.location.hostname;_et=\"{0}\";_source=\"\";_uli=true;_pnlo=false;_mpnlo=false;_pl=false;_mod=true;_pid=\"\";_old_html = false;_cbp=true;_is_dasher=false;var _pl_data = {1};</script><script><!--\r\n", ht["userkey"].ToString(), "{}"); builder.Append("function save_chkbox_value(hidden_elem_name, checked) {var hidden_elem = document.getElementById(hidden_elem_name);hidden_elem.value = checked ? \"1\" : \"0\";}function RemoteModule(spec_url, id, render_inline, base_iframe_url,caching_disabled) {this.spec_url = spec_url;this.id = id;this.render_inline = render_inline;this.base_iframe_url = base_iframe_url;this.caching_disabled = caching_disabled;this.old_width = 0;this.wants_scaling = false; this.is_inlined = function() { return this.base_iframe_url == \"\"; };};var remote_modules = [];_DS_RegisterOnloadHandler(function() {for (var i=0;i<remote_modules.length;i++){var rm=remote_modules[i];var el=_gel(\"remote_iframe_\"+rm.id);if(el){el.src=rm.base_iframe_url;}}});function ifpc_resizeIframe(iframe_id, height) {var el = document.getElementById(iframe_id);if (el) {el.style.height = height + \"px\";}}_IFPC.registerService('resize_iframe', ifpc_resizeIframe);function _DS_gmid_(iframe_id) {return(iframe_id.split(\"_\")[2]);}function _setModTitle(title, module_id) {var title_element = _gel(\"m_\" + module_id + \"_title\");if (title_element) {title_element.innerHTML = _hesc(title);}}function ifpc_setTitle(iframe_id, title) {if (typeof(iframe_id) == undefined|| !iframe_id || iframe_id == \"undefined\") {return;}_setModTitle(title, _DS_gmid_(iframe_id));}_IFPC.registerService('set_title', ifpc_setTitle);function _DS_SetTitle(title, specified_module_id) {if (typeof(specified_module_id) == \"undefined\"|| !specified_module_id || specified_module_id == \"undefined\") {throw new Error(\"模块使用_DS_SetTitle时必须指定他们的id\"+ \"__MODULE_ID__\");} else {_setModTitle(title, specified_module_id);}}function ifpc_setPref(iframe_id, var_args) {var module_id = _DS_gmid_(iframe_id);var prefs = new _DS_Prefs(module_id);var keyValues = new Array();for (var n = 1; n < arguments.length; n += 2) {keyValues.push(arguments[n], arguments[n + 1]);}prefs.set.apply(prefs, keyValues);}_IFPC.registerService('set_pref', ifpc_setPref);// -->"); builder.Append(@"</script> <style> .modbox {margin:5px 5px;} .col {vertical-align:top;height:100px;} </style> </head> <body> <div id=""topbar"" style=""left: 0px; top: 0px; position: absolute""></div> <div align=""right"" class=""menu""><div id=""duser"" width=100%><nobr> "); if ((bool)ht["islogged"]) { builder.AppendFormat(" <a href=\"{0}usercp.aspx\"><b>{1}</b></a>(<a href=\"{0}logout.aspx?userkey={2}\">退出</a>) | <a href=\"{3}space/?uid={4}\">我的{5}</a>(<a href=\"{0}usercpspacemanageblog.aspx\">设置</a>) | <a href=\"{0}forumindex.aspx\">论坛</a> | <a href=\"{6}\">{7}</a> | <a href=\"{8}\">{5}首页</a> ", ht["forumurlnopage"].ToString(), ht["username"].ToString(), ht["userkey"].ToString(), ht["configspaceurlnopage"].ToString(), ht["userid"].ToString(), ht["spacename"].ToString(), ht["configalbumurl"].ToString(), ht["albumname"].ToString(), ht["configspaceurl"].ToString()); } else { builder.AppendFormat("<a href=\"#\" onclick=\"window.location.href='{0}login.aspx?reurl=' + _esc(document.location);\">登录</a> | <a href=\"{3}\">论坛</a> | <a href=\"{0}albumindex.aspx\">{2}</a> | <a href=\"{0}spaceindex.aspx\">{1}首页</a>", ht["forumurlnopage"].ToString(), ht["spacename"].ToString(), ht["albumname"].ToString(), ht["forumurl"].ToString()); } builder.AppendFormat("</nobr></div></div>"); builder.Append(@"<script>_DS_DD_init();</script> <div id=""doc""> <div id=""nhdrwrap""><div id=""nhdrwrapinner""> <div id=""nhdrwrapsizer""> "); builder.AppendFormat("<div class=\"title\"><h1>{0}</h1><span><a href=\"{1}\">{1}</a><a target=\"_blank\" href=\"{2}tools/{3}\"><img title=\"rss\" alt=\"rss\" width=\"12\" height=\"12\" src=\"{2}space/images/rss.gif\"/></a></span></div><div class=\"subtitle\">{4}</div>", (ht["config"] as SpaceConfigInfo).Spacetitle, ht["spaceurl"].ToString(), ht["forumpath"].ToString(), spacerssurl, (ht["config"] as SpaceConfigInfo).Description); builder.Append(@"<script>_DS_time.stop(""parse_header"");</script><div id=""new_user_demo"" align=""center""></div></div> <div id=""tabs""><ul><li class=""tab spacer""> </li> "); builder.Append(ht["tabs"].ToString()); builder.Append("<li class=\"tab addtab\">"); if ((bool)ht["can_be_added"]) { builder.Append("<a href=\"###\" onclick=\"_dlsetp('action=addtab');\">添加页面</a>"); } else { builder.Append(" "); } builder.Append("</li><li class=\"tab\" id=\"addstuff\">"); if ((bool)ht["editable"]) { builder.Append(ht["editbar"].ToString()); } builder.Append("</li></ul></div></div></div><div id=\"modules\">"); builder.Append(ht["modules"]); builder.Append("</div></div><div id=\"footer\"><div id=\"copyright\">"); builder.Append(ht["footer"].ToString()); builder.Append(@"</div> </div> <noscript><div id=""noscript_msg"" class=""msg""><div id=""noscript_box"" class=""msg_box"">本功能需要JavaScript支持,开启以获得更多功能。</div></div></noscript> <script type=""text/javascript""> _pl=true;_DS_time.stop(""upcstart"");"); if ((bool)ht["editable"]) { builder.Append("_table=_gel(\"t_1\");_tabs=_gel(\"tabs\");_upc();"); } builder.Append(@"_DS_time.stop(""upcend"");_DS_time.stop(""domloadstart"");_DS_AddEventHandler(""domload"", function() {_DS_time.stop(""domloadend"");});_DS_TriggerDelayedEvent(""domload"");_DS_AddEventHandler(""load"", function() {_DS_time.stop(""load"");if (parseInt(Math.random() * 100.0) == 1) {var url = ""dls="" + _DS_time.get(""domloadstart"") +""&dle="" + _DS_time.get(""domloadend"") +""&upcs="" + _DS_time.get(""upcstart"") +""&upce="" + _DS_time.get(""upcend"") +""&load="" + _DS_time.get(""load"");_sendx(""nop.aspx?timing="" + _esc(url), null, false);}});</script> </body> </html>"); return(builder.ToString()); }
//private static double Momspct = 0.25; static void Main(string[] args) { // så kan man spørge på argumenter til programmet if (args.Length > 0) { foreach (var item in args) { System.Console.WriteLine(item); } ; } ; // Så kan man hente i konfigurationsfilen //modul+add+reference: system.coonfiguration string m = System.Configuration.ConfigurationManager.AppSettings["moms"]; double moms = 0; if (m != null) { moms = Convert.ToDouble(m); } //Eller bruge program properties + settings. //kan bruges som en mini dattabase. string x = Module11_Collections.Properties.Settings.Default.Xpos; System.Collections.ArrayList lst1 = new System.Collections.ArrayList(); lst1.Add(1); lst1.Add(2); lst1.Remove(1); System.Collections.ArrayList lst2 = new System.Collections.ArrayList(); lst2.Add(new Hund() { Navn = "a" }); lst2.Add(new Hund() { Navn = "b" }); lst2.Remove(1); System.Collections.Stack lst3 = new System.Collections.Stack(); lst3.Push(1); lst3.Push(2); lst3.Push(133); System.Collections.Queue lst4 = new System.Collections.Queue(); lst4.Enqueue(new Hund() { Navn = "A" }); lst4.Enqueue(new Hund() { Navn = "B" }); lst4.Enqueue(new Hund() { Navn = "C" }); Hund h = (Hund)lst4.Dequeue(); System.Collections.Hashtable lst5 = new System.Collections.Hashtable(); lst5.Add("a", "a"); lst5.Add("b", "a"); lst5.Add("c", "a"); string r = lst5["b"].ToString(); Kennel kennel = new Kennel(); kennel.TilføjHund(h); ////////////////// System.Collections.Generic.List <Hund> lst6 = new System.Collections.Generic.List <Hund>(); lst6.Add(new Hund() { Navn = "a" }); lst6.Add(new Hund() { Navn = "b" }); Hund hh = lst6[0]; Queue <int> lst7 = new Queue <int>(); lst7.Enqueue(5); int ii = lst7.Dequeue(); Dictionary <int, Hund> lst8 = new Dictionary <int, Hund>(); lst8.Add(4, new Hund() { Navn = "b" }); lst8.Add(22, new Hund() { Navn = "g" }); Hund hhh = lst8[4]; List <string> lst9 = new List <string>(); lst9.Add("A1"); lst9.Add("B1"); lst9.Add("E1"); lst9.Add("C1"); foreach (var item in lst9) { System.Console.WriteLine(item); } for (int i = 0; i < lst9.Count; i++) { System.Console.WriteLine(lst9[i].ToString()); } //Test<MinType> t1 = new Test<MinType>(); Kennel2 k2 = new Kennel2(); //k2.Add(new Hund); //k2.Add(Hund ); if (System.Diagnostics.Debugger.IsAttached) { System.Console.Write("Press any key to continue . . . "); System.Console.ReadKey(); } }
void DoiTween() { GameObject go = Fsm.GetOwnerDefaultTarget(gameObject); if (go == null) { return; } Vector3 pos = vectorPosition.IsNone ? Vector3.zero : vectorPosition.Value; if (!transformPosition.IsNone) { if (transformPosition.Value) { pos = space == Space.World ? transformPosition.Value.transform.position + pos : transformPosition.Value.transform.localPosition + pos; } } System.Collections.Hashtable hash = new System.Collections.Hashtable(); hash.Add("position", pos); hash.Add(speed.IsNone ? "time" : "speed", speed.IsNone ? time.IsNone ? 1f : time.Value : speed.Value); hash.Add("delay", delay.IsNone ? 0f : delay.Value); hash.Add("easetype", easeType); hash.Add("looptype", loopType); hash.Add("oncomplete", "iTweenOnComplete"); hash.Add("oncompleteparams", itweenID); hash.Add("onstart", "iTweenOnStart"); hash.Add("onstartparams", itweenID); hash.Add("ignoretimescale", realTime.IsNone ? false : realTime.Value); hash.Add("space", space); hash.Add("axis", axis == iTweenFsmAction.AxisRestriction.none ? "" : System.Enum.GetName(typeof(iTweenFsmAction.AxisRestriction), axis)); if (!orientToPath.IsNone) { hash.Add("orienttopath", orientToPath.Value); } if (!lookAtObject.IsNone) { hash.Add("looktarget", lookAtVector.IsNone ? lookAtObject.Value.transform.position : lookAtObject.Value.transform.position + lookAtVector.Value); } else { if (!lookAtVector.IsNone) { hash.Add("looktarget", lookAtVector.Value); } } if (!lookAtObject.IsNone || !lookAtVector.IsNone) { hash.Add("looktime", lookTime.IsNone ? 0f : lookTime.Value); } if (transforms.Length >= 2) { tempVct3 = new Vector3[transforms.Length]; if (reverse.IsNone ? false : reverse.Value) { for (int i = 0; i < transforms.Length; i++) { if (transforms[i].IsNone) { tempVct3[tempVct3.Length - 1 - i] = vectors[i].IsNone ? Vector3.zero : vectors[i].Value; } else { if (transforms[i].Value == null) { tempVct3[tempVct3.Length - 1 - i] = vectors[i].IsNone ? Vector3.zero : vectors[i].Value; } else { tempVct3[tempVct3.Length - 1 - i] = transforms[i].Value.transform.position + (vectors[i].IsNone ? Vector3.zero : vectors[i].Value); } } } } else { for (int i = 0; i < transforms.Length; i++) { if (transforms[i].IsNone) { tempVct3[i] = vectors[i].IsNone ? Vector3.zero : vectors[i].Value; } else { if (transforms[i].Value == null) { tempVct3[i] = vectors[i].IsNone ? Vector3.zero : vectors[i].Value; } else { tempVct3[i] = transforms[i].Value.transform.position + (vectors[i].IsNone ? Vector3.zero : vectors[i].Value); } } } } hash.Add("path", tempVct3); hash.Add("movetopath", moveToPath.IsNone ? true : moveToPath.Value); hash.Add("lookahead", lookAhead.IsNone ? 1f : lookAhead.Value); } itweenType = "move"; iTween.MoveTo(go, hash); }
//private void OnGotPM(object sender, BasicCommunication.MessageParser.Got_PM_EventArgs e) //{ // uint quantity = 0; // int SQLID = 0; // int nameToID = -1; // uint ItemsPlacedOnTrade = 0; // string Message = e.Message.ToLower(); // if (Message[0] != '#') // { // Message = "#" + Message; // } // string[] CommandArray = Message.Split(' '); // if (CommandArray[0] == "#buy" || CommandArray[0] == "#b" || CommandArray[0] == "#byt") // { // if (Settings.IsTradeBot == false) // { // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "Sorry, I am not a trade bot!")); // return; // } // bool disabled = TheMySqlManager.CheckIfCommandIsDisabled("#buy", Settings.botid); // if (disabled == true) // { // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "This command is disabled")); // return; // } // if (TheMySqlManager.GetUserRank(e.username, Settings.botid) < TheMySqlManager.GetCommandRank("#buy", Settings.botid)) // { // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "You are not authorized to use this command!")); // return; // } // if (TheTradeHandler.Trading == false || TradeHandler.username.ToLower() != e.username.ToLower()) // { // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "Please trade with me first!")); // return; // } // try // { // if (CommandArray.Length < 2) // { // goto WrongArguments; // } // if (CommandArray.Length < 3) // { // quantity = 1; // nameToID = TheMySqlManager.GetItemID(CommandArray[1], Settings.botid, false); // if (nameToID != -1) // { // SQLID = nameToID; // } // if (nameToID == -1) // { // SQLID = int.Parse(CommandArray[1]); // } // } // if (CommandArray.Length > 2) // { // string str = ""; // int i; // if (!uint.TryParse(CommandArray[1], out quantity)) // { // quantity = 1; // for (i = 1; i < CommandArray.Length; i++) // { // str += CommandArray[i] + " "; // } // } // else // { // for (i = 2; i < CommandArray.Length; i++) // { // str += CommandArray[i] + " "; // } // } // str = str.Trim(); // nameToID = TheMySqlManager.GetItemID(str, Settings.botid,false); // if (nameToID == -1) // { // SQLID = int.Parse(CommandArray[2]); // } // if (nameToID != -1) // { // SQLID = nameToID; // } // } // } // catch // { // goto WrongArguments; // } // if (TheTradeHandler.Donating == true) // { // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "Sorry, I can't sell you items while donating. Please start a new trade session.")); // return; // } // System.Collections.Hashtable MySellingItemList = TheMySqlManager.GetSellingItemList(0); // if (MySellingItemList.Contains(SQLID)) // { // ItemsPlacedOnTrade = TheTradeHandler.PutItemsOnTrade(SQLID, quantity); // TradeHandler.SellingItem MySellingItem = (TradeHandler.SellingItem)MySellingItemList[SQLID]; // if (ItemsPlacedOnTrade > 0) // { // Check if the user is member if the trade alliance // decimal temp = 0; // if (TheMySqlManager.CheckIfTradeMember(e.username, Settings.botid) == true) // { // TheTradeHandler.AddTrade(SQLID, MySellingItem.pricesalemembers, ItemsPlacedOnTrade, "sold to"); // temp = (decimal)MySellingItem.pricesalemembers * ItemsPlacedOnTrade; // TheTradeHandler.ChangeBillance(-(System.Convert.ToInt32(System.Math.Ceiling(temp)))); // } // else // { // TheTradeHandler.AddTrade(SQLID, MySellingItem.pricesale, ItemsPlacedOnTrade, "sold to"); // temp = (decimal)MySellingItem.pricesale * ItemsPlacedOnTrade; // TheTradeHandler.ChangeBillance(-((System.Convert.ToInt32(System.Math.Ceiling(temp))))); // } // } // } // if (ItemsPlacedOnTrade < quantity) // { // if (ItemsPlacedOnTrade == 0) // { // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "Sorry, I don't have this item!")); // } // else // { // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "Sorry, I only have " + ItemsPlacedOnTrade.ToString() + " of this item!")); // } // } // } // return; //WrongArguments: // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "|---------------------------------------")); // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "|Here is the usage of the #buy command: ")); // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "|#buy <quantity> <name or itemid> ")); // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "|---------------------------------------")); // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "|Example: #buy 12 2 ")); // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "|Example: #buy 1 Pickaxe ")); // TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "|---------------------------------------")); // return; //} private void OnGotPM(object sender, BasicCommunication.MessageParser.Got_PM_EventArgs e) { uint quantity = 0; int SQLID = 0; int nameToID = -1; uint ItemsPlacedOnTrade = 0; string Message = e.Message.ToLower(); if (Message[0] != '#') { Message = "#" + Message; } string[] CommandArray = Message.Split(' '); if (CommandArray[0] == "#buy" || CommandArray[0] == "#b" || CommandArray[0] == "#byt") { if (Settings.IsTradeBot == false) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "Sorry, I am not a trade bot!")); return; } bool disabled = TheMySqlManager.CheckIfCommandIsDisabled("#buy", Settings.botid); if (disabled == true) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "This command is disabled")); return; } if (TheMySqlManager.GetUserRank(e.username, Settings.botid) < TheMySqlManager.GetCommandRank("#buy", Settings.botid)) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "You are not authorized to use this command!")); return; } if (TheTradeHandler.Trading == false || TradeHandler.username.ToLower() != e.username.ToLower()) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "Please trade with me first!")); return; } if (TheTradeHandler.AcceptStateMe > 0) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "You cannont issue more buy commands once I've partially accepted the trade!")); return; } try { if (CommandArray.Length < 2) { goto WrongArguments; } if (CommandArray.Length < 3) { quantity = 1; nameToID = TheMySqlManager.GetItemID(CommandArray[1], Settings.botid, false); if (nameToID != -1) { SQLID = nameToID; } if (nameToID == -1) { SQLID = int.Parse(CommandArray[1]); } } if (CommandArray.Length > 2) { string str = ""; int i; if (!uint.TryParse(CommandArray[1], out quantity)) { quantity = 1; for (i = 1; i < CommandArray.Length; i++) { str += CommandArray[i] + " "; } } else { for (i = 2; i < CommandArray.Length; i++) { str += CommandArray[i] + " "; } } str = str.Trim(); nameToID = TheMySqlManager.GetItemID(str, Settings.botid, false); if (nameToID == -1) { SQLID = int.Parse(CommandArray[2]); } if (nameToID != -1) { SQLID = nameToID; } } } catch { goto WrongArguments; } if (TheTradeHandler.Donating == true) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "Sorry, I can't sell you items while donating. Please start a new trade session.")); return; } System.Collections.Hashtable MySellingItemList = TheMySqlManager.GetSellingItemList(0); bool itemFound = false; foreach (int itemId in MySellingItemList.Keys) { if (SQLID == itemId) { itemFound = true; } } if (itemFound) { TheTradeHandler.totalCalculated = false; ItemsPlacedOnTrade = TheTradeHandler.PutItemsOnTrade(SQLID, quantity); TradeHandler.SellingItem MySellingItem = (TradeHandler.SellingItem)MySellingItemList[SQLID]; if (ItemsPlacedOnTrade > 0) { // Check if the user is member if the trade alliance //decimal temp = 0; if (TheMySqlManager.CheckIfTradeMember(e.username, Settings.botid) == true) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "I sell " + TheMySqlManager.GetKnownItemsname(MySellingItem.KnownItemsSqlID) + " for " + MySellingItem.pricesalemembers + "gc each.")); TheTradeHandler.AddTrade(SQLID, MySellingItem.pricesalemembers, ItemsPlacedOnTrade, "sold to"); //temp = (decimal)MySellingItem.pricesalemembers * ItemsPlacedOnTrade; //TheTradeHandler.ChangeBillance(-(System.Convert.ToInt32(System.Math.Ceiling(temp)))); } else { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "I sell " + TheMySqlManager.GetKnownItemsname(MySellingItem.KnownItemsSqlID) + " for " + MySellingItem.pricesale + "gc each.")); TheTradeHandler.AddTrade(SQLID, MySellingItem.pricesale, ItemsPlacedOnTrade, "sold to"); //temp = (decimal)MySellingItem.pricesale * ItemsPlacedOnTrade; //TheTradeHandler.ChangeBillance(-((System.Convert.ToInt32(System.Math.Ceiling(temp))))); } } } //if (ItemsPlacedOnTrade < quantity) { if (ItemsPlacedOnTrade == 0) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "Sorry, I don't have this item!")); } else if (ItemsPlacedOnTrade < quantity) { TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "Sorry, I only have " + ItemsPlacedOnTrade.ToString() + " of this item!")); } } } return; WrongArguments: TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "I don't sell this item or invalid syntax")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "|---------------------------------------")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "|Here is the usage of the #buy command: ")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "|#buy <quantity> <name or itemid> ")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "|---------------------------------------")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "|Example: #buy 12 2 ")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "|Example: #buy 1 Pickaxe ")); TheTCPWrapper.Send(CommandCreator.SEND_PM(e.username, "|---------------------------------------")); return; }
public List <Tipo75> Select(string Cd_empresa, DateTime Dt_ini, DateTime Dt_fin, DateTime?Dt_inventario) { List <Tipo75> retorno = new List <Tipo75>(); bool podeFecharBco = false; if (Banco_Dados == null) { podeFecharBco = this.CriarBanco_Dados(false); } System.Collections.Hashtable hs = new System.Collections.Hashtable(4); hs.Add("@P_CD_EMPRESA", Cd_empresa); hs.Add("@P_DT_INI", Dt_ini); hs.Add("@P_DT_FIN", DateTime.Parse(Dt_fin.ToString("dd/MM/yyyy") + " 23:59:59")); hs.Add("@P_DT_INVENTARIO", Dt_inventario); System.Data.SqlClient.SqlDataReader reader = this.executarProcReader("DBO.STP_FIS_REG75", hs); try { while (reader.Read()) { Tipo75 reg = new Tipo75(); if (!reader.IsDBNull(reader.GetOrdinal("cd_produto"))) { reg.Cd_produto = reader.GetString(reader.GetOrdinal("cd_produto")); } if (!reader.IsDBNull(reader.GetOrdinal("ds_produto"))) { reg.Ds_produto = reader.GetString(reader.GetOrdinal("ds_produto")); } if (!reader.IsDBNull(reader.GetOrdinal("ncm"))) { reg.Ncm = reader.GetString(reader.GetOrdinal("ncm")); } if (!reader.IsDBNull(reader.GetOrdinal("sigla_unidade"))) { reg.Sigla = reader.GetString(reader.GetOrdinal("sigla_unidade")); } if (!reader.IsDBNull(reader.GetOrdinal("pc_aliquota_ipi"))) { reg.Pc_aliquota_ipi = reader.GetDecimal(reader.GetOrdinal("pc_aliquota_ipi")); } if (!reader.IsDBNull(reader.GetOrdinal("pc_aliquota_icms"))) { reg.Pc_aliquota_icms = reader.GetDecimal(reader.GetOrdinal("pc_aliquota_icms")); } if (!reader.IsDBNull(reader.GetOrdinal("pc_reducaobasecalc"))) { reg.Pc_reducao_basecalcicms = reader.GetDecimal(reader.GetOrdinal("pc_reducaobasecalc")); } if (!reader.IsDBNull(reader.GetOrdinal("vl_basecalcsubsttrib"))) { reg.Base_calc_icms_substtrib = reader.GetDecimal(reader.GetOrdinal("vl_basecalcsubsttrib")); } retorno.Add(reg); } return(retorno); } finally { reader.Close(); reader.Dispose(); if (podeFecharBco) { this.deletarBanco_Dados(); } } }
/// <summary> Create bonds when reading a protein PDB file. NB ONLY works for protein /// PDB files! If you want to read small molecules I recommend using molecule /// file format where the connectivity is explicitly stated. [This method can /// however reasonably easily be extended to cover e.g. nucleic acids or your /// favourite small molecule]. Returns 'false' if bonds could not be created /// due to incomplete pdb-records or other reasons. /// /// </summary> /// <param name="pol">The Biopolymer to work on /// </param> public virtual bool createBonds(IBioPolymer pol) { //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'" System.Collections.Hashtable AAs = AminoAcids.HashMapByThreeLetterCode; int[][] AABondInfo = AminoAcids.aaBondInfo(); System.Collections.Hashtable strands = pol.Strands; System.Collections.IEnumerator strandKeys = strands.Keys.GetEnumerator(); //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'" while (strandKeys.MoveNext()) { //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'" IStrand strand = (IStrand)strands[strandKeys.Current]; int atoms = 0; int atomsInLastResidue = 0; int atomsInPresentResidue = 0; while (atoms < strand.AtomCount - 1) { PDBAtom anAtom = (PDBAtom)strand.getAtomAt(atoms); // Check that we have bond info about residue/ligand, if not - exit. if (!AAs.ContainsKey(anAtom.ResName)) { return(false); } //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'" IMonomer monomer = (IMonomer)AAs[anAtom.ResName]; atomsInPresentResidue = System.Int32.Parse((string)monomer.getProperty(AminoAcids.NO_ATOMS)); /* Check if there's something wrong with the residue record (e.g. it doesn't contain the * correct number of atom records). */ int counter = 1; while (atoms + counter < strand.AtomCount && anAtom.ResName.Equals(strand.getAtomAt(atoms + counter).getProperty(AminoAcids.RESIDUE_NAME))) { counter++; } // Check if something is wrong. Remember to deal with possible OXT atom... if (counter % atomsInPresentResidue != 0 && (atoms + counter == strand.AtomCount && counter % atomsInPresentResidue != 1)) { return(false); } // If nothing's wrong, add bonds int bondID = System.Int32.Parse((string)monomer.getProperty(AminoAcids.ID)); for (int l = 0; l < System.Int32.Parse((string)monomer.getProperty(AminoAcids.NO_BONDS)); l++) { IBond bond = pol.Builder.newBond(strand.getAtomAt(AABondInfo[bondID + l][1] + atoms), strand.getAtomAt(AABondInfo[bondID + l][2] + atoms), (double)(AABondInfo[bondID + l][3])); pol.addBond(bond); } // If not first residue, connect residues if (atomsInLastResidue != 0) { IBond bond = pol.Builder.newBond(strand.getAtomAt(atoms - atomsInLastResidue + 2), strand.getAtomAt(atoms), 1); pol.addBond(bond); } atoms = atoms + atomsInPresentResidue; atomsInLastResidue = atomsInPresentResidue; // Check if next atom is an OXT. The reason to why this is seemingly overly complex is because // not all PDB-files have ending OXT. If that were the case you could just check if // atoms == mol.getAtomCount()... if (strand.AtomCount < atoms && ((PDBAtom)strand.getAtomAt(atoms)).Oxt) { // if(strand.getAtomCount() < atoms && ((String)strand.getAtomAt(atoms).getProperty("oxt")).equals("1")) { IBond bond = pol.Builder.newBond(strand.getAtomAt(atoms - atomsInLastResidue + 2), strand.getAtomAt(atoms), 1); pol.addBond(bond); } } } return(true); }
public List <DTO.PriceComparison.ProductOptionDetailDTO> GetBestComparableItemData(System.Collections.Hashtable filters, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; List <DTO.PriceComparison.ProductOptionDetailDTO> result = new List <DTO.PriceComparison.ProductOptionDetailDTO>(); //try to get data try { using (ProductOverviewRptEntities context = CreateContext()) { string Season = null; int? FactoryID = null; int? QuotationStatusID = null; int? ModelID = null; int? FactoryOrderDetailID = null; int? MaterialID = null; int? MaterialTypeID = null; int? MaterialColorID = null; int? FrameMaterialID = null; int? FrameMaterialColorID = null; int? SubMaterialID = null; int? SubMaterialColorID = null; int? BackCushionID = null; int? SeatCushionID = null; int? CushionColorID = null; int? FSCTypeID = null; int? FSCPercentID = null; bool? UseFSCLabel = null; int? PackagingMethodID = null; int? ClientSpecialPackagingMethodID = null; if (filters.ContainsKey("Season") && filters["Season"] != null && !string.IsNullOrEmpty(filters["Season"].ToString())) { Season = filters["Season"].ToString().Replace("'", "''"); } if (filters.ContainsKey("FactoryID") && filters["FactoryID"] != null && !string.IsNullOrEmpty(filters["FactoryID"].ToString())) { FactoryID = Convert.ToInt32(filters["FactoryID"].ToString()); } if (filters.ContainsKey("QuotationStatusID") && filters["QuotationStatusID"] != null && !string.IsNullOrEmpty(filters["QuotationStatusID"].ToString())) { QuotationStatusID = Convert.ToInt32(filters["QuotationStatusID"].ToString()); } if (filters.ContainsKey("ModelID") && filters["ModelID"] != null && !string.IsNullOrEmpty(filters["ModelID"].ToString())) { ModelID = Convert.ToInt32(filters["ModelID"].ToString()); } if (filters.ContainsKey("FactoryOrderDetailID") && filters["FactoryOrderDetailID"] != null && !string.IsNullOrEmpty(filters["FactoryOrderDetailID"].ToString())) { FactoryOrderDetailID = Convert.ToInt32(filters["FactoryOrderDetailID"].ToString()); } if (filters.ContainsKey("MaterialID") && filters["MaterialID"] != null && !string.IsNullOrEmpty(filters["MaterialID"].ToString())) { MaterialID = Convert.ToInt32(filters["MaterialID"].ToString()); } if (filters.ContainsKey("MaterialTypeID") && filters["MaterialTypeID"] != null && !string.IsNullOrEmpty(filters["MaterialTypeID"].ToString())) { MaterialTypeID = Convert.ToInt32(filters["MaterialTypeID"].ToString()); } if (filters.ContainsKey("MaterialColorID") && filters["MaterialColorID"] != null && !string.IsNullOrEmpty(filters["MaterialColorID"].ToString())) { MaterialColorID = Convert.ToInt32(filters["MaterialColorID"].ToString()); } if (filters.ContainsKey("FrameMaterialID") && filters["FrameMaterialID"] != null && !string.IsNullOrEmpty(filters["FrameMaterialID"].ToString())) { FrameMaterialID = Convert.ToInt32(filters["FrameMaterialID"].ToString()); } if (filters.ContainsKey("FrameMaterialColorID") && filters["FrameMaterialColorID"] != null && !string.IsNullOrEmpty(filters["FrameMaterialColorID"].ToString())) { FrameMaterialColorID = Convert.ToInt32(filters["FrameMaterialColorID"].ToString()); } if (filters.ContainsKey("SubMaterialID") && filters["SubMaterialID"] != null && !string.IsNullOrEmpty(filters["SubMaterialID"].ToString())) { SubMaterialID = Convert.ToInt32(filters["SubMaterialID"].ToString()); } if (filters.ContainsKey("SubMaterialColorID") && filters["SubMaterialColorID"] != null && !string.IsNullOrEmpty(filters["SubMaterialColorID"].ToString())) { SubMaterialColorID = Convert.ToInt32(filters["SubMaterialColorID"].ToString()); } if (filters.ContainsKey("BackCushionID") && filters["BackCushionID"] != null && !string.IsNullOrEmpty(filters["BackCushionID"].ToString())) { BackCushionID = Convert.ToInt32(filters["BackCushionID"].ToString()); } if (filters.ContainsKey("SeatCushionID") && filters["SeatCushionID"] != null && !string.IsNullOrEmpty(filters["SeatCushionID"].ToString())) { SeatCushionID = Convert.ToInt32(filters["SeatCushionID"].ToString()); } if (filters.ContainsKey("CushionColorID") && filters["CushionColorID"] != null && !string.IsNullOrEmpty(filters["CushionColorID"].ToString())) { CushionColorID = Convert.ToInt32(filters["CushionColorID"].ToString()); } if (filters.ContainsKey("FSCTypeID") && filters["FSCTypeID"] != null && !string.IsNullOrEmpty(filters["FSCTypeID"].ToString())) { FSCTypeID = Convert.ToInt32(filters["FSCTypeID"].ToString()); } if (filters.ContainsKey("FSCPercentID") && filters["FSCPercentID"] != null && !string.IsNullOrEmpty(filters["FSCPercentID"].ToString())) { FSCPercentID = Convert.ToInt32(filters["FSCPercentID"].ToString()); } if (filters.ContainsKey("UseFSCLabel") && filters["UseFSCLabel"] != null && !string.IsNullOrEmpty(filters["UseFSCLabel"].ToString())) { UseFSCLabel = Convert.ToBoolean(filters["UseFSCLabel"].ToString()); } if (filters.ContainsKey("PackagingMethodID") && filters["PackagingMethodID"] != null && !string.IsNullOrEmpty(filters["PackagingMethodID"].ToString())) { PackagingMethodID = Convert.ToInt32(filters["PackagingMethodID"].ToString()); } if (filters.ContainsKey("ClientSpecialPackagingMethodID") && filters["ClientSpecialPackagingMethodID"] != null && !string.IsNullOrEmpty(filters["ClientSpecialPackagingMethodID"].ToString())) { ClientSpecialPackagingMethodID = Convert.ToInt32(filters["ClientSpecialPackagingMethodID"].ToString()); } result = converter.DB2DTO_PriceComparison_ProductOptionDetailList( context.ProductOverviewRpt_function_SearchBestComparableItem( Season , FactoryID , QuotationStatusID , ModelID , FactoryOrderDetailID , MaterialID , MaterialTypeID , MaterialColorID , FrameMaterialID , FrameMaterialColorID , SubMaterialID , SubMaterialColorID , BackCushionID , SeatCushionID , CushionColorID , FSCTypeID , FSCPercentID , UseFSCLabel , PackagingMethodID , ClientSpecialPackagingMethodID ).ToList()); } } catch (Exception ex) { ex = Library.Helper.GetInnerException(ex); notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(result); }
public DTO.SearchFormData GetDataWithFilter(int userId, System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.SearchFormData data = new DTO.SearchFormData(); data.Data = new List <DTO.ProductSearchResultDTO>(); totalRows = 0; //try to get data try { using (WEXStockOverviewRptEntities context = CreateContext()) { string ArticleCode = null; string SubEANCode = null; string Description = null; string ProductTypeNM = null; bool? NoImage = false; int? ItemSourceID = null; if (filters.ContainsKey("ArticleCode") && !string.IsNullOrEmpty(filters["ArticleCode"].ToString())) { ArticleCode = filters["ArticleCode"].ToString().Replace("'", "''"); } if (filters.ContainsKey("SubEANCode") && !string.IsNullOrEmpty(filters["SubEANCode"].ToString())) { SubEANCode = filters["SubEANCode"].ToString().Replace("'", "''"); } if (filters.ContainsKey("Description") && !string.IsNullOrEmpty(filters["Description"].ToString())) { Description = filters["Description"].ToString().Replace("'", "''"); } if (filters.ContainsKey("ProductTypeNM") && !string.IsNullOrEmpty(filters["ProductTypeNM"].ToString())) { ProductTypeNM = filters["ProductTypeNM"].ToString().Replace("'", "''"); } if (filters.ContainsKey("NoImage") && filters["NoImage"] != null && !string.IsNullOrEmpty(filters["NoImage"].ToString())) { NoImage = (filters["NoImage"].ToString() == "true") ? true : false; } if (filters.ContainsKey("ItemSourceID") && filters["ItemSourceID"] != null && !string.IsNullOrEmpty(filters["ItemSourceID"].ToString())) { ItemSourceID = Convert.ToInt32(filters["ItemSourceID"]); } totalRows = context.WEXStockOverviewRpt_function_SearchProduct(ArticleCode, SubEANCode, Description, ProductTypeNM, NoImage, ItemSourceID, orderBy, orderDirection).Count(); var result = context.WEXStockOverviewRpt_function_SearchProduct(ArticleCode, SubEANCode, Description, ProductTypeNM, NoImage, ItemSourceID, orderBy, orderDirection); //data.Data = converter.DB2DTO_ProductSearchResultList(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()); data.Data = converter.DB2DTO_ProductSearchResultList(result.ToList()); if (!fwFactory.HasSpecialPermission(userId, Module.Framework.ConstantIdentifier.SPECIAL_PERMISSION_WEX_VVP)) { data.Data.ForEach(o => o.VVPPrice = null); } } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(data); }
public virtual void TestDeleteLeftoverFiles() { Directory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED); writer.SetMaxBufferedDocs(10); int i; for (i = 0; i < 35; i++) { AddDoc(writer, i); } writer.UseCompoundFile = false; for (; i < 45; i++) { AddDoc(writer, i); } writer.Close(); // Delete one doc so we get a .del file: IndexReader reader = IndexReader.Open(dir, false); Term searchTerm = new Term("id", "7"); int delCount = reader.DeleteDocuments(searchTerm); Assert.AreEqual(1, delCount, "didn't delete the right number of documents"); // Set one norm so we get a .s0 file: reader.SetNorm(21, "content", (float)1.5); reader.Close(); // Now, artificially create an extra .del file & extra // .s0 file: System.String[] files = dir.ListAll(); /* * for(int j=0;j<files.length;j++) { * System.out.println(j + ": " + files[j]); * } */ // The numbering of fields can vary depending on which // JRE is in use. On some JREs we see content bound to // field 0; on others, field 1. So, here we have to // figure out which field number corresponds to // "content", and then set our expected file names below // accordingly: CompoundFileReader cfsReader = new CompoundFileReader(dir, "_2.cfs"); FieldInfos fieldInfos = new FieldInfos(cfsReader, "_2.fnm"); int contentFieldIndex = -1; for (i = 0; i < fieldInfos.Size(); i++) { FieldInfo fi = fieldInfos.FieldInfo(i); if (fi.name_ForNUnit.Equals("content")) { contentFieldIndex = i; break; } } cfsReader.Close(); Assert.IsTrue(contentFieldIndex != -1, "could not locate the 'content' field number in the _2.cfs segment"); System.String normSuffix = "s" + contentFieldIndex; // Create a bogus separate norms file for a // segment/field that actually has a separate norms file // already: CopyFile(dir, "_2_1." + normSuffix, "_2_2." + normSuffix); // Create a bogus separate norms file for a // segment/field that actually has a separate norms file // already, using the "not compound file" extension: CopyFile(dir, "_2_1." + normSuffix, "_2_2.f" + contentFieldIndex); // Create a bogus separate norms file for a // segment/field that does not have a separate norms // file already: CopyFile(dir, "_2_1." + normSuffix, "_1_1." + normSuffix); // Create a bogus separate norms file for a // segment/field that does not have a separate norms // file already using the "not compound file" extension: CopyFile(dir, "_2_1." + normSuffix, "_1_1.f" + contentFieldIndex); // Create a bogus separate del file for a // segment that already has a separate del file: CopyFile(dir, "_0_1.del", "_0_2.del"); // Create a bogus separate del file for a // segment that does not yet have a separate del file: CopyFile(dir, "_0_1.del", "_1_1.del"); // Create a bogus separate del file for a // non-existent segment: CopyFile(dir, "_0_1.del", "_188_1.del"); // Create a bogus segment file: CopyFile(dir, "_0.cfs", "_188.cfs"); // Create a bogus fnm file when the CFS already exists: CopyFile(dir, "_0.cfs", "_0.fnm"); // Create a deletable file: CopyFile(dir, "_0.cfs", "deletable"); // Create some old segments file: CopyFile(dir, "segments_3", "segments"); CopyFile(dir, "segments_3", "segments_2"); // Create a bogus cfs file shadowing a non-cfs segment: CopyFile(dir, "_2.cfs", "_3.cfs"); System.String[] filesPre = dir.ListAll(); // Open & close a writer: it should delete the above 4 // files and nothing more: writer = new IndexWriter(dir, new WhitespaceAnalyzer(), false, IndexWriter.MaxFieldLength.LIMITED); writer.Close(); System.String[] files2 = dir.ListAll(); dir.Close(); System.Array.Sort(files); System.Array.Sort(files2); System.Collections.Hashtable dif = DifFiles(files, files2); if (!CollectionsHelper.Equals(files, files2)) { Assert.Fail("IndexFileDeleter failed to delete unreferenced extra files: should have deleted " + (filesPre.Length - files.Length) + " files but only deleted " + (filesPre.Length - files2.Length) + "; expected files:\n " + AsString(files) + "\n actual files:\n " + AsString(files2) + "\ndif: " + CollectionsHelper.CollectionToString(dif)); } }
public object GetDataWithFilter(int userId, System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification) { throw new NotImplementedException(); //return bll.GetDataWithFilter(userId, filters, pageSize, pageIndex, orderBy, orderDirection, out totalRows, out notification); }
public string ExportExcel(int userId, System.Collections.Hashtable filters, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; ReportDataObject ds = new ReportDataObject(); try { SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("WEXStockOverviewRpt_function_ExportProduct", new SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; if (filters.ContainsKey("ArticleCode") && !string.IsNullOrEmpty(filters["ArticleCode"].ToString())) { adap.SelectCommand.Parameters.AddWithValue("@ArticleCode", filters["ArticleCode"].ToString().Replace("'", "''")); } if (filters.ContainsKey("SubEANCode") && !string.IsNullOrEmpty(filters["SubEANCode"].ToString())) { adap.SelectCommand.Parameters.AddWithValue("@SubEANCode", filters["SubEANCode"].ToString().Replace("'", "''")); } if (filters.ContainsKey("Description") && !string.IsNullOrEmpty(filters["Description"].ToString())) { adap.SelectCommand.Parameters.AddWithValue("@Description", filters["Description"].ToString().Replace("'", "''")); } if (filters.ContainsKey("ProductTypeNM") && !string.IsNullOrEmpty(filters["ProductTypeNM"].ToString())) { adap.SelectCommand.Parameters.AddWithValue("@ProductTypeNM", filters["ProductTypeNM"].ToString().Replace("'", "''")); } if (filters.ContainsKey("NoImage") && filters["NoImage"] != null && !string.IsNullOrEmpty(filters["NoImage"].ToString())) { adap.SelectCommand.Parameters.AddWithValue("@NoImage", filters["NoImage"].ToString().Replace("'", "''")); } adap.Fill(ds.WEXStockOverviewRpt_ExcelData_View); if (!fwFactory.HasSpecialPermission(userId, Module.Framework.ConstantIdentifier.SPECIAL_PERMISSION_WEX_VVP)) { foreach (ReportDataObject.WEXStockOverviewRpt_ExcelData_ViewRow mRow in ds.WEXStockOverviewRpt_ExcelData_View) { mRow.SetVVPPriceNull(); } } ds.AcceptChanges(); //// prepare cache image //foreach (ReportDataObject.WEXStockOverviewRpt_ProductSearchResult_ViewRow mRow in ds.WEXStockOverviewRpt_ProductSearchResult_View) //{ // try // { // fwFactory.CreateImageCache(mRow.ImageFile, 120, 120, false); // } // catch { } //} return(Library.Helper.CreateReportFileWithEPPlus(ds, "WEXStockOverview", new List <string>() { "WEXStockOverviewRpt_ExcelData_View" })); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }
public object CustomFunction(int userId, string identifier, System.Collections.Hashtable input, out Library.DTO.Notification notification) { throw new NotImplementedException(); }
public object CustomFunction(int userId, string identifier, System.Collections.Hashtable input, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification { Type = Library.DTO.NotificationType.Success }; switch (identifier.ToLower()) { case "gethtmlreport": if (input.ContainsKey("Season")) { return(bll.GetReportData(userId, input["Season"].ToString(), out notification)); } else { notification.Message = "unknow season"; notification.Type = Library.DTO.NotificationType.Error; } break; case "get-proforma-invoice-confirmed": if (input.ContainsKey("Season")) { return(bll.GetProformaInvoiceConfirmed(userId, input["Season"].ToString(), out notification)); } else { notification.Message = "unknow season"; notification.Type = Library.DTO.NotificationType.Error; } break; case "get-proforma-invoice": if (input.ContainsKey("Season")) { return(bll.GetProformaInvoice(userId, input["Season"].ToString(), out notification)); } else { notification.Message = "unknow season"; notification.Type = Library.DTO.NotificationType.Error; } break; case "get-expectations": if (input.ContainsKey("Season")) { return(bll.GetExpectations(userId, input["Season"].ToString(), out notification)); } else { notification.Message = "unknow season"; notification.Type = Library.DTO.NotificationType.Error; } break; case "get-eurofar-commercial-invoices": if (input.ContainsKey("Season")) { return(bll.GetEurofarCommercialInvoices(userId, input["Season"].ToString(), out notification)); } else { notification.Message = "unknow season"; notification.Type = Library.DTO.NotificationType.Error; } break; } notification = new Library.DTO.Notification { Type = Library.DTO.NotificationType.Error, Message = "Custom function's identifier not matched" }; return(null); }
public override bool setProperties(System.Collections.Hashtable props) { base.setProperties(props); if (stack.StackType == ProtocolStackType.TCP) { this.up_thread = false; this.down_thread = false; if (Stack.NCacheLog.IsInfoEnabled) { Stack.NCacheLog.Info(Name + ".setProperties", "part of TCP stack"); } } if (props.Contains("timeout")) // max time to wait for initial members { timeout = Convert.ToInt64(props["timeout"]); props.Remove("timeout"); } if (props.Contains("port_range")) // if member cannot be contacted on base port, { // how many times can we increment the port port_range = Convert.ToInt32(props["port_range"]); if (port_range < 1) { port_range = 1; } props.Remove("port_range"); } if (props.Contains("static")) { isStatic = Convert.ToBoolean(props["static"]); props.Remove("static"); } if (props.Contains("num_initial_members")) // wait for at most n members { num_initial_members = Convert.ToInt32(props["num_initial_members"]); props.Remove("num_initial_members"); } if (props.Contains("initial_hosts")) { String tmp = (String)props["initial_hosts"]; if (tmp != null && tmp.Length > 0) { initial_hosts = createInitialHosts(Convert.ToString(tmp)); } if (initial_hosts != null) { if (num_initial_members != initial_hosts.Count) { num_initial_members = initial_hosts.Count; } } if (num_initial_members > 5) { //We estimate the time for finding initital members //for every member we add 1 sec timeout. long temp = num_initial_members - 5; timeout += (temp * 1000); } props.Remove("initial_hosts"); } if (props.Contains("discovery_addr")) { discovery_addr = Convert.ToString(props["discovery_addr"]); if (discovery_addr != null && discovery_addr.Length > 0) { isStatic = false; } else { isStatic = true; } props.Remove("discovery_addr"); } if (props.Contains("discovery_port")) { discovery_port = Convert.ToInt32(props["discovery_port"]); props.Remove("discovery_port"); } if (props.Count > 0) { return(true); } return(true); }
public List <DTO.BookingDTO> GetBooking(int iRequesterID, System.Collections.Hashtable filters, out Notification notification) { return(factory.GetBooking(filters, out notification)); }
/// <summary> /// This expects that the last column will be Amount. If not It will do nothing. /// RunDetialReport(Guarantor) query first. // Adds Provider's abbreviations to Table as well /// /// Adds a column to report.TableQ /// </summary> private static void AddColBalance(ReportSimpleGrid report) //to report.TableQ { if (report.TableQ != null && report.TableQ.Columns.Count == 10) { if (report.TableQ.Columns[8].ColumnName == "Amount") { decimal RunningBalance = 0; // Find Provider Abbreviations System.Collections.Hashtable htProvs = new System.Collections.Hashtable(); try { DataTable dt = Db.GetTableOld("SELECT ProvNum, Abbr FROM Provider"); if (dt.Rows.Count != 0) { foreach (DataRow dr in dt.Rows) { if (!htProvs.ContainsKey(dr[0].ToString())) { htProvs[dr[0].ToString()] = dr[1].ToString(); } } } if (!htProvs.ContainsKey("0")) { htProvs["0"] = "UnEarned"; } } catch { } for (int i = 0; i < report.TableQ.Rows.Count; i++) { try { decimal amount = 0; try { amount = decimal.Parse(report.TableQ.Rows[i][8].ToString()); } catch { } RunningBalance += amount; if (amount > 0) { report.TableQ.Rows[i][5] = amount.ToString("F2"); report.TableQ.Rows[i][6] = ""; } else { report.TableQ.Rows[i][5] = ""; report.TableQ.Rows[i][6] = amount.ToString("F2"); } report.TableQ.Rows[i][7] = RunningBalance.ToString("F2"); // Fix Provider Column From # to Abreviation, Need to do it here // because Prov# = 0 is undefined if (htProvs.Count != 0) { if (htProvs.ContainsKey(report.TableQ.Rows[i][9].ToString())) { report.TableQ.Rows[i][4] = htProvs[report.TableQ.Rows[i][9].ToString()].ToString(); } } // Change Column 0 Date Display if Date on previous row has been displayed if (i > 0) { if (report.TableQ.Rows[i][0].ToString() == report.TableQ.Rows[i - 1][0].ToString()) { report.TableQ.Rows[i][0] = ""; // makes Dates more readable if not redundant. } } } catch { report.TableQ.Rows[i][7] = "ERROR"; } } report.TableQ.Columns.RemoveAt(8); // Remove Amount report.TableQ.Columns.RemoveAt(8); // Remove ProvNums DataRow dr2 = report.TableQ.NewRow(); report.TableQ.Rows.Add(dr2); // add blank row dr2 = report.TableQ.NewRow(); dr2[6] = "Total"; dr2[7] = RunningBalance.ToString("F"); report.TableQ.Rows.Add(dr2); } } }
public void SetExtraPara(System.Collections.Hashtable para) { extrapara = para; }
/// <summary> /// 添加员工福利情况 HR_Benefit对象(即:一条记录) /// </summary> public int Add(HR_Benefit hR_Benefit) { string sql = "INSERT INTO HR_Benefit (HRB_Code,HRB_EName,HRB_ECode,HRB_Key,HRB_Name,HRB_Sum,HRB_IsDone,HRB_Date,HRB_NextDate,HRB_Bak1,HRB_Bak2,Stat,CreateDate,UpdateDate,DeleteDate) VALUES (@HRB_Code,@HRB_EName,@HRB_ECode,@HRB_Key,@HRB_Name,@HRB_Sum,@HRB_IsDone,@HRB_Date,@HRB_NextDate,@HRB_Bak1,@HRB_Bak2,@Stat,@CreateDate,@UpdateDate,@DeleteDate)"; if (string.IsNullOrEmpty(hR_Benefit.HRB_Code)) { idb.AddParameter("@HRB_Code", DBNull.Value); } else { idb.AddParameter("@HRB_Code", hR_Benefit.HRB_Code); } if (string.IsNullOrEmpty(hR_Benefit.HRB_EName)) { idb.AddParameter("@HRB_EName", DBNull.Value); } else { idb.AddParameter("@HRB_EName", hR_Benefit.HRB_EName); } if (string.IsNullOrEmpty(hR_Benefit.HRB_ECode)) { idb.AddParameter("@HRB_ECode", DBNull.Value); } else { idb.AddParameter("@HRB_ECode", hR_Benefit.HRB_ECode); } if (string.IsNullOrEmpty(hR_Benefit.HRB_Key)) { idb.AddParameter("@HRB_Key", DBNull.Value); } else { idb.AddParameter("@HRB_Key", hR_Benefit.HRB_Key); } if (string.IsNullOrEmpty(hR_Benefit.HRB_Name)) { idb.AddParameter("@HRB_Name", DBNull.Value); } else { idb.AddParameter("@HRB_Name", hR_Benefit.HRB_Name); } if (hR_Benefit.HRB_Sum == 0) { idb.AddParameter("@HRB_Sum", 0); } else { idb.AddParameter("@HRB_Sum", hR_Benefit.HRB_Sum); } if (string.IsNullOrEmpty(hR_Benefit.HRB_IsDone)) { idb.AddParameter("@HRB_IsDone", DBNull.Value); } else { idb.AddParameter("@HRB_IsDone", hR_Benefit.HRB_IsDone); } if (hR_Benefit.HRB_Date == DateTime.MinValue) { idb.AddParameter("@HRB_Date", DBNull.Value); } else { idb.AddParameter("@HRB_Date", hR_Benefit.HRB_Date); } if (hR_Benefit.HRB_NextDate == DateTime.MinValue) { idb.AddParameter("@HRB_NextDate", DBNull.Value); } else { idb.AddParameter("@HRB_NextDate", hR_Benefit.HRB_NextDate); } if (string.IsNullOrEmpty(hR_Benefit.HRB_Bak1)) { idb.AddParameter("@HRB_Bak1", DBNull.Value); } else { idb.AddParameter("@HRB_Bak1", hR_Benefit.HRB_Bak1); } if (string.IsNullOrEmpty(hR_Benefit.HRB_Bak2)) { idb.AddParameter("@HRB_Bak2", DBNull.Value); } else { idb.AddParameter("@HRB_Bak2", hR_Benefit.HRB_Bak2); } if (hR_Benefit.Stat == 0) { idb.AddParameter("@Stat", 0); } else { idb.AddParameter("@Stat", hR_Benefit.Stat); } if (hR_Benefit.CreateDate == DateTime.MinValue) { idb.AddParameter("@CreateDate", DBNull.Value); } else { idb.AddParameter("@CreateDate", hR_Benefit.CreateDate); } if (hR_Benefit.UpdateDate == DateTime.MinValue) { idb.AddParameter("@UpdateDate", DBNull.Value); } else { idb.AddParameter("@UpdateDate", hR_Benefit.UpdateDate); } if (hR_Benefit.DeleteDate == DateTime.MinValue) { idb.AddParameter("@DeleteDate", DBNull.Value); } else { idb.AddParameter("@DeleteDate", hR_Benefit.DeleteDate); } int Re = 0; //SQL日志记录 var RunMethod = System.Reflection.MethodBase.GetCurrentMethod(); System.Collections.Hashtable param = new System.Collections.Hashtable(); string Ex = "0"; foreach (System.Collections.DictionaryEntry item in idb.GetParameters()) { param.Add(item.Key, item.Value); } try { Re = idb.ExeCmd(sql); Ex = Re.ToString(); } catch (Exception ex) { Ex = ex.Message; } SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex); return(Re); }
/// <summary> /// Generates a Summary Table Outlining the Provider Charges and Revenues /// Illustrating Unearned Income /// use MinDate and MaxDate to flag all dates /// </summary> public static DataTable GenerateSummaryTable(int Guarantor, DateTime dtFrom, DateTime dtTo) { DataTable rValReturnTable = null; DataTable dtProviderBalance = Db.GetTableOld(ProviderRevenueByGuarantor(Guarantor, dtFrom, dtTo)); DataTable dtProvAbbr = Db.GetTableOld("SELECT ProvNum, Abbr FROM Provider"); if (dtProviderBalance != null && dtProviderBalance.Rows.Count != 0) { // Get Provider Abbreviations System.Collections.Hashtable htAllProvs = new System.Collections.Hashtable(); for (int i = 0; i < dtProvAbbr.Rows.Count; i++) { if (!htAllProvs.ContainsKey(dtProvAbbr.Rows[i][0].ToString())) { htAllProvs[dtProvAbbr.Rows[i][0].ToString()] = dtProvAbbr.Rows[i][1].ToString(); } } if (!htAllProvs.ContainsKey("0")) { htAllProvs["0"] = "Unearned"; } // First establish a list of providers System.Collections.ArrayList alProvs = new System.Collections.ArrayList(); for (int i = 0; i < dtProviderBalance.Rows.Count; i++) { if (!alProvs.Contains(dtProviderBalance.Rows[i][0].ToString())) { alProvs.Add(dtProviderBalance.Rows[i][0].ToString()); } } // Fill and Create DataTable DataTable dtBalancesTable = new DataTable(); dtBalancesTable.Columns.Add(new DataColumn("Provider", typeof(string))); dtBalancesTable.Columns.Add(new DataColumn("Charges", typeof(string))); dtBalancesTable.Columns.Add(new DataColumn("Adjustments", typeof(string))); dtBalancesTable.Columns.Add(new DataColumn("Revenue", typeof(string))); dtBalancesTable.Columns.Add(new DataColumn("Balance", typeof(string))); DataRow drWorkingRow = null; int ColumnIndex = -1; try { System.Collections.Hashtable htAllProvs_Indexes = new System.Collections.Hashtable(); for (int i = 0; i < alProvs.Count; i++) // For Each Provider add a Row in the Balances Table { dtBalancesTable.Rows.Add(dtBalancesTable.NewRow()); dtBalancesTable.Rows[i][0] = alProvs[i].ToString(); } for (int i = 0; i < dtProviderBalance.Rows.Count; i++) { drWorkingRow = dtBalancesTable.Rows[alProvs.IndexOf(dtProviderBalance.Rows[i][0].ToString())]; drWorkingRow[0] = htAllProvs[dtProviderBalance.Rows[i][0].ToString()].ToString(); // the abbreviation // Which Column of the Row to add the number to? Find the column // stated in the query's column 2 string ColumnName_FromQuery = dtProviderBalance.Rows[i][2].ToString(); ColumnIndex = dtBalancesTable.Columns.IndexOf(ColumnName_FromQuery); if (ColumnIndex > 0) { drWorkingRow[ColumnIndex] = dtProviderBalance.Rows[i][1].ToString(); // note is not cast as number so numeric specifies cannot apply //ToString("F2"); } else { drWorkingRow[4] = "ERROR!"; } ColumnIndex = -1; } decimal[] Totals = new decimal[4]; // Fill in Null and Empty Entries for (int j = 0; j < dtBalancesTable.Rows.Count; j++) { for (int k = 1; k < dtBalancesTable.Columns.Count; k++) { if (dtBalancesTable.Rows[j][k] == null || dtBalancesTable.Rows[j][k].ToString().Trim() == "") { dtBalancesTable.Rows[j][k] = "0.00"; } if (k == dtBalancesTable.Columns.Count - 1) { decimal Balance = decimal.Parse(dtBalancesTable.Rows[j][1].ToString()) + decimal.Parse(dtBalancesTable.Rows[j][2].ToString()) + decimal.Parse(dtBalancesTable.Rows[j][3].ToString()); dtBalancesTable.Rows[j][4] = Balance.ToString("F2"); } // Add to the Totals to be placed at the bottom of the Table Totals[k - 1] += decimal.Parse(dtBalancesTable.Rows[j][k].ToString()); // Format the Numbers Better dtBalancesTable.Rows[j][k] = decimal.Parse(dtBalancesTable.Rows[j][k].ToString()).ToString("F2"); } } DataRow TotalRow = dtBalancesTable.NewRow(); TotalRow[0] = "Totals-->"; for (int i = 1; i < dtBalancesTable.Columns.Count; i++) { TotalRow[i] = Totals[i - 1].ToString("F2"); } dtBalancesTable.Rows.Add(TotalRow); } catch { } rValReturnTable = dtBalancesTable; // Set this first becuase SummaryTable_as_Strings() will check for _SummaryTable != null // _SummaryTableHeader = SummaryTable_as_Strings(); } return(rValReturnTable); }
public void LoadExperimentParameters(System.Collections.Hashtable parameterTable) { }
/// <summary> /// 更新员工福利情况 HR_Benefit对象(即:一条记录 /// </summary> public int Update(HR_Benefit hR_Benefit) { StringBuilder sbParameter = new StringBuilder(); StringBuilder sb = new StringBuilder(); sb.Append(@"UPDATE HR_Benefit SET "); if (hR_Benefit.HRB_Code_IsChanged) { sbParameter.Append("HRB_Code=@HRB_Code, "); } if (hR_Benefit.HRB_EName_IsChanged) { sbParameter.Append("HRB_EName=@HRB_EName, "); } if (hR_Benefit.HRB_ECode_IsChanged) { sbParameter.Append("HRB_ECode=@HRB_ECode, "); } if (hR_Benefit.HRB_Key_IsChanged) { sbParameter.Append("HRB_Key=@HRB_Key, "); } if (hR_Benefit.HRB_Name_IsChanged) { sbParameter.Append("HRB_Name=@HRB_Name, "); } if (hR_Benefit.HRB_Sum_IsChanged) { sbParameter.Append("HRB_Sum=@HRB_Sum, "); } if (hR_Benefit.HRB_IsDone_IsChanged) { sbParameter.Append("HRB_IsDone=@HRB_IsDone, "); } if (hR_Benefit.HRB_Date_IsChanged) { sbParameter.Append("HRB_Date=@HRB_Date, "); } if (hR_Benefit.HRB_NextDate_IsChanged) { sbParameter.Append("HRB_NextDate=@HRB_NextDate, "); } if (hR_Benefit.HRB_Bak1_IsChanged) { sbParameter.Append("HRB_Bak1=@HRB_Bak1, "); } if (hR_Benefit.HRB_Bak2_IsChanged) { sbParameter.Append("HRB_Bak2=@HRB_Bak2, "); } if (hR_Benefit.Stat_IsChanged) { sbParameter.Append("Stat=@Stat, "); } if (hR_Benefit.CreateDate_IsChanged) { sbParameter.Append("CreateDate=@CreateDate, "); } if (hR_Benefit.UpdateDate_IsChanged) { sbParameter.Append("UpdateDate=@UpdateDate, "); } if (hR_Benefit.DeleteDate_IsChanged) { sbParameter.Append("DeleteDate=@DeleteDate "); } sb.Append(sbParameter.ToString().Trim().TrimEnd(',')); sb.Append(" WHERE 1=1 AND ((Stat is null) or (Stat=0)) and HRB_ID=@HRB_ID; "); string sql = sb.ToString(); if (hR_Benefit.HRB_Code_IsChanged) { if (string.IsNullOrEmpty(hR_Benefit.HRB_Code)) { idb.AddParameter("@HRB_Code", DBNull.Value); } else { idb.AddParameter("@HRB_Code", hR_Benefit.HRB_Code); } } if (hR_Benefit.HRB_EName_IsChanged) { if (string.IsNullOrEmpty(hR_Benefit.HRB_EName)) { idb.AddParameter("@HRB_EName", DBNull.Value); } else { idb.AddParameter("@HRB_EName", hR_Benefit.HRB_EName); } } if (hR_Benefit.HRB_ECode_IsChanged) { if (string.IsNullOrEmpty(hR_Benefit.HRB_ECode)) { idb.AddParameter("@HRB_ECode", DBNull.Value); } else { idb.AddParameter("@HRB_ECode", hR_Benefit.HRB_ECode); } } if (hR_Benefit.HRB_Key_IsChanged) { if (string.IsNullOrEmpty(hR_Benefit.HRB_Key)) { idb.AddParameter("@HRB_Key", DBNull.Value); } else { idb.AddParameter("@HRB_Key", hR_Benefit.HRB_Key); } } if (hR_Benefit.HRB_Name_IsChanged) { if (string.IsNullOrEmpty(hR_Benefit.HRB_Name)) { idb.AddParameter("@HRB_Name", DBNull.Value); } else { idb.AddParameter("@HRB_Name", hR_Benefit.HRB_Name); } } if (hR_Benefit.HRB_Sum_IsChanged) { if (hR_Benefit.HRB_Sum == 0) { idb.AddParameter("@HRB_Sum", 0); } else { idb.AddParameter("@HRB_Sum", hR_Benefit.HRB_Sum); } } if (hR_Benefit.HRB_IsDone_IsChanged) { if (string.IsNullOrEmpty(hR_Benefit.HRB_IsDone)) { idb.AddParameter("@HRB_IsDone", DBNull.Value); } else { idb.AddParameter("@HRB_IsDone", hR_Benefit.HRB_IsDone); } } if (hR_Benefit.HRB_Date_IsChanged) { if (hR_Benefit.HRB_Date == DateTime.MinValue) { idb.AddParameter("@HRB_Date", DBNull.Value); } else { idb.AddParameter("@HRB_Date", hR_Benefit.HRB_Date); } } if (hR_Benefit.HRB_NextDate_IsChanged) { if (hR_Benefit.HRB_NextDate == DateTime.MinValue) { idb.AddParameter("@HRB_NextDate", DBNull.Value); } else { idb.AddParameter("@HRB_NextDate", hR_Benefit.HRB_NextDate); } } if (hR_Benefit.HRB_Bak1_IsChanged) { if (string.IsNullOrEmpty(hR_Benefit.HRB_Bak1)) { idb.AddParameter("@HRB_Bak1", DBNull.Value); } else { idb.AddParameter("@HRB_Bak1", hR_Benefit.HRB_Bak1); } } if (hR_Benefit.HRB_Bak2_IsChanged) { if (string.IsNullOrEmpty(hR_Benefit.HRB_Bak2)) { idb.AddParameter("@HRB_Bak2", DBNull.Value); } else { idb.AddParameter("@HRB_Bak2", hR_Benefit.HRB_Bak2); } } if (hR_Benefit.Stat_IsChanged) { if (hR_Benefit.Stat == 0) { idb.AddParameter("@Stat", 0); } else { idb.AddParameter("@Stat", hR_Benefit.Stat); } } if (hR_Benefit.CreateDate_IsChanged) { if (hR_Benefit.CreateDate == DateTime.MinValue) { idb.AddParameter("@CreateDate", DBNull.Value); } else { idb.AddParameter("@CreateDate", hR_Benefit.CreateDate); } } if (hR_Benefit.UpdateDate_IsChanged) { if (hR_Benefit.UpdateDate == DateTime.MinValue) { idb.AddParameter("@UpdateDate", DBNull.Value); } else { idb.AddParameter("@UpdateDate", hR_Benefit.UpdateDate); } } if (hR_Benefit.DeleteDate_IsChanged) { if (hR_Benefit.DeleteDate == DateTime.MinValue) { idb.AddParameter("@DeleteDate", DBNull.Value); } else { idb.AddParameter("@DeleteDate", hR_Benefit.DeleteDate); } } idb.AddParameter("@HRB_ID", hR_Benefit.HRB_ID); int Re = 0; //SQL日志记录 var RunMethod = System.Reflection.MethodBase.GetCurrentMethod(); System.Collections.Hashtable param = new System.Collections.Hashtable(); string Ex = "0"; foreach (System.Collections.DictionaryEntry item in idb.GetParameters()) { param.Add(item.Key, item.Value); } try { Re = idb.ExeCmd(sql); Ex = Re.ToString(); } catch (Exception ex) { Ex = ex.Message; } SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex); return(Re); }
/// <summary> /// 执行多条增、删、改SQL语句 /// </summary> /// <param name="list">SQL语句的哈希表(key为sql语句,value是该语句的参数SqlParameter[])</param> public abstract void ExcuteTransaction(System.Collections.Hashtable list);
public DTO.SearchFormData GetDataWithFilter(int iRequesterID, System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification) { filters["UserID"] = iRequesterID; return(factory.GetDataWithFilter(filters, pageSize, pageIndex, orderBy, orderDirection, out totalRows, out notification)); }