public void getFavoriteAgents() { string statement = "SELECT agents.Fname AS Name,agents.IDKey, '0' AS g FROM agents INNER JOIN chatfavorite ON agents.IDKey=chatfavorite.TargetID WHERE chatfavorite.AgentID='" + ClientData.AgentIDK + "';"; TaskCallback call = new TaskCallback(this.populatePicker); DatabaseFunctions.SendToPhp(false, statement, call); }
public void assessStage() { string sql = "SELECT Stage FROM jobindex WHERE IDKey='" + customer + "'"; TaskCallback call = populateAssessment; DatabaseFunctions.SendToPhp(false, sql, call); }
public void searchCustomerData() { string sql = "SELECT cusfields.Index,cusfields.Value,cusindex.Name,cusfields.IDKey AS FID FROM crm2.cusfields INNER JOIN crm2.cusindex ON cusfields.CusID=cusindex.IDKey WHERE cusfields.CusID='" + customer + "';"; TaskCallback call = populatePage; DatabaseFunctions.SendToPhp(false, sql, call); }
public static void LoadAgentDictionary() { string sql = "SELECT IDKey, FName FROM agents WHERE Active='1'"; TaskCallback call = populateDictionary; DatabaseFunctions.SendToPhp(false, sql, call); }
public async Task <bool> attemptNewLogin(string u, string p, bool s) { this.Responded = false; TaskCallback call = new TaskCallback(response); string statement = "SELECT IDKey,AgentNum FROM agents WHERE Username='******'AND Password='******';"; DatabaseFunctions.SendToPhp(false, statement, call); while (!Responded) { await Task.Delay(5); } bool result; if (dict.Count > 1) { if (s) { writeUserDataToFile(u, p); } result = true; } else { result = false; } return(result); }
public async Task <ResponseMessage> ExaminePass(UserInfo user, [FromRoute] string recordId, [FromBody] string desc) { Logger.Trace($"用户{user?.UserName ?? ""}({user?.Id ?? ""})发起通过审核请求(ExaminePass),请求体为:\r\n(recordId){recordId ?? ""},(desc){desc ?? ""}"); ResponseMessage response = new ResponseMessage(); if (string.IsNullOrEmpty(recordId)) { response.Code = ResponseCodeDefines.ArgumentNullError; return(response); } try { var record = await _examineFlowManager.FindExamineRecordById(recordId, HttpContext.RequestAborted); if (record?.ExamineFlow == null) { response.Code = ResponseCodeDefines.NotFound; Logger.Info($"用户{user?.UserName ?? ""}({user?.Id ?? ""})发起通过审核请求(ExaminePass)失败:未找到相应的审核记录:\r\n{response.Message},\r\n请求参数为:\r\n(recordId){recordId ?? ""},(desc){desc ?? ""}"); return(response); } NameValueCollection nameValueCollection = new NameValueCollection(); nameValueCollection.Add("appToken", "app:nwf"); var taskCallback = new TaskCallback { Message = "", TaskGuid = record.ExamineFlow.TaskGuid, StepID = record.ExamineFlow.CurrentStepId, CallbackProtocol = new FlowProtocol { ProtocolType = "", Protocol = "true" }, Status = TaskStatusEnum.Finished }; Logger.Info($"用户{user?.UserName ?? ""}({user?.Id ?? ""})向NWF发起通过审核请求协议:\r\n{0}", JsonHelper.ToJson(taskCallback)); string response2 = await _restClient.Post(ApplicationContext.Current.NWFExamineCallbackUrl, taskCallback, "POST", nameValueCollection); Logger.Info($"用户{user?.UserName ?? ""}({user?.Id ?? ""})向NWF发起通过审核请求返回:\r\n{0}", response2); var nwfresponse = JsonHelper.ToObject <ResponseMessage>(response2); if (nwfresponse.Code != "0") { Logger.Error($"用户{user?.UserName ?? ""}({user?.Id ?? ""})像NWF发起通过审核请求(ExaminePass)失败:NWF返回失败:\r\n{nwfresponse.Message},\r\n请求参数为:\r\n(recordId){recordId ?? ""},(desc){desc ?? ""}"); return(nwfresponse); } var response1 = await _examineFlowManager.ExaminePass(user.Id, recordId, desc); if (response1.Code != "0") { Logger.Error($"用户{user?.UserName ?? ""}({user?.Id ?? ""})发起通过审核请求(ExaminePass)失败:通过记录保存失败:\r\n{response1.Message},\r\n请求参数为:\r\n(recordId){recordId ?? ""},(desc){desc ?? ""}"); return(response1); } } catch (Exception e) { response.Code = ResponseCodeDefines.ServiceError; response.Message = e.ToString(); Logger.Error($"用户{user?.UserName ?? ""}({user?.Id ?? ""})发起通过审核请求(ExaminePass)报错:\r\n{e.ToString()},\r\n请求参数为:\r\n(recordId){recordId ?? ""},(desc){desc ?? ""}"); } return(response); }
public async void populateTemplateDesc(string result) { this.descAs = result; await PopupNavigation.Instance.PopAllAsync(true); TaskCallback c = new TaskCallback(this.populateLastIDK); await PopupNavigation.Instance.PushAsync(new Notification_Popup("Your template has been saved", "OK", c), true); }
public async void populateTemplateName(string result) { this.saveAs = result; TaskCallback callD = new TaskCallback(this.populateTemplateDesc); await PopupNavigation.Instance.PopAllAsync(true); await PopupNavigation.Instance.PushAsync(new GetString_Popup("Description for Template:", "Save", "Back", callD), true); }
public void onClickedSaveTemplate(object sender, RoutedEventArgs e) { DatabaseFunctions.SendToPhp("INSERT INTO tasktemplates (Name,Description,IDKey) VALUES ('" + templateName.Text + "','" + descField.Text + "','" + highestTID + 1 + "');"); string statement = "SELECT IDKey FROM tasktemplates ORDER BY IDKey DESC LIMIT 1;"; TaskCallback call = saveTemplateFields; DatabaseFunctions.SendToPhp(false, statement, call); }
public TaskEdit_Page(int i) { this.task = i; InitializeComponent(); TaskCallback call = new TaskCallback(this.populateFields); DatabaseFunctions.SendToPhp(false, "SELECT * FROM taskfields WHERE TaskID='" + i + "';", call); }
public void RunTask(TaskCallback <TResult> callback) { this._start = DateTime.Now; this._callback = callback; this.State = TaskState.Starting; this._delegate.BeginInvoke(new AsyncCallback(this.CompleteTask), null); this.State = TaskState.Running; }
private void AddTask(TaskCallback task) { if (this.m_TaskList == null) { this.m_TaskList = new Queue <TaskCallback>(); } this.m_TaskList.Enqueue(task); }
public void loadFromDatabase() { TaskCallback call = populateList; string sql = "SELECT cusindex.Name,cusindex.IDKey,cusfields.Value,cusfields.Index,jobindex.Stage FROM cusindex INNER JOIN cusfields ON cusindex.IDKey=cusfields.CusID INNER JOIN jobindex ON cusindex.IDKey=jobindex.CusID WHERE (cusfields.Index LIKE '%Phone%')"; sql += appendPickerResult(); DatabaseFunctions.SendToPhp(false, sql, call); }
public void onClickCheck(object sender, EventArgs e) { string today = "" + DateTime.Today; string sql = "SELECT * FROM coupons WHERE Code='" + CouponEntry.Text + "' AND ((StartDate<'" + today + "'AND EndDate>'" + today + "') OR EndDate IS NULL);"; TaskCallback call = populate; DatabaseFunctions.SendToPhp(false, sql, call); }
public CustomerDetail_Page(int i) { customer = i; InitializeComponent(); TaskCallback call = new TaskCallback(this.populatePage); DatabaseFunctions.SendToPhp(false, "SELECT cusindex.Name,cusfields.IDKey AS FID,cusindex.IDKey,cusfields.value,cusfields.Index FROM cusfields INNER JOIN cusindex ON cusfields.cusID=cusindex.IDKey WHERE cusfields.CusID='" + i + "';", call); }
public UserSettings_Page() { InitializeComponent(); string statement = "SELECT * FROM agents WHERE IDKey='" + ClientData.AgentIDK + "';"; TaskCallback call = new TaskCallback(this.populateEntries); DatabaseFunctions.SendToPhp(false, statement, call); }
public void onClickedLoadTemplate(object sender, RoutedEventArgs e) { int num = int.Parse(DatabaseFunctions.lookupInDictionary((string)this.templatePicker.SelectedItem, "Name", "IDKey", this.templates)); string statement = "SELECT taskfields.Value,taskfields.Index,IDKey FROM taskfields WHERE TemplateID='" + num + "';"; TaskCallback call = new TaskCallback(this.populateFields); DatabaseFunctions.SendToPhp(false, statement, call); }
public void LiveSearch() { foreach (string s in agents) { string sql3 = "SELECT agents.FName,punchclock.State,punchclock.Coordinates,punchclock.TimeStamp,punchclock.Note FROM agents INNER JOIN punchclock ON agents.IDKey = punchclock.AgentID WHERE punchclock.AgentID='" + s + "' ORDER BY punchclock.IDKey DESC"; TaskCallback call2 = populateLiveFeed; DatabaseFunctions.SendToPhp(false, sql3, call2); } }
public Price_Page() { InitializeComponent(); string sql = "SELECT DISTINCT(Brand) FROM pricesheet"; TaskCallback call = populateBrands; DatabaseFunctions.SendToPhp(false, sql, call); scroll.Height = ClientData.FrameHeight - 102; }
public FileList(int cusID) : base() { customer = cusID; string sql = "SELECT cusfields.Value,cusindex.Name FROM cusfields INNER JOIN cusindex ON cusfields.CusID=cusindex.IDKey WHERE cusindex.IDKey='" + cusID + "' AND cusfields.Index LIKE '%dress%'"; TaskCallback call = populateGrid; DatabaseFunctions.SendToPhp(false, sql, call); GridFiller.rapidFill(new string[] { "Associated Files" }, this); }
public Tombstone_Page(int cusID) { InitializeComponent(); CusID = cusID; string sql = "SELECT cusindex.Name,cusfields.IDKey AS FID,cusindex.IDKey,cusfields.Value,cusfields.Index FROM cusfields INNER JOIN cusindex ON cusfields.cusID=cusindex.IDKey WHERE cusfields.CusID='" + CusID + "';"; TaskCallback call = TombstonePrinter; DatabaseFunctions.SendToPhp(false, sql, call); }
public PunchAdmin() { InitializeComponent(); string sql = "SELECT agents.FName,agents.IDKey FROM agents WHERE Active='1'"; TaskCallback call = populateSalesCombo; DatabaseFunctions.SendToPhp(false, sql, call); Hours.BackgroundColor = Color.Red; }
public void ApproveSearch() { TaskCallback call = populatePend; DateTime d = DayPicker.Date; string sql = "SELECT * FROM punchclock WHERE AgentID='" + agents[Agent.SelectedIndex] + "' AND (" + FormatFunctions.getRelevantDates(d, "TimeStamp") + ")"; sql += " ORDER BY IDKey DESC"; DatabaseFunctions.SendToPhp(false, sql, call); }
public Job_Page(int jobID) { InitializeComponent(); JobID = jobID; string sql2 = "SELECT Stage FROM jobindex WHERE IDKey='" + JobID + "'"; TaskCallback call2 = getStage; DatabaseFunctions.SendToPhp(false, sql2, call2); }
public Notification_Popup(string labelText, string confirmText, TaskCallback c) { InitializeComponent(); this.label.Text = labelText; this.button.Text = confirmText; base.Animation = new ScaleAnimation(); this.BackgroundColor = Color.WhiteSmoke; this.call = c; }
public Job_Page(int jobID) { InitializeComponent(); JobID = jobID; string sql = "SELECT * FROM jobfields WHERE JobID='" + JobID + "'"; TaskCallback call = populateGrid; DatabaseFunctions.SendToPhp(false, sql, call); }
public void searchCustomers() { TaskCallback call2 = populatePage; DatabaseFunctions.SendToPhp(false, "SELECT cusindex.Name,cusfields.IDKey AS FID,cusindex.IDKey,cusfields.Value,cusfields.Index FROM cusfields INNER JOIN cusindex ON cusfields.cusID=cusindex.IDKey WHERE cusfields.CusID='" + customer + "' AND cusfields.Index <> 'QUOTEFIELD';", call2); TaskCallback call3 = populateQuoteList; DatabaseFunctions.SendToPhp(false, "SELECT cusfields.IDKey,cusfields.Value,cusfields.AdvValue FROM cusfields WHERE cusfields.CusID='" + customer + "' AND cusfields.Index='INVOICEFIELD';", call3); }
public static void SendToPhp(bool PBX, string statement, TaskCallback call) { try { data d = new data(); d.df_text1 = statement; string requestUriString; if (inOffice()) { if (PBX) { requestUriString = "http://192.168.0.69/accessPBX.php"; } else { requestUriString = "http://192.168.0.69/access.php"; } } else { if (PBX) { requestUriString = "http://174.114.166.80/accessPBX.php"; } else { requestUriString = "http://174.114.166.80/access.php"; } } string text = JsonClass.JSONSerialize <DatabaseFunctions.data>(d); byte[] bytes = Encoding.UTF8.GetBytes(text); HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(requestUriString); httpWebRequest.Method = "POST"; httpWebRequest.ContentType = "application/x-www-form-urlencoded"; httpWebRequest.ContentLength = (long)bytes.Length; httpWebRequest.Timeout = 50000; httpWebRequest.ReadWriteTimeout = 50000; httpWebRequest.GetRequestStream().Write(bytes, 0, bytes.Length); httpWebRequest.KeepAlive = false; using (Stream responseStream = ((HttpWebResponse)httpWebRequest.GetResponse()).GetResponseStream()) { StreamReader streamReader = new StreamReader(responseStream); String textOut = streamReader.ReadToEnd(); bool status = httpWebRequest.HaveResponse; call(textOut); httpWebRequest.Abort(); streamReader.Dispose(); responseStream.Dispose(); } } catch (WebException ex) { string str = ex.ToString(); Console.WriteLine("--->" + str); } }
//任务完成回调 private void taskFinishCallback() { this.state = TaskConst.STATE_FINISH; TaskCallback callback = TaskExecute.instance.callback; if (callback != null) { callback(this); } }
public void onClickedSearch(object sender, EventArgs e) { string text = "%" + SearchEntry.Text + "%"; string statement = "SELECT DISTINCT cusindex.IDKey FROM cusindex INNER JOIN cusfields ON cusindex.IDKey=cusfields.CusID INNER JOIN jobindex ON cusindex.IDKey=jobindex.CusID WHERE (cusfields.Value LIKE '" + text + "' OR cusindex.Name LIKE '" + text + "' OR jobindex.Name LIKE '" + text + "')"; statement += appendPickerResult(); TaskCallback call = new TaskCallback(this.PerformSearch); DatabaseFunctions.SendToPhp(false, statement, call); }
public static void Add( TaskCallback callback, object param, bool isPriority ) { if( keepGoing ) { KeyValuePair<TaskCallback, object> newTask = new KeyValuePair<TaskCallback, object>( callback, param ); if( isPriority ) { lock( priorityQueueLock ) { priorityTasks.Enqueue( newTask ); } } else { lock( queueLock ) { tasks.Enqueue( newTask ); } } } }
private Task<WebResponse> GetResponseAsync(WebRequest request, TimeSpan timeout) { var taskCompletion = new TaskCompletionSource<WebResponse>(); Task<WebResponse> asyncTask = Task.Factory.FromAsync<WebResponse>(request.BeginGetResponse, request.EndGetResponse, null); ThreadPool.RegisterWaitForSingleObject((asyncTask as IAsyncResult).AsyncWaitHandle, TimeoutCallback, request, timeout, true); var callback = new TaskCallback { taskCompletion = taskCompletion }; asyncTask.ContinueWith(callback.OnSuccess, TaskContinuationOptions.NotOnFaulted); // Handle errors asyncTask.ContinueWith(callback.OnError, TaskContinuationOptions.OnlyOnFaulted); return taskCompletion.Task; }
public static extern TaskHandle CreateTask(object self, TaskFunction fn, TaskCallback Callback, TaskPriority priority, string name);
internal static int AddTask( TaskCallback task, int interval, object param, int delay ) { ScheduledTask newTask = new ScheduledTask(); newTask.nextTime = DateTime.UtcNow.AddMilliseconds( delay ); newTask.callback = task; newTask.interval = interval; newTask.param = param; tasks.Add( ++taskIdCounter, newTask ); UpdateTaskListCache(); return taskIdCounter; }
internal static int AddTask( TaskCallback task, int interval, object param ) { return AddTask( task, interval, param, 0 ); }
internal static int AddTask( TaskCallback task, int interval ) { return AddTask( task, interval, null, 0 ); }
public static TaskHandle CreateTask(object self, TaskFunction fn, TaskCallback Callback, TaskPriority priority, string name) { Task t = new Task(self, fn, Callback, priority, name); return var.Cast<int, TaskHandle>(t.Id); }