private void OnRecvEditTask(int clientID, ICD.HEADER obj) { if (DEF.CMD_TaskLatestInfo == obj.msgID) { ICD.WorkList msg = (ICD.WorkList)obj; if (mTask.recordID != msg.works[0].recordID) { return; } mTask = msg.works[0]; updateTaskInfo(); if (mTask.state == "완료") { Close(); } else if (mTask.state == "완료대기" && mTask.director == MyInfo.mMyInfo.userID) { btnReport.Text = "확인"; btnReport.Enabled = true; } } else if (DEF.CMD_ChatRoomInfo == obj.msgID) { ProcMsgList((ChatRoomInfo)obj); } else if (DEF.CMD_DelChatUsers == obj.msgID) { Close(); } }
private void ProcTaskListTime(HEADER obj) { mCount = 0; ICD.WorkList msg = (ICD.WorkList)obj; HEADER msgHis = new HEADER(); msgHis.FillClientHeader(DEF.CMD_TaskHistory); foreach (Work item in msg.works) { if (mTracks.ContainsKey(item.recordID)) { continue; } TrackingInfo info = new TrackingInfo(); info.workBase = item; info.his = null; mTracks[item.recordID] = info; mCount++; msgHis.ext1 = item.recordID.ToString(); ICDPacketMgr.GetInst().sendMsgToServer(msgHis); } }
private void btnNewTask_Click(object sender, EventArgs e) { if (cbType.Text == "채팅") { ICD.ChatRoomInfo msgNewChat = new ICD.ChatRoomInfo(); msgNewChat.FillClientHeader(ICD.DEF.CMD_NewChat, 0); msgNewChat.body.access = cbAccess.Text; if (btnDirector.Text == btnWorker.Text) { msgNewChat.body.users = new string[1]; msgNewChat.body.users[0] = btnDirector.Text; } else { msgNewChat.body.users = new string[2]; msgNewChat.body.users[0] = btnDirector.Text; msgNewChat.body.users[1] = btnWorker.Text; } ICDPacketMgr.GetInst().sendMsgToServer(msgNewChat); } else { ICD.WorkList msg = new ICD.WorkList(); msg.FillClientHeader(ICD.DEF.CMD_TaskNew, 0); ICD.Work msgTask = msg.works[0]; //comboBox listing msgTask.type = cbType.Text; msgTask.access = cbAccess.Text; msgTask.mainCate = cbMainCate.Text; msgTask.subCate = cbSubCate.Text; //formatting date msgTask.launch = dtLaunch.Value.ToString("yyyy-MM-dd HH:mm:ss"); msgTask.due = dtDue.Value.ToString("yyyy-MM-dd HH:mm:ss"); msgTask.term = dtTerm.Value.ToString("yyyy-MM-dd HH:mm:ss"); msgTask.priority = cbPriority.Text; //user listing msgTask.creator = MyInfo.mMyInfo.userID; msgTask.director = btnDirector.Text; msgTask.worker = btnWorker.Text; msgTask.title = tbTitle.Text; msgTask.comment = tbComment.Text; msgTask.state = "예정"; msgTask.timeFirst = msg.msgTime; msgTask.timeDone = DateTime.MaxValue.ToString("yyyy-MM-dd HH:mm:ss"); ICDPacketMgr.GetInst().sendMsgToServer(msg); } Close(); }
public static DataRow NewTask(ICD.WorkList msg) { if (msg.works == null || msg.works.Length != 1) { LOG.warn(); return(null); } ICD.Work info = msg.works[0]; string sql = string.Format( "INSERT INTO task " + "(type, time, creator, access, mainCate, subCate, title, comment, director, worker, launch, due, term, state, priority, progress, chatID, timeFirst, timeDone) " + "VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}','{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}','{14}', '{15}', '{16}', '{17}', '{18}')", info.type, msg.msgTime, info.creator, info.access, info.mainCate, info.subCate, info.title, info.comment, info.director, info.worker, info.launch, info.due, info.term, info.state, info.priority, info.progress, info.chatID, info.timeFirst, info.timeDone); MySqlCommand cmd = new MySqlCommand(sql, mConn); cmd.ExecuteNonQuery(); sql = string.Format("SELECT * FROM task WHERE time='{0}' AND creator='{1}'", msg.msgTime, info.creator); MySqlDataAdapter adapter = new MySqlDataAdapter(sql, mConn); DataSet ds = new DataSet(); adapter.Fill(ds, "TASK"); return(ds.Tables["TASK"].Rows[0]); }
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_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 OnRecv_TaskInfo(ICD.HEADER obj) { if (ICD.DEF.ERR_NoError != obj.msgErr) { LOG.warn(); return; } ICD.WorkList task = (ICD.WorkList)obj; foreach (var item in task.works) { if (item.state == "완료") { mTasks.Remove(item.recordID); } else { mTasks[item.recordID] = item; } } UpdateTaskList(); }
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); }