public List <TaskModel> GetTasks() { TasksCollection deserialized = new TasksCollection(); string baseUrl = ConfigurationManager.ConnectionStrings["ManagementServerName"].ConnectionString; string url = baseUrl + DestinationNames.GetTasks; deserialized = Communicator.GetEntitiesList <TasksCollection>(url); List <TaskModel> tasks = new List <TaskModel>(); foreach (var item in deserialized.tasksCollection) { TaskModel task = new TaskModel(); task.Id = item.Id; task.PlannedStart = item.PlannedStart; task.PlannedEnd = item.PlannedEnd; task.ActualStart = item.ActualStart; task.ActualEnd = item.ActualEnd; task.Comments = item.Comments; task.Source = item.Source; task.Revision = item.Revision; task.Description = item.Description; task.ReporterName = item.ReporterName; task.AssigneeName = item.AssigneeName; task.ProjectName = item.ProjectName; task.State = item.State; task.SeverityType = item.Severity; task.ReporterId = item.ReporterId; task.AssigneeId = item.AssigneeId; task.StateId = item.StateId; task.ProjectId = item.ProjectId; task.SeverityId = item.SeverityId; tasks.Add(task); } return(tasks); }
void DesignTimeData() { // todo TasksCollection.Add(new Model_TaskDetails() { GUID = Guid.NewGuid().ToString("X"), Title = "WINRET-28", ShortDetails = "Customer in queue - Add icons to help reading details", Details = @"As in Android and iOS version, we should add icons for each customer in queue like: * no-phone icon * booking icon * booking is arrived icon * unread messages icon * callback icon", TaskStatus = Enums.Enum_TaskStatus.TODO, Collapsed = true, Priority = 1 }); TasksCollection.Add(new Model_TaskDetails() { GUID = Guid.NewGuid().ToString("X"), Title = "WINRET-56", ShortDetails = "Flush memory cache when logout", Details = @"It's actually an Improvement and not a Bug. Some values inside the mobile app which were not saved on the server side are still set. I guess we have a memory cache in the app. We should flush it to be sure to get updated values when log in.", TaskStatus = Enums.Enum_TaskStatus.TODO, Collapsed = false, Priority = 5 }); SelectedTaskDetails = TasksCollection[0]; }
public void setup() { t1 = new Task(name, T.cmd_coll_realdata, new ImmediateTaskStrategy()); t2 = new Task( //name.ToLower(), name, T.cmd_coll_realdata, new ImmediateTaskStrategy()); ts = new TasksCollection(); }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { var button = sender as Button; activeTask = GetTaskFromButton(button); activeTaskIndex = TasksCollection.IndexOf(activeTask); Flyout.ShowAttachedFlyout(button); }
public TasksCollection GetTasks() { TasksCollection tasks = new TasksCollection(); string baseUrl = ConfigurationManager.ConnectionStrings["DALServerUrl"].ConnectionString; string url = baseUrl + DestinationNames.GetTasks; tasks = Communicator.GetEntitiesList <TasksCollection>(url); return(tasks); }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { TasksCollection.Remove(GetTaskFromButton(sender as Button)); listEdited = true; if (TasksCollection.Count == 0) { TasksHeader.Visibility = Visibility.Collapsed; } }
static private void AddTasks(TasksCollection dest, TasksCollection src) { ArgumentChecker.CheckNotNull(dest); ArgumentChecker.CheckNotNull(src); for (int i = 0; i < src.Count; i++) { Task t = src[i]; dest.Add(t); } }
public void setup() { //object obj = T.CommPort; //if (T.CommPort == null) // throw new ArgumentNullException("commprot","cp"); _taskscheduler1 = new TaskScheduler(T.CommPort); _taskscheduler2 = new TaskScheduler(T.CommPort); _tasks1 = new TasksCollection(); _tasks2 = new TasksCollection(); }
private void EditButton_Click(object sender, RoutedEventArgs e) { activeTask = GetTaskFromButton(sender as Button); activeTaskIndex = TasksCollection.IndexOf(activeTask); ConfigureFlyout(activeTask.Type); EditFlyout.ShowAt(LayoutRoot, new FlyoutShowOptions() { Placement = FlyoutPlacementMode.Auto, ShowMode = FlyoutShowMode.Standard }); }
public byte[] SerializeTasks() { TasksCollection tasks = this.GetTasks(); MemoryStream memorystream = new MemoryStream(); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(memorystream, tasks); memorystream.Flush(); memorystream.Position = 0; byte[] Bytes = memorystream.ToArray(); return(Bytes); }
private void MoveDownButton_Click(object sender, RoutedEventArgs e) { var button = sender as Button; var selectedIndex = TasksCollection.IndexOf(GetTaskFromButton(button)); if (selectedIndex + 1 < TasksCollection.Count) { var itemToMoveDown = TasksCollection[selectedIndex]; TasksCollection.RemoveAt(selectedIndex); TasksCollection.Insert(selectedIndex + 1, itemToMoveDown); TaskListView.SelectedIndex = selectedIndex + 1; } }
private bool SaveCollSettings() { int newGrCollCycle; try { newGrCollCycle = int.Parse(this.txtGRCollCycle.Text.Trim()); } catch { MsgBox.Show("采集周期必须输入数字"); return(false); } if (newGrCollCycle < MIN_COLL_CYCLE) { MsgBox.Show("采集周期不能小于" + MIN_COLL_CYCLE + "分钟"); return(false); } if (newGrCollCycle > MAX_COLL_CYCLE) { MsgBox.Show("采集周期不能大于" + MIN_COLL_CYCLE + "分钟"); return(false); } XGConfig.Default.GrRealDataCollCycle = newGrCollCycle; // refresh task coll cycle // TasksCollection tasks = Singles.S.TaskScheduler.Tasks; foreach (Task t in tasks) { TaskStrategy s = t.TaskStrategy; CommCmdBase cmd = t.CommCmd; if (s is CycleTaskStrategy && cmd is GRCtrl.GRRealDataCommand) { CycleTaskStrategy cyc = s as CycleTaskStrategy; cyc.Cycle = GetCycle(newGrCollCycle); } } // TODO: update app.config file // return(true); }
private void SetCollCycle() { TasksCollection tasks = Singles.S.TaskScheduler.Tasks; foreach (Task t in tasks) { TaskStrategy s = t.TaskStrategy; if (s is CycleTaskStrategy) { CycleTaskStrategy cyc = s as CycleTaskStrategy; cyc.Cycle = GetCycle(); } } }
public byte[] GetTasks() { TasksCollection tasks = new TasksCollection(); SQLProvider sqlp = new SQLProvider(); tasks = sqlp.GetAllTasks(); MemoryStream memorystream = new MemoryStream(); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(memorystream, tasks); memorystream.Flush(); memorystream.Position = 0; byte[] Bytes = memorystream.ToArray(); return(Bytes); }
private void TaskListView_LayoutUpdated(object sender, object e) { for (int i = 0; i < activeList.Tasks.Count; i++) { var item = TaskListView.ContainerFromIndex(i) as FrameworkElement; if (item != null) { var grid = VisualTreeHelper.GetChild(item, 0) as FrameworkElement; var buttonStack = VisualTreeHelper.GetChild(grid, 2) as FrameworkElement; var editButton = VisualTreeHelper.GetChild(buttonStack, 0) as FrameworkElement; var deleteButton = VisualTreeHelper.GetChild(buttonStack, 1) as FrameworkElement; AutomationProperties.SetName(editButton, TasksCollection.ElementAt(i).Name + " Edit Button"); AutomationProperties.SetName(deleteButton, TasksCollection.ElementAt(i).Name + " Delete Button"); } } }
public TasksCollection GetAllTasks() { TasksCollection list = new TasksCollection(); string url = "http://localhost:53654/api/Management/GetAllTasks"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "GET"; WebResponse response = request.GetResponse(); using (Stream stream = response.GetResponseStream()) { MemoryStream memStr = new MemoryStream(); stream.CopyTo(memStr); memStr.Flush(); memStr.Position = 0; BinaryFormatter bfd = new BinaryFormatter(); list = bfd.Deserialize(memStr) as TasksCollection; } return(list); }
public TasksCollection GetAllTasks() { TasksCollection tasks = new TasksCollection(); using (SqlConnection con = new SqlConnection (ConfigurationManager.ConnectionStrings["SQLProviderConnectionString"].ConnectionString)) { SqlCommand cmd = new SqlCommand("dbo.GetTasks", con); cmd.CommandType = CommandType.StoredProcedure; con.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { DataModel.Entities.Management.Task task = new DataModel.Entities.Management.Task(); DateTime dt = DateTime.MinValue; task.Id = Int32.Parse(reader[0].ToString()); task.PlannedStart = DateTime.TryParse(reader[1].ToString(), out dt) ? dt : DateTime.MinValue; task.PlannedEnd = DateTime.TryParse(reader[2].ToString(), out dt) ? dt : DateTime.MinValue; task.ActualStart = DateTime.TryParse(reader[3].ToString(), out dt) ? dt : DateTime.MinValue; task.ActualEnd = DateTime.TryParse(reader[4].ToString(), out dt) ? dt : DateTime.MinValue; task.Description = reader[5].ToString(); task.Source = reader[6].ToString(); task.Revision = Int32.Parse(reader[7].ToString()); task.Comments = reader[8].ToString(); task.ReporterName = reader[9].ToString(); task.AssigneeName = reader[10].ToString(); task.ProjectName = reader[11].ToString(); task.State = reader[12].ToString(); task.Severity = reader[13].ToString(); task.ReporterId = Int32.Parse(reader[14].ToString()); task.AssigneeId = Int32.Parse(reader[15].ToString()); task.ProjectId = Int32.Parse(reader[16].ToString()); task.StateId = Int32.Parse(reader[17].ToString()); task.SeverityId = Int32.Parse(reader[18].ToString()); tasks.tasksCollection.Add(task); } } return(tasks); }
/// <summary> /// Confirm delete flyout /// </summary> private async void ConfirmDelete_Click(object sender, RoutedEventArgs e) { try { if (activeTaskIsNowBg) { BackgroundTasksCollection.Remove(activeTask); activeTaskIsNowBg = false; } else { TasksCollection.Remove(activeTask); } listEdited = true; if (TasksCollection.Count == 0) { TasksHeader.Visibility = Visibility.Collapsed; } } catch (Exception ex) { if (ex.GetType() != typeof(FactoryOrchestratorConnectionException)) { ContentDialog failedDeleteDialog = new ContentDialog { Title = resourceLoader.GetString("FOXMLSaveFailed"), Content = $"{ex.Message}", CloseButtonText = resourceLoader.GetString("Ok") }; _ = await failedDeleteDialog.ShowAsync(); } } DeleteFlyout.Hide(); }
private void Clean() { this.Sysid = null; this.Publicid = null; this.Path = string.Empty; this.Createdate = null; this.Lastmodifieddate = null; this.Active = null; this._tasksCollection = null; }
private void ConfirmEdit_Click(object sender, RoutedEventArgs e) { activeTask = CreateTestFromFlyout(activeTaskType); if (activeTask != null) { if (activeTaskIsNowBg) { if (activeTaskWasBg && activeTaskIndex >= 0) { BackgroundTasksCollection[activeTaskIndex] = activeTask; } else if (!activeTaskWasBg && activeTaskIndex >= 0) { BackgroundTasksCollection.Add(activeTask); TasksCollection.RemoveAt(activeTaskIndex); } else { BackgroundTasksCollection.Add(activeTask); } } else { if (activeTaskWasBg && activeTaskIndex >= 0) { TasksCollection.Add(activeTask); BackgroundTasksCollection.RemoveAt(activeTaskIndex); } else if (!activeTaskWasBg && activeTaskIndex >= 0) { TasksCollection[activeTaskIndex] = activeTask; } else { TasksCollection.Add(activeTask); } } listEdited = true; } if (BackgroundTasksCollection.Count > 0) { BgTasksHeader.Visibility = Visibility.Visible; } else { BgTasksHeader.Visibility = Visibility.Collapsed; } if (TasksCollection.Count > 0) { TasksHeader.Visibility = Visibility.Visible; } else { TasksHeader.Visibility = Visibility.Collapsed; } EditFlyout.Hide(); }
/// <summary> /// 解析采集供热实时数据命令, /// parse xgdata read /// </summary> /// <returns></returns> private static TasksCollection ResolveGRRealDataTaskFromDB() { string FailMsg = "Fail list:\r\n"; //TODO: ResolveGRRealDataTaskFromDB // // 2007.03.10 Modify not use client flag, use serverIP diff local or remote gprs module, // // string sql = string.Format( // "select * from v_gprs_gr_xg where client = {0}", // XGConfig.Default.ClientAorB ); string sql = "select * from v_gprs_gr_xg"; DataSet ds = XGDB.DbClient.Execute(sql); DataTable tbl = ds.Tables[0]; TasksCollection tasks = new TasksCollection(); foreach (DataRow r in tbl.Rows) { string name = r["name"].ToString(); int grAddr = int.Parse(r["gr_address"].ToString()); int xgAddr = int.Parse(r["xg_address"].ToString()); string ip = r["ip"].ToString(); string serverIP = r["serverIP"].ToString(); string team = r["team"].ToString().Trim(); //GRStation grst = new GRStation(name, grAddr, ip); GRStation grst = CreateGrStation(name, grAddr, ip, team); grst.ServerIP = serverIP; if (grst != null) { // 2007.03.07 Added grstation to singles.grstationsCollection // Singles.S.GRStsCollection.Add(grst); // 2007.03.01 Added gtstation last grRealdata // if (Singles.S.GRStRds == null) { Singles.S.GRStRds = new GRStationLastRealDatasCollection(); } // create and add a new grstation last read data object to Singles.GRStRds // GRStationLastRealData grstLastRd = new GRStationLastRealData(grst); Singles.S.GRStRds.Add(grstLastRd); // 2007.03.10 Added check grstation(gprsstation).serverIP is the localhost ip // if (serverIP == XGConfig.Default.ServerIP) { // create a new grrealdata task for grStation // GRRealDataCommand cmd = new GRRealDataCommand(grst); TimeSpan timeSp = new TimeSpan(0, 0, XGConfig.Default.GrRealDataCollCycle, 0, 0); CycleTaskStrategy strategy = new CycleTaskStrategy(timeSp); Task t = new Task(cmd, strategy); tasks.Add(t); } } else { FailMsg += name + Environment.NewLine; } // 2007.03.12 Added xg data task // XGStation xgst = CreateXgStation(name, xgAddr, ip); //TODO: ? xgst.serverIP = serverip // xgst.ServerIP = serverIP; if (xgst != null) { Singles.S.XGStsCollection.Add(xgst); if (serverIP == XGConfig.Default.ServerIP) { ReadTotalCountCommand xgCountCmd = new ReadTotalCountCommand(xgst); TimeSpan ts = new TimeSpan(0, 0, XGConfig.Default.XgReadCountCycle, 0, 0); CycleTaskStrategy strategy = new CycleTaskStrategy(ts); Task t = new Task(xgCountCmd, strategy); tasks.Add(t); // t.AfterProcessReceived +=new EventHandler(t_AfterProcessReceived); } } else { } } if (FailMsg.Length >= 13) { MsgBox.Show(FailMsg); } return(tasks); }
/// <summary> /// 读取配置文件 /// </summary> /// <returns></returns> public static bool InitialGlobal() { ReadConfigFile(); XGDB.XGDBConnectionString = XGConfig.Default.ConnectionString; // 2007-10-12 Added process sql exception // try { XGDB.DbClient.Open(); } catch (SqlException sqlex) { //MessageBox.Show( sqlex.Message ); MsgBox.Show(sqlex.Message, GT.TEXT_TIP, MessageBoxIcon.Error); Environment.Exit(0); } // 生成并启动网络端口监听。 // if (!ListenPort()) { return(false); } // 解析gprs_station表,生成gr real data command task // // TasksCollection tasks = ResolveGRRealDataTaskFromDB(); CommPortProxysCollection cpps = new CommPortProxysCollection(); // 生成 TaskScheduler // TaskScheduler sch = new TaskScheduler(cpps, XGConfig.Default.TaskSchedulerInterval); sch.Executed += new EventHandler(CommTaskResultProcessor.Default.Process); sch.Executing += new EventHandler(TaskExecutingProcessor.Default.Process); sch.NotFindMatchCPPEvent += new EventHandler(NotFindMatchCppProcesser.Default.Process); // // AddTasks(sch.Tasks, tasks); // // sch.Enabled = true; // // Singles.S.TaskScheduler = sch; // TODO: cpps receive event process. // cpps.ReceiveARDEvent += new ReceiveARDHandler(ARDProcessor.Default.Process); //cpps.ReceiveTimeOutEvent +=new ReceiveTimeOutEventHandler(CommTaskResultProcessor.Default.Process); // TODO: 解析tbl_xgTask表,生成XGTask及XGTaskScheduler。 // // //连接请求: // 接受 // 加入TaskScheduler.CppsCollection中,(检查是否有同源的连接,如有先删除) return(true); }
public static TasksCollection GetAll() { resourceSchema.Dal.Tasks dbo = null; try { dbo = new resourceSchema.Dal.Tasks(); System.Data.DataSet ds = dbo.Tasks_Select_All(); TasksCollection collection = new TasksCollection(); if (GlobalTools.IsSafeDataSet(ds)) { for (int i = 0; (i < ds.Tables[0].Rows.Count); i = (i + 1)) { Tasks obj = new Tasks(); obj.Fill(ds.Tables[0].Rows[i]); if ((obj != null)) { collection.Add(obj); } } } return collection; } catch (System.Exception ) { throw; } finally { if ((dbo != null)) { dbo.Dispose(); } } }