public Boolean CheckExist(common.list.WebUser.WebUser obj) { SqlConnection conn = new SqlConnection(dataaccess.configsql.strcon); conn.Open(); try { DataTable tbl = new DataTable(); string _sqltext = " select * from " + WebUserCM.TABLE_NAME + " where " + WebUserCM.FLD_ID + "<>" + obj.Id + " and " + WebUserCM.FLD_USERNAME + "=N'" + obj.UserName + "'" + " and " + WebUserCM.FLD_PASSWORD + "=N'" + obj.Password + "'"; sqlDtApr = new SqlDataAdapter(_sqltext, conn); sqlDtApr.Fill(tbl); if (tbl.Rows.Count > 0) { return true; } } catch (System.Exception ex) { Console.Write("Error in WebUserDA:" + ex.StackTrace); } finally { conn.Close(); } return false; }
private void baseIndicator_myOnProcess(object sender, common.baseDialogEvent e) { CollectMetaData(this.FormMeta); if (e.isCloseClick) return; if (onPlotChart == null) return; onPlotChart(this, true); onPlotChart(this, false); }
public void Init(Point location, common.forms.baseSlashForm form) { mLocation = location; mSplash = (form == null ? new common.forms.baseSlashForm() : form); Thread t = new Thread(new ThreadStart(workerThread)); t.IsBackground = true; t.SetApartmentState(ApartmentState.STA); t.Start(); }
private static void OpenConnection(common.configuration.wsConnectionInfo wsInfo) { if (_myClient != null) _myClient.Abort(); _myClient = new ServiceReference1.StockServiceClient(); System.ServiceModel.WSHttpBinding binding = (_myClient.Endpoint.Binding as System.ServiceModel.WSHttpBinding); binding.OpenTimeout = TimeSpan.FromSeconds(wsInfo.timeoutInSecs); binding.CloseTimeout = TimeSpan.FromSeconds(wsInfo.timeoutInSecs); binding.SendTimeout = TimeSpan.FromSeconds(wsInfo.timeoutInSecs); binding.MaxReceivedMessageSize = constMaxReceivedMessageSize; binding.ReaderQuotas.MaxStringContentLength = constMaxStringContentLength; binding.ReaderQuotas.MaxBytesPerRead = constMaxBytesPerRead; //Proxy must befor setting Endpoint ? if (wsInfo.useProxy) { //Chua loi proxy http://chrishaas.wordpress.com/2009/11/02/fixing-the-remote-server-returned-an-error-417-expectation-failed/ ServicePointManager.Expect100Continue = false; if (wsInfo.useDefaultProxy) binding.UseDefaultWebProxy = true; else { if (wsInfo.proxyAddress.Trim() != "" && wsInfo.proxyPort.Trim() != "") { binding.ProxyAddress = new Uri(wsInfo.proxyAddress.Trim() + ":" + wsInfo.proxyPort.Trim()); binding.BypassProxyOnLocal = true; binding.UseDefaultWebProxy = false; } } } //Endpoint settings _myClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(wsInfo.URI); if (wsInfo.isWindowAuthentication) { _myClient.ClientCredentials.Windows.ClientCredential.UserName = wsInfo.account; _myClient.ClientCredentials.Windows.ClientCredential.Password = wsInfo.password; } else { _myClient.ClientCredentials.UserName.UserName = wsInfo.account; _myClient.ClientCredentials.UserName.Password = wsInfo.password; } //For testing //_myClient.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://localhost:8731/wsServices/DataLibs/?wsdl"); //_myClient.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://localhost/DataLibs.svc"); //_myClient.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://localhost:8731/wsServices/DataLibs"); //_myClient.ClientCredentials.Windows.ClientCredential.UserName = ""; //_myClient.ClientCredentials.Windows.ClientCredential.Password = ""; //ServicePointManager.UseNagleAlgorithm = true; //ServicePointManager.CheckCertificateRevocationList = true; //ServicePointManager.DefaultConnectionLimit = ServicePointManager.DefaultPersistentConnectionLimit; _myClient.Open(); }
protected void Button1_Click(object sender, EventArgs e) { if (Session["code"].ToString().Trim().Equals(yzm.Text.Trim())) { } else { Response.Write("<script>javascript:alert('验证码有误');location.href='login.aspx';</script>"); Response.End(); } if (TextBox2.Text.ToString().Trim() == "" || TextBox1.Text.ToString().Trim() == "") { Response.Write("<script>javascript:alert('请输入完整');history.back();</script>"); Response.End(); } string sql; sql = ""; if (cx.Text.ToString().Trim() == "管理员") { sql = "select * from allusers where username='******' and pwd='" + TextBox2.Text.ToString().Trim() + "'"; } if (cx.Text.ToString().Trim() == "教师") { sql = "select * from jiaoshixinxi where zhigonghao='" + TextBox1.Text.ToString().Trim() + "' and mima='" + TextBox2.Text.ToString().Trim() + "'"; } DataSet result = new DataSet(); result = new common().hsggetdata(sql); // result = new TestOnline.common().hsggetdata(sql); if (result != null) { if (result.Tables[0].Rows.Count > 0) { Session["username"] = TextBox1.Text.ToString().Trim(); Session["cx"] = cx.Text.ToString().Trim(); Response.Redirect("main.aspx"); } else { Response.Write("<script>javascript:alert('对不起,用户名或密码不正确!');history.back();</script>"); } } else { Response.Write("<script>javascript:alert('对不起,系统错误,请不要越权操作!');</script>"); } }
private void baseAdviceEstimate_myOnAccept(object sender,common.baseDialogEvent e) { try { ReLoad(); } catch (Exception er) { this.ShowError(er); } }
private void Form_myOnProcess(object sender, common.baseDialogEvent e) { this.ShowMessage(""); if (myFormStatus.isCloseClick) { myFormStatus.acceptClose = true; return; } if (!DataValid()) return; SaveData(); myFormStatus.acceptClose = true; }
private void MakeIndicatorData(common.myKeyValueItem[] indicatorCode, data.baseDS.priceDataDataTable priceDataTbl, data.baseDS.indicatorDataDataTable toTbl) { common.myKeyValueItem[] smaCodes = new common.myKeyValueItem[0]; common.myKeyValueItem[] macdCodes = new common.myKeyValueItem[0]; for (int idx = 0; idx < indicatorCode.Length; idx++) { if (indicatorCode[idx].Key.StartsWith("SMA")) { Array.Resize(ref smaCodes, smaCodes.Length + 1); smaCodes[smaCodes.Length - 1] = new common.myKeyValueItem(indicatorCode[idx].Key, indicatorCode[idx].Value); continue; } if (indicatorCode[idx].Key.StartsWith("MACD")) { Array.Resize(ref macdCodes, macdCodes.Length + 1); macdCodes[macdCodes.Length - 1] = new common.myKeyValueItem(indicatorCode[idx].Key, indicatorCode[idx].Value); continue; } } }
public void DeleteExecute(common.FileContents myDeleteTarget) { if (MovieCount <= 0) throw new Exception("削除できるファイルが存在しません"); Regex regexMov = new Regex(MovieContents.REGEX_MOVIE_EXTENTION, RegexOptions.IgnoreCase); if (!regexMov.IsMatch(myDeleteTarget.FileInfo.Name)) { if (myDeleteTarget.FileInfo.Exists) File.Delete(myDeleteTarget.FileInfo.FullName); return; } if (MovieCount == 2) { foreach(common.FileContents file in listFileContents) { if (regexMov.IsMatch(file.FileInfo.Name)) { if (myDeleteTarget.FileInfo.Name != file.FileInfo.Name) { Regex regex = new Regex(".*(_[0-9]{1,})"); if (regex.IsMatch(file.DisplayName)) { string m = regex.Match(file.DisplayName).Groups[1].Value; string dest = Path.Combine(file.FileInfo.DirectoryName, file.FileInfo.Name.Replace(m + ".", ".")); File.Move(file.FileInfo.FullName, dest); } } else File.Delete(myDeleteTarget.FileInfo.FullName); } } } else File.Delete(myDeleteTarget.FileInfo.FullName); }
void Instance_WindowsShared(object sender, common.Events.WindowsSharedEventArgs e) { Debug.WriteLine(string.Format("Windows shared: {0}", string.Join("\r\n", e.Windows.Select(x => x.Name).ToList()) )); }
void Instance_HostDisconnected(object sender, common.Events.HostDisconnectedEventArgs e) { Debug.WriteLine(string.Format("Client Disconnected: {0}", e.Ip)); }
void Instance_HostConnected(object sender, common.Events.HostConnectedEventArgs e) { Debug.WriteLine(string.Format("Client connected: {0}", e.Ip)); e.Accepted = true; }
public static bool TestConnection(common.wsConnectionInfo wsInfo, out string msg) { msg = ""; try { CloseConnection(); OpenConnection(wsInfo); return true; } catch (Exception er) { msg = er.Message; return false; } }
private void DoAlertFilter(object sender,common.baseDialogEvent e) { try { common.system.ShowCurrorWait(); LoadData(false); } catch (Exception er) { this.ShowError(er); } finally { common.system.ShowCurrorDefault(); } }
public override ITeamRepository getTeamRepository(common.UUID paramUUID) { throw new NotImplementedException(); }
private void ChartDataOptionHandler(object sender, common.baseDialogEvent e) { if (e != null && e.isCloseClick) return; if (!Validate_StockChart()) return; LoadData(); PlotChart(); }
private static void SetDataGrid(common.controls.baseDataGridView grid, DataTable tbl) { grid.DataSource = tbl; DataGridViewCellStyle amountCellStyle = new System.Windows.Forms.DataGridViewCellStyle(); amountCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; amountCellStyle.Format = "N" + common.system.GetPrecisionFromMask(Settings.sysMaskLocalAmt); amountCellStyle.NullValue = null; grid.Columns.Clear(); for (int idx = 0; idx < tbl.Columns.Count; idx++) { DataGridViewTextBoxColumn column = new System.Windows.Forms.DataGridViewTextBoxColumn(); grid.Columns.Add(column); column.DataPropertyName = tbl.Columns[idx].ColumnName; if (idx == 0) { column.HeaderText = "Strategy"; column.Width = 100; column.Frozen = true; } else { column.HeaderText = tbl.Columns[idx].Caption; column.Width = 90; column.DefaultCellStyle = amountCellStyle; } column.Name = idx.ToString(); } grid.AllowUserToAddRows = false; grid.AllowUserToDeleteRows = false; AdjustTestGridSize(grid); }
private void Percent2Amount(common.controls.baseDataGridView dataGrid) { DataTable dataTbl = (DataTable)dataGrid.DataSource; decimal val = 0; for (int rowId = 0; rowId < dataTbl.Rows.Count; rowId++) { for (int colId = 1; colId < dataTbl.Columns.Count; colId++) { if (!decimal.TryParse(dataTbl.Rows[rowId][colId].ToString(), out val)) continue; dataTbl.Rows[rowId][colId] = (val * this.Amount2PercentDenominator) / 100; } } }
public static void WriteSysLog(common.SysSeverityLevel level, string code, string text) { common.SysLog.WriteLog(DateTime.Now.ToString() + common.Consts.constTab + level.ToString() + common.Consts.constTab + code + common.Consts.constTab + text, Settings.sysFileUserLog); }
private static bool OpenConnection(common.wsConnectionInfo wsInfo) { if (_myClient != null) _myClient.Abort(); //Basic binding _myClient = new ServiceReference1.StockServiceClient("basicEndpoint"); //_myClient.Endpoint=new System.ServiceModel.Description.ServiceEndpoint( System.ServiceModel.BasicHttpBinding binding = (_myClient.Endpoint.Binding as System.ServiceModel.BasicHttpBinding); //Secure binding //_myClient = new ServiceReference1.StockServiceClient("wsEndpoint"); //System.ServiceModel.WSHttpBinding binding = (_myClient.Endpoint.Binding as System.ServiceModel.WSHttpBinding); binding.OpenTimeout = TimeSpan.FromSeconds(wsInfo.timeoutInSecs); binding.CloseTimeout = TimeSpan.FromSeconds(wsInfo.timeoutInSecs); binding.SendTimeout = TimeSpan.FromSeconds(wsInfo.timeoutInSecs); binding.MaxBufferSize = constMaxReceivedMessageSize; //Basic HTTP require MaxBufferSize=MaxReceivedMessageSize binding.MaxReceivedMessageSize = constMaxReceivedMessageSize; binding.ReaderQuotas.MaxStringContentLength = constMaxStringContentLength; binding.ReaderQuotas.MaxBytesPerRead = constMaxBytesPerRead; //Proxy must before setting Endpoint ? binding.UseDefaultWebProxy = false; if (wsInfo.useProxy) { if (wsInfo.useDefaultProxy) binding.UseDefaultWebProxy = true; else { if (wsInfo.proxyAddress.Trim() != "" && wsInfo.proxyPort.Trim() != "") { binding.ProxyAddress = new Uri(wsInfo.proxyAddress.Trim() + ":" + wsInfo.proxyPort.Trim()); binding.BypassProxyOnLocal = true; binding.UseDefaultWebProxy = false; } } } //Endpoint settings _myClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(wsInfo.URI); if (wsInfo.isWindowAuthentication) { _myClient.ClientCredentials.Windows.ClientCredential.UserName = wsInfo.account; _myClient.ClientCredentials.Windows.ClientCredential.Password = wsInfo.password; } else { _myClient.ClientCredentials.UserName.UserName = wsInfo.account; _myClient.ClientCredentials.UserName.Password = wsInfo.password; } ServicePointManager.Expect100Continue = false; //loi proxy http://chrishaas.wordpress.com/2009/11/02/fixing-the-remote-server-returned-an-error-417-expectation-failed/ ServicePointManager.UseNagleAlgorithm = true; ServicePointManager.CheckCertificateRevocationList = true; //ServicePointManager.DefaultConnectionLimit = ServicePointManager.DefaultPersistentConnectionLimit; //For testing if (Settings.sysDebugMode) { if (Settings.environmentMode == Settings.environmentDebugMode.localHP || Settings.environmentMode == Settings.environmentDebugMode.localT440) { _myClient.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://localhost:8731/wsServices/DataLibs"); _myClient.ClientCredentials.Windows.ClientCredential.UserName = ""; _myClient.ClientCredentials.Windows.ClientCredential.Password = ""; } } //End testing _myClient.Open(); myConnState = ConnState.Connected; return true; }
public static void WriteSysLog(common.SysSeverityLevel level, string code, Exception er) { WriteSysLog(level,code, er,null); }
private void chartPropertyHandler(object sender, common.baseDialogEvent e) { if (e != null && e.isCloseClick) return; RefreshAllCharts(); }
private void ProcessHandler(object sender,common.baseDialogEvent e) { try { if (e.isCloseClick) return; SaveSettings(); this.Close(); } catch (Exception er) { this.ShowError(er); } }
private void UpdateWatchList(object sender, common.forms.baseMasterEditForm.myEventArgs e) { try { Trade.Forms.marketWatch form = GetMarketWatchForm(false); if (form == null) return; form.RefreshData(baseClass.controls.stockCodeSelectByWatchList.RefreshOptions.CodeGroup); } catch (Exception er) { this.ShowError(er); } }
public void SetReplace(common.FileContents myReplaceSourceFile, string myTargetFile) { if (!File.Exists(myTargetFile)) throw new Exception("コピー対象のファイル[" + myTargetFile + "]が存在しません"); if (!File.Exists(myReplaceSourceFile.FileInfo.FullName)) throw new Exception("置換されるファイル[" + myReplaceSourceFile.FileInfo.Name + "]が存在しません"); ReplaceFile = myReplaceSourceFile; SourceFile = new FileInfo(myTargetFile); SetStatus(STATUS_REPLACE); if (myReplaceSourceFile.FileInfo.Extension == SourceFile.Extension) { IsOverride = true; NewFilename = myReplaceSourceFile.FileInfo.FullName; } else { NewFilename = myReplaceSourceFile.FileInfo.FullName.Replace(myReplaceSourceFile.FileInfo.Extension, SourceFile.Extension); } }
private void ProcessHandler(object sender,common.baseDialogEvent e) { if (e.isCloseClick) return; this.Hide(); SaveConfigure(); }
public static void WriteSysLog(common.SysSeverityLevel level, string code, Exception er, string additionalMsg) { WriteSysLog(level, code, (additionalMsg!=null? additionalMsg + common.Consts.constTab :"" )+ common.SysLog.MakeLogString(er, common.Consts.constTab)); }
private void CreateContextMenu(common.controls.baseDataGridView gridView) { ContextMenuStrip contextMenuStrip = new ContextMenuStrip(); ToolStripItem menuItem; menuItem = contextMenuStrip.Items.Add(openMenuItem.Text); menuItem.Click += new System.EventHandler(openMenuItem_Click); menuItem = contextMenuStrip.Items.Add(addToWatchListMenuItem.Text); menuItem.Click += new System.EventHandler(addToWatchListMenuItem_Click); contextMenuStrip.Items.Add(new ToolStripSeparator()); menuItem = contextMenuStrip.Items.Add(profitDetailMenu.Text); menuItem.Click += new System.EventHandler(profitDetailMenu_Click ); menuItem = contextMenuStrip.Items.Add(allProfitDetailMenu.Text); menuItem.Click += new System.EventHandler(allProfitDetailMenu_Click); gridView.ContextMenuStrip = contextMenuStrip; }
public static void DeleteKeyPending(common.myAutoKeyInfo autoKeyInfo) { //Remove the used key in pending list databases.DbAccess.DeleteAutoKeyPending(autoKeyInfo.key, autoKeyInfo.value); }
/// <summary> /// /// </summary> /// <param name="data"> /// A <see cref="System.Object"/> /// </param> public virtual void Execute(common.Tag data = null) { }
public void Delete(common.FileContents myFileContents) { listFileInfo.Remove(myFileContents); }