private void ICD_EditTask(int clientID, HEADER obj) { WorkHistoryList msg = obj as WorkHistoryList; DatabaseMgr.EditTask(msg); int taskID = msg.workHistory[0].taskID; if ((msg.workHistory.Length == 1) && (msg.workHistory[0].columnName == "confirmOK")) { string[] data = new string[2]; data = msg.workHistory[0].toInfo.Split(',', (char)2); DatabaseMgr.EditTaskBase(taskID, "timeDone", data[0]); } ICD.WorkList task = new ICD.WorkList(); task.FillServerHeader(DEF.CMD_TaskLatestInfo, 0); DatabaseMgr.GetTaskLatest(taskID, ref task.works[0]); sendMsg(task.works[0].worker, task); sendMsg(task.works[0].director, task); }
private void ICD_TaskList(int clientID, HEADER obj) { DataTable table = DatabaseMgr.GetTasks(obj.msgUser); if (table == null || table.Rows.Count == 0) { return; } ICD.WorkList msg = new ICD.WorkList(table.Rows.Count); msg.FillServerHeader(DEF.CMD_TaskIDList, 0); foreach (DataRow row in table.Rows) { int index = table.Rows.IndexOf(row); DatabaseMgr.GetTaskLatest((int)row["recordID"], ref msg.works[index]); int state = mRooms[msg.works[index].chatID].GetUserState(obj.msgUser); msg.works[index].currentState = state; } sendMsg(obj.msgUser, msg); }
private void ICD_NewTask(int clientID, HEADER obj) { ICD.WorkList msg = obj as ICD.WorkList; if (msg.works == null && msg.works.Length != 1) { LOG.warn(); return; } ICD.Work work = msg.works[0]; ChatRoom room = new ChatRoom(); ChatRoomInfo roomInfo = new ChatRoomInfo(); roomInfo.FillHeader(obj); roomInfo.body.access = work.access; roomInfo.body.users = new string[2]; roomInfo.body.users[0] = work.director; roomInfo.body.users[1] = work.worker; int chatID = room.CreateNewChat(roomInfo); mRooms[chatID] = room; roomInfo.body.recordID = chatID; work.chatID = chatID; DataRow row = DatabaseMgr.NewTask(msg); int taskID = (int)row["recordID"]; roomInfo.body.taskIDs = new int[1]; roomInfo.body.taskIDs[0] = taskID; room.AddTask(roomInfo); ICD.WorkList task = new ICD.WorkList(); task.FillServerHeader(DEF.CMD_TaskLatestInfo, 0); DatabaseMgr.GetTaskLatest(taskID, ref task.works[0]); sendMsg(task.works[0].worker, task); sendMsg(task.works[0].director, task); }