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 AddListView(ICD.Work task) { string [] infos = new string[3]; infos[0] = task.recordID.ToString(); infos[1] = task.title; infos[2] = task.currentState.ToString(); ListViewItem lvItems = new ListViewItem(infos); TaskList.Items.Add(lvItems); }
private void TaskList_MouseDoubleClick(object sender, MouseEventArgs e) { if (TaskList.SelectedItems.Count == 1) { var items = TaskList.SelectedItems; ListViewItem lvItem = items[0]; string strID = lvItem.SubItems[0].Text; int taskID = int.Parse(strID); ICD.Work objTask = mTasks[taskID]; TaskWindow window = new TaskWindow(objTask); window.ShowDialog(); } }
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_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); }
public TaskWindow(ICD.Work task) { InitializeComponent(); mTask = task; }
public static void GetTaskLatest(int taskID, ref ICD.Work task) { DataRow taskRoot = GetTaskRoot(taskID); if (taskRoot == null) { return; } task.recordID = (int)taskRoot["recordID"]; task.type = taskRoot["type"].ToString(); task.time = taskRoot["time"].ToString(); task.creator = taskRoot["creator"].ToString(); task.access = taskRoot["access"].ToString(); task.mainCate = taskRoot["mainCate"].ToString(); task.subCate = taskRoot["subCate"].ToString(); task.title = taskRoot["title"].ToString(); task.comment = taskRoot["comment"].ToString(); task.director = taskRoot["director"].ToString(); task.worker = taskRoot["worker"].ToString(); task.launch = taskRoot["launch"].ToString(); task.due = taskRoot["due"].ToString(); task.term = taskRoot["term"].ToString(); task.state = taskRoot["state"].ToString(); task.priority = taskRoot["priority"].ToString(); task.progress = (int)taskRoot["progress"]; task.chatID = (int)taskRoot["chatID"]; task.timeFirst = taskRoot["timeFirst"].ToString(); task.timeDone = taskRoot["timeDone"].ToString(); DataTable taskHis = GetTaskHistory(taskID); if (taskHis == null) { return; } foreach (DataRow item in taskHis.Rows) { string name = item["columnName"].ToString(); switch (name) { case "access": task.access = item["toInfo"].ToString(); break; case "mainCate": task.mainCate = item["toInfo"].ToString(); break; case "subCate": task.subCate = item["toInfo"].ToString(); break; case "title": task.title = item["toInfo"].ToString(); break; case "comment": task.comment = item["toInfo"].ToString(); break; case "director": task.director = item["toInfo"].ToString(); break; case "worker": task.worker = item["toInfo"].ToString(); break; case "launch": task.launch = item["toInfo"].ToString(); break; case "due": task.due = item["toInfo"].ToString(); break; case "term": task.term = item["toInfo"].ToString(); break; case "state": task.state = item["toInfo"].ToString(); break; case "priority": task.priority = item["toInfo"].ToString(); break; case "progress": task.progress = (int)item["toInfo"]; break; case "chatID": task.chatID = (int)item["toInfo"]; break; case "reportMid": task.state = "진행"; break; case "reportDone": task.state = "완료대기"; break; case "confirmOK": task.state = "완료"; break; case "confirmNO": task.state = "진행"; break; default: LOG.warn(); break; } } }