public AnswerCompletedHandler(SqlController sqlController, Log log, Core core) { this.sqlController = sqlController; //this.communicator = communicator; this.log = log; this.core = core; }
public void CreateProcedureList(string path) { SqlController sqlController = new SqlController(this.Server, this.Database, this.User, this.Password); string[] filePaths = Directory.GetFiles(path); StreamReader reader; Regex r = new Regex(@"^(\s|\t)*go(\s\t)?.*", RegexOptions.Multiline | RegexOptions.IgnoreCase); foreach (string file in filePaths) { try { reader = new StreamReader(file); string sproc = reader.ReadToEnd(); foreach (string s in r.Split(sproc)) { //Skip empty statements, in case of a GO and trailing blanks or something string thisStatement = s.Trim(); if (String.IsNullOrEmpty(thisStatement)) { continue; } sqlController.ExecuteNonQuery(s); reader.Close(); } } catch (Exception ex) { throw ex; } } }
public override void DoSetup() { #region Setup SettingsTableContent SqlController sql = new SqlController(ConnectionString); sql.SettingUpdate(Settings.token, "abc1234567890abc1234567890abcdef"); sql.SettingUpdate(Settings.firstRunDone, "true"); sql.SettingUpdate(Settings.knownSitesDone, "true"); #endregion sut = new Core(); sut.HandleCaseCreated += EventCaseCreated; sut.HandleCaseRetrived += EventCaseRetrived; sut.HandleCaseCompleted += EventCaseCompleted; sut.HandleCaseDeleted += EventCaseDeleted; sut.HandleFileDownloaded += EventFileDownloaded; sut.HandleSiteActivated += EventSiteActivated; sut.StartSqlOnly(ConnectionString); path = System.Reflection.Assembly.GetExecutingAssembly().CodeBase; path = System.IO.Path.GetDirectoryName(path).Replace(@"file:\", ""); sut.SetPicturePath(path + @"\output\dataFolder\picture\"); sut.SetPdfPath(path + @"\output\dataFolder\pdf\"); sut.SetJasperPath(path + @"\output\dataFolder\reports\"); testHelpers = new TestHelpers(); //sut.StartLog(new CoreBase()); }
public void CreateProcedure(string file) { SqlController sqlController = new SqlController(this.Server, this.Database, this.User, this.Password); StreamReader reader; Regex r = new Regex(@"^(\s|\t)*go(\s\t)?.*", RegexOptions.Multiline | RegexOptions.IgnoreCase); try { reader = new StreamReader(file); string sproc = reader.ReadToEnd(); foreach (string s in r.Split(sproc)) { //Skip empty statements, in case of a GO and trailing blanks or something string thisStatement = s.Trim(); if (String.IsNullOrEmpty(thisStatement)) { continue; } sqlController.ExecuteNonQuery(s); reader.Close(); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 处理sql请求 /// </summary> /// <param name="value"></param> /// <param name="ic"></param> /// <returns></returns> public static bool dealWithSqlRequest(DecoderOfControl value, IControl ic) { string sqlStr = @FormatSql(value.RightDirectValue.ToString(), ic); SqlController cnTemp = new SqlController(); sqlStr = FormatSql(sqlStr, ic); var result = cnTemp.ExcuteSqlWithReturn(sqlStr); if (result.error_code.Equals("1")) { return(false); } string resultControlId = string.Empty; string resultControlProperty = string.Empty; if (Regex.IsMatch(result.to, @"\d+.d\d+")) { resultControlId = GetStringExceptChar(result.to).Split('.')[0]; resultControlProperty = GetStringExceptChar(result.to).Split('.')[1]; } else { resultControlId = result.to; } if (!string.IsNullOrEmpty(resultControlId)) { int ctrlIndex = CurrentControlList.FindIndex(p => (p as FrameworkElement).Name.Equals(ConfigManagerSection.ControlNamePrefix + resultControlId)); SetValue(CurrentControlList[ctrlIndex], result.data, resultControlProperty); } return(true); }
private void materialRaisedButton4_Click(object sender, EventArgs e) { SqlController sqlController = new SqlController(); dataGridView1.DataSource = sqlController.FindThis(IDTextBox.Text); string strconn = "Data Source=.;Initial Catalog=GymDataBase;Integrated Security=True"; SqlConnection conn = new SqlConnection(strconn); conn.Open(); SqlCommand command = new SqlCommand ("select Image from Clients where ID=" + IDTextBox.Text, conn); SqlDataAdapter dp = new SqlDataAdapter(command); DataSet ds = new DataSet("Image"); byte[] MyData = new byte[0]; dp.Fill(ds, "Image"); DataRow myRow; myRow = ds.Tables["Image"].Rows[0]; MyData = (byte[])myRow["Image"]; MemoryStream stream = new MemoryStream(MyData); pictureBox1.Image = Image.FromStream(stream); IDTextBox.Text = string.Empty; }
public AppointmentCreatedInOutlookHandler(SqlController sqlController, Log log, eFormCore.Core sdkCore, IOutlookOnlineController outlookOnlineController) { this.sqlController = sqlController; this.log = log; this.sdkCore = sdkCore; this.outlookOnlineController = outlookOnlineController; }
public OutlookOnlineController(SqlController sqlController, Log log, OutlookExchangeOnlineAPIClient outlookExchangeOnlineAPIClient, IBus bus) { this.sqlController = sqlController; this.log = log; this.outlookExchangeOnlineAPIClient = outlookExchangeOnlineAPIClient; this.bus = bus; }
/// <summary> /// 设置表格的数据 /// </summary> /// <param name="value"></param> public void SetD6(string value) { //1、sql 2、字典实体 if ("1".Equals(_sourceType)) { string sql = value.ToString(); SqlController cn = new SqlController(); var dicReturn = cn.ExcuteSqlWithReturn(sql); Dictionary <string, string>[] result = dicReturn.data; List <KeyValuePair <string, int> > source = this.DictionaryToListKeyValuePair(result); this.MyChart.DataContext = source; } else if ("2".Equals(_sourceType)) { string valueStr = value.Trim(); string[] valueArray = valueStr.Split('&'); List <KeyValuePair <string, int> > dicTemp = new List <KeyValuePair <string, int> >(); foreach (string str in valueArray) { dicTemp.Add(new KeyValuePair <string, int>(str.Split('=')[0], CommonConverter.StringToInt(str.Split('=')[1]))); } //foreach (string key in dicTemp.Keys) //{ // //暂时注释,后面h实现事件的时候顺便实现这个 // //LocalCacher.AddCache(key, DecoderAssistant.FormatSql(dicTemp[key], this)); //} } }
public string DbSettingsReloadRemote() { try { sqlController = new SqlController(connectionString); Communicator communicator = new Communicator(sqlController, log); string token = sqlController.SettingRead(Settings.token); Organization_Dto organizationDto = communicator.OrganizationLoadAllFromRemote(token); sqlController.SettingUpdate(Settings.token, token); sqlController.SettingUpdate(Settings.comAddressBasic, organizationDto.ComAddressBasic); sqlController.SettingUpdate(Settings.comAddressPdfUpload, organizationDto.ComAddressPdfUpload); sqlController.SettingUpdate(Settings.comAddressApi, organizationDto.ComAddressApi); sqlController.SettingUpdate(Settings.comOrganizationId, organizationDto.Id.ToString()); sqlController.SettingUpdate(Settings.awsAccessKeyId, organizationDto.AwsAccessKeyId); sqlController.SettingUpdate(Settings.awsSecretAccessKey, organizationDto.AwsSecretAccessKey); sqlController.SettingUpdate(Settings.awsEndPoint, organizationDto.AwsEndPoint); sqlController.SettingUpdate(Settings.unitLicenseNumber, organizationDto.UnitLicenseNumber.ToString()); if (sqlController.SettingRead(Settings.logLevel) == "true") { sqlController.SettingUpdate(Settings.logLevel, "2"); } return(""); } catch (Exception ex) { return(t.PrintException(t.GetMethodName() + " failed", ex)); } }
public override async Task DoSetup() { #region Setup SettingsTableContent DbContextHelper dbContextHelper = new DbContextHelper(ConnectionString); SqlController sql = new SqlController(dbContextHelper); await sql.SettingUpdate(Settings.token, "abc1234567890abc1234567890abcdef"); await sql.SettingUpdate(Settings.firstRunDone, "true"); await sql.SettingUpdate(Settings.knownSitesDone, "true"); #endregion sut = new Core(); sut.HandleCaseCreated += EventCaseCreated; sut.HandleCaseRetrived += EventCaseRetrived; sut.HandleCaseCompleted += EventCaseCompleted; sut.HandleCaseDeleted += EventCaseDeleted; sut.HandleFileDownloaded += EventFileDownloaded; sut.HandleSiteActivated += EventSiteActivated; await sut.StartSqlOnly(ConnectionString); path = System.Reflection.Assembly.GetExecutingAssembly().CodeBase; path = System.IO.Path.GetDirectoryName(path).Replace(@"file:", ""); await sut.SetSdkSetting(Settings.fileLocationPicture, Path.Combine(path, "output", "dataFolder", "picture")); await sut.SetSdkSetting(Settings.fileLocationPdf, Path.Combine(path, "output", "dataFolder", "pdf")); await sut.SetSdkSetting(Settings.fileLocationJasper, Path.Combine(path, "output", "dataFolder", "reports")); testHelpers = new TestHelpers(); //sut.StartLog(new CoreBase()); }
public EformParsingErrorHandler(SqlController sqlController, Communicator communicator, Log log, Core core) { this.sqlController = sqlController; this.communicator = communicator; this.log = log; this.core = core; }
public UnitActivatedHandler(SqlController sqlController, Communicator communicator, Log log, Core core) { this.sqlController = sqlController; this.communicator = communicator; this.log = log; this.core = core; }
public EformDeleteFromServerHandler(SqlController sqlController, Communicator communicator, Log log, Core core) { this.sqlController = sqlController; this.communicator = communicator; this.log = log; this.core = core; }
public TranscriptionCompletedHandler(SqlController sqlController, Communicator communicator, Log log, Core core) { this.sqlController = sqlController; this.communicator = communicator; this.log = log; this.core = core; }
public EformRetrievedHandler(SqlController sqlController, Communicator communicator, Log log, Core core) { this.sqlController = sqlController; this.communicator = communicator; this.log = log; this.core = core; }
public TranscribeAudioFileHandler(SqlController sqlController, Communicator communicator, Log log, Core core) { this.sqlController = sqlController; this.communicator = communicator; this.log = log; this.core = core; }
//------------------------------------------------------------------------- public DbContent() { Provider = ProviderType.OleDB; CommandTimeout = 15; Fields = new List <string>(); ed = new EncrDecr(string.Empty, string.Empty); dbController = SqlController.CreateSqlController(this); }
public AdminTools(string serverConnectionString) { connectionString = serverConnectionString; DbContextHelper dbContextHelper = new DbContextHelper(serverConnectionString); sqlController = new SqlController(dbContextHelper); log = new Log(sqlController); }
private void button1_Click(object sender, EventArgs e) { SqlController sqlController = new SqlController(); sqlController.SignInCheck(IDTextBox.Text); IDTextBox.Text = string.Empty; }
//path = System.IO.Path.GetDirectoryName(path).Replace(@"file:\", ""); public override void DoSetup() { sut = new SqlController(ConnectionString); sut.StartLog(new CoreBase()); testHelpers = new TestHelpers(); sut.SettingUpdate(Settings.fileLocationPicture, path + @"\output\dataFolder\picture\"); sut.SettingUpdate(Settings.fileLocationPdf, path + @"\output\dataFolder\pdf\"); sut.SettingUpdate(Settings.fileLocationJasper, path + @"\output\dataFolder\reports\"); }
/// <summary> /// Microting XML eForm API C# DLL. /// </summary> /// <param name="token">Your company's XML eForm API access token.</param> /// <param name="comAddressApi">Microting's eForm API server address.</param> /// <param name="comOrganizationId">Your company's organization id.</param> public Communicator(SqlController sqlController, Log log) { this.sqlController = sqlController; this.log = log; string token = sqlController.SettingRead(Settings.token); string comAddressApi = sqlController.SettingRead(Settings.comAddressApi); string comAddressBasic = sqlController.SettingRead(Settings.comAddressBasic); string comOrganizationId = sqlController.SettingRead(Settings.comOrganizationId); string ComAddressPdfUpload = sqlController.SettingRead(Settings.comAddressPdfUpload); #region is unit test if (token == "UNIT_TEST___________________L:32") { http = new HttpFake(); return; } #endregion #region CheckInput token & serverAddress string errorsFound = ""; if (token.Length != 32) { errorsFound += "Tokens are always 32 charactors long" + Environment.NewLine; } if (!comAddressApi.Contains("http://") && !comAddressApi.Contains("https://")) { errorsFound += "comAddressApi is missing 'http://' or 'https://'" + Environment.NewLine; } if (!comAddressBasic.Contains("http://") && !comAddressBasic.Contains("https://")) { errorsFound += "comAddressBasic is missing 'http://' or 'https://'" + Environment.NewLine; } if (comOrganizationId == null) { comOrganizationId = ""; } if (comOrganizationId == "") { errorsFound += "comOrganizationId is missing" + Environment.NewLine; } if (errorsFound != "") { throw new InvalidOperationException(errorsFound.TrimEnd()); } #endregion http = new Http(token, comAddressBasic, comAddressApi, comOrganizationId, ComAddressPdfUpload); }
public MyDataGridControl() { InitializeComponent(); //添加提示文字 txtBoxOfFilterStr.TipText = "请输入过滤的关键字"; txtJumpPage.TipText = "页面序号"; // _propertyNameToColumnName = new Dictionary <string, string>(); _currentFilterState = new List <BoolStringClass>(); _sqlController = new SqlController(); }
//path = System.IO.Path.GetDirectoryName(path).Replace(@"file:", ""); public override async Task DoSetup() { DbContextHelper dbContextHelper = new DbContextHelper(ConnectionString); SqlController sut = new SqlController(dbContextHelper); sut.StartLog(new CoreBase()); testHelpers = new TestHelpers(); await sut.SettingUpdate(Settings.fileLocationPicture, Path.Combine(path, "output", "dataFolder", "picture")); await sut.SettingUpdate(Settings.fileLocationPdf, Path.Combine(path, "output", "dataFolder", "pdf")); await sut.SettingUpdate(Settings.fileLocationJasper, Path.Combine(path, "output", "dataFolder", "reports")); }
private void materialRaisedButton5_Click(object sender, EventArgs e) { SqlController sqlController = new SqlController(); int clientid = Convert.ToInt32(IDTextBox.Text); sqlController.UpdateStatusFromClientsTo(clientid); EmailController emailController = new EmailController(); emailController.SendEmailTo(sqlController.GetInformationOfThis(IDTextBox.Text)); sqlController.UpdatesStatusFromFirmsTo(clientid); }
public override void DoSetup() { #region Setup SettingsTableContent SqlController sql = new SqlController(ConnectionString); sql.SettingUpdate(Settings.token, "abc1234567890abc1234567890abcdef"); sql.SettingUpdate(Settings.firstRunDone, "true"); sql.SettingUpdate(Settings.knownSitesDone, "true"); #endregion sut = new Core(); sut.StartSqlOnly(ConnectionString); //sut.StartLog(new CoreBase()); }
public void Test_Reset(string connectionString) { sqlController = new SqlController(connectionString); Log log = sqlController.StartLog(this); outlookController = new OutlookController(sqlController, log); AdminTools at = new AdminTools(sqlController.SettingRead(Settings.microtingDb)); try { if (!coreRunning && !coreStatChanging) { coreStatChanging = true; log.LogStandard("Not Specified", "Reset!"); List <Appointment> lstAppointments; DateTime now = DateTime.Now; DateTime rollBackTo__ = now.AddDays(+2); DateTime rollBackFrom = now.AddDays(-3); lstAppointments = outlookController.UnitTest_CalendarItemGetAllNonRecurring(rollBackFrom, rollBackTo__); foreach (var item in lstAppointments) { outlookController.CalendarItemUpdate(item, WorkflowState.Planned, true); } sqlController.SettingUpdate(Settings.checkLast_At, now.ToString()); at.RetractEforms(); sqlController.UnitTest_TruncateTable_Outlook("appointment_versions"); sqlController.UnitTest_TruncateTable_Outlook("appointments"); sqlController.UnitTest_TruncateTable_Microting("a_interaction_case_lists"); sqlController.UnitTest_TruncateTable_Microting("a_interaction_cases"); sqlController.UnitTest_TruncateTable_Microting("notifications"); sqlController.UnitTest_TruncateTable_Microting("cases"); coreStatChanging = false; } } catch (Exception ex) { FatalExpection(t.GetMethodName() + "failed. Core failed to restart", ex); } Close(); }
/// <summary> /// 启动控件 /// </summary> /// <param name="text"></param> public void SetA1(string text) { if (!object.Equals(_allFiles, null) && _allFiles.Count > 0) { try { ControlDetailForPage obj = (this.Tag as ControlDetailForPage); //上传文件 var values = new[] { new KeyValuePair <string, string>("api_type", "upload"), new KeyValuePair <string, string>("sql", string.Empty), }; SqlController slcontroller = new SqlController(); string sqlInsert = obj.d5; //sqlInsert = DecoderAssistant.FormatSql(sqlInsert, this); //bool resultbol = false; //if (CommonFunction.IsFinishLoading) //{ // resultbol = true; // CommonFunction.IsFinishLoading = false; // CommonFunction.ShowWaitingForm(); //} //改为传相对路径 foreach (string file in _allFiles) { var result = slcontroller.PostFile(file, values); BaseReturn brj = JsonController.DeSerializeToClass <BaseReturn>(result.Result); FileUploadReturn returnResult = JsonController.DeSerializeToClass <FileUploadReturn>(brj.data.ToString()); string fileUrl = returnResult.data.path; string filename = this.GetRelativePath(file, _folderPath);; string fileName = @"\" + @filename; fileName = fileName.Replace("\\", "\\\\"); slcontroller.ExcuteSqlWithReturn(string.Format(sqlInsert, fileUrl, fileName)); } //if (resultbol) //{ // CommonFunction.IsFinishLoading = true; //} this.SetP9(obj.p9); } catch { this.SetP9((this.Tag as ControlDetailForPage).p12); } } }
public bool Close() { try { if (coreRunning && !coreStatChanging) { coreStatChanging = true; coreThreadAlive = false; log.LogCritical("Not Specified", "Core.Close() at:" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString()); while (coreRunning) { Thread.Sleep(200); } while (syncOutlookAppsRunning) { Thread.Sleep(200); } while (syncInteractionCaseRunning) { Thread.Sleep(200); } log.LogStandard("Not Specified", "Core closed"); outlookController = null; sqlController = null; coreStatChanging = false; } } catch (ThreadAbortException) { //"Even if you handle it, it will be automatically re-thrown by the CLR at the end of the try/catch/finally." Thread.ResetAbort(); //This ends the re-throwning } catch (Exception ex) { FatalExpection(t.GetMethodName() + "failed. Core failed to close", ex); } return(true); }
public override void DoSetup() { #region Setup SettingsTableContent SqlController sql = new SqlController(ConnectionString); sql.SettingUpdate(Settings.token, "abc1234567890abc1234567890abcdef"); sql.SettingUpdate(Settings.firstRunDone, "true"); sql.SettingUpdate(Settings.knownSitesDone, "true"); #endregion sut = new SqlController(ConnectionString); sut.StartLog(new CoreBase()); testHelpers = new TestHelpers(); sut.SettingUpdate(Settings.fileLocationPicture, path + @"\output\dataFolder\picture\"); sut.SettingUpdate(Settings.fileLocationPdf, path + @"\output\dataFolder\pdf\"); sut.SettingUpdate(Settings.fileLocationJasper, path + @"\output\dataFolder\reports\"); }
public async Task <string> DbSettingsReloadRemote() { try { DbContextHelper dbContextHelper = new DbContextHelper(connectionString); sqlController = new SqlController(dbContextHelper); // sqlController = new SqlController(connectionString); string token = await sqlController.SettingRead(Settings.token); Communicator communicator = new Communicator(token, @"https://srv05.microting.com", @"https://basic.microting.com", "", "", log, "https://speechtotext.microting.com"); OrganizationDto organizationDto = await communicator.OrganizationLoadAllFromRemote(token); await sqlController.SettingUpdate(Settings.token, token); await sqlController.SettingUpdate(Settings.comAddressBasic, organizationDto.ComAddressBasic); await sqlController.SettingUpdate(Settings.comAddressPdfUpload, organizationDto.ComAddressPdfUpload); await sqlController.SettingUpdate(Settings.comAddressApi, organizationDto.ComAddressApi); await sqlController.SettingUpdate(Settings.comOrganizationId, organizationDto.Id.ToString()); await sqlController.SettingUpdate(Settings.awsAccessKeyId, organizationDto.AwsAccessKeyId); await sqlController.SettingUpdate(Settings.awsSecretAccessKey, organizationDto.AwsSecretAccessKey); await sqlController.SettingUpdate(Settings.awsEndPoint, organizationDto.AwsEndPoint); await sqlController.SettingUpdate(Settings.unitLicenseNumber, organizationDto.UnitLicenseNumber.ToString()); await sqlController.SettingUpdate(Settings.comSpeechToText, organizationDto.ComSpeechToText); if (await sqlController.SettingRead(Settings.logLevel) == "true") { await sqlController.SettingUpdate(Settings.logLevel, "2"); } return(""); } catch (Exception ex) { return(t.PrintException(t.GetMethodName("AdminTools") + " failed", ex)); } }