Beispiel #1
0
        private static void searchAuthority(DataTable pDT, mcSocketServerClient pmSocketClient)
        {
            DataTable tDT = mscDB.Search("*", "authority", null);

            tDT = addTableHead("searchAuthority", true, string.Empty, "mscAuthority", tDT);
            pmSocketClient.Send(tDT);
        }
Beispiel #2
0
        private static void accountLogIn(DataTable pDT, mcSocketServerClient pmSocketClient, string pFm)
        {
            string tAccount  = pDT.Rows[0][0].ToString();
            string tPassword = pDT.Rows[0][1].ToString();

            string tWHERE = "Account='" + tAccount + "'";

            tWHERE += " and Password='******'";

            DataTable tDT = mscDB.Search("*", "Staffs", tWHERE);

            if (tDT != null && tDT.Rows.Count > 0)
            {
                if (socketServer.ClientsAccount.Keys.Contains(tAccount))
                {
                    tDT = addTableHead("accountLogIn", false, "账号已在别处登陆", pFm, tDT);
                }
                else
                {
                    tDT = addTableHead("accountLogIn", true, "登陆成功", pFm, tDT);
                    pmSocketClient.Account = tAccount;
                }
            }
            else
            {
                tDT = addTableHead("accountLogIn", false, "账号或密码错误", pFm, tDT);
            }
            pmSocketClient.Send(tDT);
        }
Beispiel #3
0
        private static void searchStaffsApp(DataTable pDT, mcSocketServerClient pmSocketClient, string pMessage = "")
        {
            string tAccount    = pDT.Rows[0]["Account"].ToString();
            string tDepartment = pDT.Rows[0]["Department"].ToString();
            string tAuthority  = mscAuthority.Result(pDT.Rows[0]["Authority"].ToString(), "StaffsManagement");

            string tWHERE = null;

            switch (tAuthority)
            {
            case "普通成员":
                tWHERE  = "Authority = '" + "成员" + "'";
                tWHERE += " and Department='" + "-" + tDepartment + "'";
                break;

            case "所有成员":
                tWHERE = "Department='" + tDepartment + "' OR Department='" + "-" + tDepartment + "'";
                break;

            default:
                break;
            }

            DataTable tDT = mscDB.Search("*", "Staffs", tWHERE);

            tDT.Columns.Remove("Password");
            tDT = addTableHead("searchStaffsApp", true, pMessage, "FmStaffs", tDT);
            pmSocketClient.Send(tDT);
        }
Beispiel #4
0
        private static void checkVersion(DataTable pDT, mcSocketServerClient pmSocketClient, string pMessage)
        {
            bool   tFlag          = true;
            string tMessage       = string.Empty;
            string tServerVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            if (string.Compare(pMessage, tServerVersion) < 0)
            {
                string tS1 = pMessage.Remove(pMessage.Length - 2, 2);
                string tS2 = tServerVersion.Remove(tServerVersion.Length - 2, 2);
                if (tS1 != tS2)
                {
                    tFlag = false;
                }
                tMessage = "客户端版本号过低,当前服务器端版本号: V" + tServerVersion + " 请联系管理员更新客户端版本。";
            }
            if (string.Compare(pMessage, tServerVersion) > 0)
            {
                tMessage = "客户端版本号过高,继续使用可能导致错误,当前服务器端版本号: V" + tServerVersion + " 建议选用匹配的客户端版本以获得更好的使用体验。";
            }
            DataTable tDT = new DataTable();

            tDT = addTableHead("checkVersion", tFlag, tMessage, "FmLogIn", tDT);
            pmSocketClient.Send(tDT);
        }
Beispiel #5
0
        private static void searchDepartment(DataTable pDT, mcSocketServerClient pmSocketClient, string pFm)
        {
            DataTable tDT = mscDB.Search("*", "departments", null);

            tDT = addTableHead("searchDepartment", true, string.Empty, pFm, tDT);
            pmSocketClient.Send(tDT);
        }
Beispiel #6
0
        public void ClientAccepted(IAsyncResult ar)
        {
            var socket = ar.AsyncState as Socket;

            //这就是客户端的Socket实例,我们后续可以将其保存起来
            var client = new mcSocketServerClient(socket.EndAccept(ar));

            if (!Clients.Contains(client))
            {
                Clients.Add(client);
            }

            //给客户端发送一个欢迎消息
            client.Send("Hi there, I accept you request at " + DateTime.Now.ToString());


            //实现每隔两秒钟给服务器发一个消息
            //这里我们使用了一个定时器
            var timer = new System.Timers.Timer();

            timer.Interval = 2000D;
            timer.Enabled  = true;
            timer.Elapsed += (o, a) =>
            {
                //检测客户端Socket的状态
                if (client.Connected)
                {
                    try
                    {
                        client.Send("Message from server at " + DateTime.Now.ToString());
                    }
                    catch (SocketException ex)
                    {
                        //Console.WriteLine(ex.Message);
                        //messages.Add(ex.Message);
                        Show("模块:ClientAccepted-" + ex.Message);
                    }
                }
                else
                {
                    Clients.Remove(client);
                    client.dispose();
                    timer.Stop();
                    timer.Enabled = false;
                    //messages.Add("Client is disconnected, the timer is stop.");
                    Show("Client is disconnected, the timer is stop.");
                }
            };
            timer.Start();


            //接收客户端的消息(这个和在客户端实现的方式是一样的)
            client.BeginReceive(new AsyncCallback(ReceiveMessage), client);

            //准备接受下一个客户端请求
            socket.BeginAccept(new AsyncCallback(ClientAccepted), socket);
        }
Beispiel #7
0
        private static void pushMessage(mcSocketServerClient pmSocketClient, List <string> pPushList)
        {
            DataTable tDT   = mscDB.Search("Name", "staffs", "Account = '" + pmSocketClient.Account + "'");
            var       tName = tDT.Rows[0][0].ToString();//获得操作客户端账号

            tDT = new DataTable();
            List <string> departmentList = new List <string>();

            for (int i = 0; i < pPushList.Count; i++)//获得所有更新任务的执行人所在部门列表
            {
                tDT = mscDB.Search("Department,Authority", "staffs", "Account = '" + pPushList[i] + "'");
                var tDep       = tDT.Rows[0][0].ToString();
                var tAuthority = tDT.Rows[0][1].ToString();
                if (tAuthority == "团队负责人")
                {
                    continue;
                }
                if (!departmentList.Contains(tDep))
                {
                    departmentList.Add(tDep);
                }
            }
            tDT = new DataTable();
            foreach (string feS in departmentList)//将部门列表中的部门正、副负责人加入推送列表
            {
                tDT = mscDB.Search("Account", "staffs", "Department = '" + feS + "' AND Authority Like '%%负责人'");
                foreach (DataRow feDR in tDT.Rows)
                {
                    string tAccount = feDR[0].ToString();
                    if (!pPushList.Contains(tAccount))
                    {
                        pPushList.Add(tAccount);
                    }
                }
            }

            tDT = new DataTable();
            foreach (string feAccount in pPushList)//开始推送
            {
                if (feAccount == string.Empty)
                {
                    continue;
                }
                if (feAccount == pmSocketClient.Account)
                {
                    continue;
                }
                if (socketServer.ClientsAccount.Keys.Contains(feAccount))//客户端连接状态
                {
                    string tWHERE = "Account = '" + feAccount + "'";
                    tDT = mscDB.Search("*", "staffs", tWHERE);
                    //tDT = addTableHead("searchMissions", true, "收到任务更新推送", "FmMain", tDT);
                    searchStaffs(tDT, socketServer.ClientsAccount[feAccount], "收到来自" + tName + "的任务更新推送");
                }
            }
        }
Beispiel #8
0
        private static void accountSignIn(DataTable pDT, mcSocketServerClient pmSocketClient)
        {
            string tAccount = pDT.Rows[0]["Account"].ToString();

            string    tWHERE = "Account='" + tAccount + "'";
            DataTable tDT    = mscDB.Search("Account", "Staffs", tWHERE);

            if (tDT.Rows.Count != 0)//账号已存在
            {
                tDT = addTableHead("accountSignIn", false, "账号已存在", "FmLogIn", tDT);
            }
            else//注册新账号
            {
                string tPassword   = pDT.Rows[0]["Password"].ToString();
                string tName       = pDT.Rows[0]["Name"].ToString();
                string tEmail      = pDT.Rows[0]["Email"].ToString();
                string tDepartment = pDT.Rows[0]["Department"].ToString();
                string tMajor      = pDT.Rows[0]["Major"].ToString();
                string tAuthority  = pDT.Rows[0]["Authority"].ToString();

                string tePassword = tPassword;

                string tFIELD  = "Account,Password,Name,Email,Department,Major,Authority";
                string tVALUES = "'" + tAccount + "',"
                                 + "'" + tePassword + "',"
                                 + "'" + tName + "',"
                                 + "'" + tEmail + "',"
                                 + "'" + tDepartment + "',"
                                 + "'" + tMajor + "',"
                                 + "'" + tAuthority + "'";

                if (mscDB.Insert("Staffs", tFIELD, tVALUES))
                {
                    tWHERE  = "Account='" + tAccount + "'";
                    tWHERE += " and Password='******'";

                    tDT = mscDB.Search("*", "Staffs", tWHERE);
                    tDT = addTableHead("accountSignIn", true, "", "FmLogIn", tDT);
                    pmSocketClient.Account = tAccount;
                }
                else
                {
                    tDT = addTableHead("accountSignIn", false, "账号注册失败", "FmLogIn", tDT);
                }
            }
            pmSocketClient.Send(tDT);
        }
Beispiel #9
0
        /// <summary>
        /// 委托实例
        /// </summary>
        /// <param name="obj">在多线程间传递数据</param>
        private void Show(object obj, mcSocketServerClient pmSocketClient)
        {
            if (mscCtrl.fmMain.InvokeRequired)
            {
                msDataTableWithSocket tDTWS = new msDataTableWithSocket();
                tDTWS.socket    = pmSocketClient;
                tDTWS.dataTable = (DataTable)obj;
                mscLog.Write(tDTWS.dataTable);

                                showDGV.Invoke(new EventHandler(Fm_Delegate), new object[] { tDTWS, EventArgs.Empty });
            }


            if (showDGV.InvokeRequired)
            {
                                //由于windows窗体及其他控件不具备跨线程的能力,所以这里必须调用控件的异步委托方法
                                showDGV.Invoke(new EventHandler(DGV_Delegate), new object[] { obj, EventArgs.Empty });
            }
        }
Beispiel #10
0
        private static void updateStaffInfo(DataTable pDT, mcSocketServerClient pmSocketClient, string pMessage, string pFm)
        {
            string tAccount   = pDT.Rows[0]["Account"].ToString();
            string tPW        = pDT.Rows[0]["Password"].ToString();
            string tName      = pDT.Rows[0]["Name"].ToString();
            string tEmail     = pDT.Rows[0]["Email"].ToString();
            string tMajor     = pDT.Rows[0]["Major"].ToString();
            string tRemark    = pDT.Rows[0]["Remark"].ToString();
            string tDep       = pDT.Rows[0]["Department"].ToString();
            string tAuthority = pDT.Rows[0]["Authority"].ToString();

            if (tDep.StartsWith("-"))
            {
                tAuthority = "成员";
            }

            string    tWHERE = "Account='" + tAccount + "'";
            DataTable tDT    = mscDB.Search("Account", "Staffs", tWHERE);

            if (tDT.Rows.Count != 0)//账号存在
            {
                string tFIELD = "Name = '" + tName + "' , Email = '" + tEmail + "' , Major = '" + tMajor + "' , Remark = '" + tRemark + "' , Department = '" + tDep + "' , Authority = '" + tAuthority + "'";
                if (pMessage == "PW")
                {
                    tFIELD += " , Password = '******'";
                }
                tWHERE = "Account='" + tAccount + "'";

                DataTable rtDT = new DataTable();
                if (mscDB.Update("staffs", tFIELD, tWHERE))
                {
                    rtDT = addTableHead("updateStaffInfo", true, "更新人员信息成功", pFm, new DataTable());
                }
                else
                {
                    rtDT = addTableHead("updateStaffInfo", false, "更新人员信息失败", pFm, rtDT);
                }
                pmSocketClient.Send(rtDT);
            }
        }
Beispiel #11
0
        private static void deleteMission(DataTable pDT, mcSocketServerClient pmSocketClient, string pFm)
        {
            string        tIN      = string.Empty;
            List <string> pushList = new List <string>();//推送列表

            foreach (DataRow feDR in pDT.Rows)
            {
                string tKey = feDR[0].ToString();
                tIN += tKey + ",";
                var tAccountDT = mscDB.Search("Executor", "missions", "`Key` = " + tKey);
                var tExecutor  = tAccountDT.Rows[0][0].ToString();
                if (!pushList.Contains(tExecutor))
                {
                    pushList.Add(tExecutor);
                }
            }

            if (tIN == string.Empty)
            {
                return;
            }
            tIN = tIN.Remove(tIN.Length - 1, 1);

            string    tWHERE = "`Key` IN (" + tIN + ")";
            bool      tFlag  = mscDB.Delete("missions", tWHERE);
            DataTable tDT    = new DataTable();

            tDT = addTableHead("deleteMission", tFlag, string.Empty, pFm, tDT);
            //if (tFlag)
            //{
            //    tDT = addTableHead("deleteMission", true, string.Empty, pFm, tDT);
            //}
            //else
            //{
            //    tDT = addTableHead("deleteMission", false, string.Empty, pFm, tDT);
            //}
            pmSocketClient.Send(tDT);
            pushMessage(pmSocketClient, pushList);
        }
Beispiel #12
0
 private static void closeClient(DataTable pDT, mcSocketServerClient pmSocketClient)
 {
     //socketServer.Clients.Remove(pmSocketClient);
     //意外报错,就让服务器心跳刷新用户列表吧
 }
Beispiel #13
0
        private static void searchProject(DataTable pDT, mcSocketServerClient pmSocketClient, string pMessage, string pFm)
        {
            string tWHERE = null;

            if (pMessage == "blurry")
            {
                string tSearchStr = pDT.Rows[0][0].ToString();
                tWHERE = "CONCAT(IFNULL(`Name`,''),IFNULL(`Project_Index`,''),IFNULL(`Project_Name`,''),IFNULL(`Project_Location`,''),IFNULL(`Schedule`,''),IFNULL(`MajorDepartment`,''),IFNULL(`Major`,''),IFNULL(`Version`,''),IFNULL(`Date_Handover`,''),IFNULL(`Date_Submit`,''),IFNULL(`Date_Publish`,''),IFNULL(`Status`,''),IFNULL(`Project_Manager`,''),IFNULL(`Technical_Director`,''),IFNULL(`Designer`,''),IFNULL(`Proofreader`,''),IFNULL(`Auditor`,''),IFNULL(`Remark`,''),IFNULL(`Date_Finish`,'')) LIKE '%%" + tSearchStr + "%%'";
            }
            else
            {
                #region 精确检索条件
                string tIndex    = pDT.Rows[0][0].ToString();
                string tName     = pDT.Rows[0][1].ToString();
                string tLocation = pDT.Rows[0][2].ToString();
                string tMajorDep = pDT.Rows[0][3].ToString();
                string tPM       = pDT.Rows[0][4].ToString();
                string tTD       = pDT.Rows[0][5].ToString();
                string tExe      = pDT.Rows[0][6].ToString();
                if (tIndex != string.Empty)
                {
                    tWHERE = "Project_Index LIKE '%%" + tIndex + "%%'";
                }
                if (tName != string.Empty)
                {
                    if (tWHERE != null)
                    {
                        tWHERE += " AND Project_Name LIKE '%%" + tName + "%%'";
                    }
                    else
                    {
                        tWHERE = "Project_Name LIKE '%%" + tName + "%%'";
                    }
                }
                if (tLocation != string.Empty)
                {
                    if (tWHERE != null)
                    {
                        tWHERE += " AND Project_Location LIKE '%%" + tLocation + "%%'";
                    }
                    else
                    {
                        tWHERE = "Project_Location LIKE '%%" + tLocation + "%%'";
                    }
                }
                if (tMajorDep != string.Empty)
                {
                    if (tWHERE != null)
                    {
                        tWHERE += " AND MajorDepartment LIKE '%%" + tMajorDep + "%%'";
                    }
                    else
                    {
                        tWHERE = "MajorDepartment LIKE '%%" + tMajorDep + "%%'";
                    }
                }
                if (tPM != string.Empty)
                {
                    if (tWHERE != null)
                    {
                        tWHERE += " AND Project_Manager LIKE '%%" + tPM + "%%'";
                    }
                    else
                    {
                        tWHERE = "Project_Manager LIKE '%%" + tPM + "%%'";
                    }
                }
                if (tTD != string.Empty)
                {
                    if (tWHERE != null)
                    {
                        tWHERE += " AND Technical_Director LIKE '%%" + tTD + "%%'";
                    }
                    else
                    {
                        tWHERE = "Technical_Director LIKE '%%" + tTD + "%%'";
                    }
                }
                if (tExe != string.Empty)
                {
                    if (tWHERE != null)
                    {
                        tWHERE += " AND Executor LIKE '%%" + tExe + "%%'";
                    }
                    else
                    {
                        tWHERE = "Executor LIKE '%%" + tExe + "%%'";
                    }
                }
                #endregion
            }

            string    tField = "Project_Index,Project_Name,MajorDepartment,Project_Manager,Technical_Director,Designer,Proofreader,Auditor";
            DataTable tDT    = mscDB.Search("DISTINCT " + tField, "missions", tWHERE);
            if (tDT.Rows.Count >= 35)
            {
                tDT = addTableHead("searchProject", false, "符合条件的记录过多,请深化检索条件", pFm, new DataTable());
            }
            else
            {
                tDT = addTableHead("searchProject", true, string.Empty, pFm, tDT);
            }
            pmSocketClient.Send(tDT);
        }
Beispiel #14
0
        private static void searchMissions(DataTable pDT, mcSocketServerClient pmSocketClient, string pMessage, string pFm)
        {
            DataTable tDT    = null;
            string    tWHERE = null;

            switch (pMessage)
            {
            case "staffs":
                foreach (DataRow feDR in pDT.Rows)
                {
                    string tExecutor = feDR["Account"].ToString();
                    tWHERE = "Executor = '" + tExecutor + "' AND Status <> '已完成'";
                    tDT    = searchAddDT(tDT, "*", "missions", tWHERE);
                }
                break;

            case "projects":
                foreach (DataRow feDR in pDT.Rows)
                {
                    tWHERE = string.Empty;
                    for (int i = 0; i < pDT.Columns.Count; i++)
                    {
                        tWHERE += " AND " + pDT.Columns[i].ColumnName + "='" + feDR[i].ToString() + "'";
                    }
                    if (tWHERE != string.Empty)
                    {
                        tWHERE = tWHERE.Remove(0, 5);
                    }
                    tDT = searchAddDT(tDT, "*", "missions", tWHERE);
                }
                break;

            case "plan":
                string tDate_Submit1 = "date_format(Date_Submit, '%YY/%mm/%dd')";
                string tStratDate1   = "date_format('" + pDT.Rows[0][0].ToString() + "','%YY/%mm/%dd')";
                string tEndDate1     = "date_format('" + pDT.Rows[0][1].ToString() + "','%YY/%mm/%dd')";
                tWHERE = tDate_Submit1 + " >= " + tStratDate1 + " AND " + tDate_Submit1 + "<=" + tEndDate1 + " AND Status <> '已完成'";
                //tDT = mscDB.Search("*", "missions", tWHERE);
                foreach (DataRow feDR in pDT.Rows)
                {
                    tDT = searchAddDT(tDT, "*", "missions", tWHERE + " AND Executor = '" + feDR[2] + "'");
                }
                break;

            case "achievement":
                string tDate_Finish = "date_format(Date_Finish, '%YY/%mm/%dd')";
                string tStratDate2  = "date_format('" + pDT.Rows[0][0].ToString() + "','%YY/%mm/%dd')";
                string tEndDate2    = "date_format('" + pDT.Rows[0][1].ToString() + "','%YY/%mm/%dd')";
                tWHERE = tDate_Finish + " >= " + tStratDate2 + " AND " + tDate_Finish + "<=" + tEndDate2 + " AND Status = '已完成' AND Fee <> ''";
                //tDT = mscDB.Search("*", "missions", tWHERE);
                foreach (DataRow feDR in pDT.Rows)
                {
                    tDT = searchAddDT(tDT, "*", "missions", tWHERE + " AND Executor = '" + feDR[2] + "'");
                }
                break;

            case "any":
                break;
            }
            tDT = addTableHead("searchMissions", true, string.Empty, pFm, tDT);
            pmSocketClient.Send(tDT);
        }
Beispiel #15
0
        private static DataTable uploadMission(DataRow pDR, mcSocketServerClient pmSocketClient)
        {
            DataTable rtDT = new DataTable();
            string    tKey = pDR["Key"].ToString();

            if (tKey != string.Empty)
            {
                string tWHERE = "`Key`=" + tKey + "";
                rtDT = mscDB.Search("*", "missions", tWHERE);
            }
            if (rtDT.Rows.Count != 0 && tKey != string.Empty) //任务已存在
            {
                if (rtDT.Rows[0]["Status"].ToString() != "已完成" && pDR["Status"].ToString() == "已完成")
                {
                    pDR["Date_Finish"] = DateTime.Now.ToString(mscCtrl.DateFomate);
                }

                string tFIELD = string.Empty;
                foreach (DataColumn feDC in pDR.Table.Columns)
                {
                    if (feDC.ColumnName != "Key")
                    {
                        tFIELD += feDC.ColumnName + " = " + "'" + pDR[feDC].ToString() + "'" + " , ";
                    }
                }
                tFIELD = tFIELD.Substring(0, tFIELD.Length - 2);

                string tWHERE = "`Key`=" + tKey + "";

                if (mscDB.Update("missions", tFIELD, tWHERE))
                {
                    rtDT = addTableHead("uploadMission", true, "编辑任务成功", string.Empty, new DataTable());
                }
                else
                {
                    rtDT = addTableHead("uploadMission", false, "编辑任务失败", string.Empty, rtDT);
                }
            }
            else//添加新任务
            {
                #region 任务基本信息
                string tName              = pDR["Name"].ToString();
                string tProjectIndex      = pDR["Project_Index"].ToString();
                string tProjectName       = pDR["Project_Name"].ToString();
                string tProjectLocation   = pDR["Project_Location"].ToString();
                string tProjectStage      = pDR["Project_Stage"].ToString();
                string tSchedule          = pDR["Schedule"].ToString();
                string tMajorDepartment   = pDR["MajorDepartment"].ToString();
                string tMajor             = pDR["Major"].ToString();
                string tVersion           = pDR["Version"].ToString();
                string tDateHandover      = pDR["Date_Handover"].ToString();
                string tDateSubmit        = pDR["Date_Submit"].ToString();
                string tDatePublish       = pDR["Date_Publish"].ToString();
                string tStatus            = pDR["Status"].ToString();
                string tProjectManager    = pDR["Project_Manager"].ToString();
                string tTechnicalDirector = pDR["Technical_Director"].ToString();
                string tDesigner          = pDR["Designer"].ToString();
                string tProofreader       = pDR["Proofreader"].ToString();
                string tAuditor           = pDR["Auditor"].ToString();
                string tExecutor          = pDR["Executor"].ToString();
                string tExpDays           = pDR["ExpDays"].ToString();
                string tRemark            = pDR["Remark"].ToString();
                string tDateFinish        = "";
                string tWorkCost          = "";
                string tFee        = "";
                string tDateCreate = DateTime.Now.ToString(mscCtrl.DateFomate);
                string tCreator    = pmSocketClient.Account;
                try
                {
                    tDateFinish = pDR["Date_Finish"].ToString();
                    tWorkCost   = pDR["WorkCost"].ToString();
                    tFee        = pDR["Fee"].ToString();
                    //tDateCreate = pDR["Date_Create"].ToString();
                    //tCreator = pDR["Creator"].ToString();
                }
                catch { }
                #endregion

                #region 新建任务
                string tFIELD = "Name,Project_Index,Project_Name,Project_Location,Project_Stage,Schedule,MajorDepartment,Major,Version"
                                + ",Date_Handover,Date_Submit,Date_Publish,Status"
                                + ",Project_Manager,Technical_Director,Designer,Proofreader,Auditor,Executor,ExpDays,Remark"
                                + ",Date_Finish,WorkCost,Fee,Date_Create,Creator";
                string tVALUES = "'" + tName + "'," + "'" + tProjectIndex + "'," + "'" + tProjectName + "'," + "'" + tProjectLocation + "',"
                                 + "'" + tProjectStage + "'," + "'" + tSchedule + "'," + "'" + tMajorDepartment + "'," + "'" + tMajor + "',"
                                 + "'" + tVersion + "'," + "'" + tDateHandover + "'," + "'" + tDateSubmit + "'," + "'" + tDatePublish + "',"
                                 + "'" + tStatus + "'," + "'" + tProjectManager + "'," + "'" + tTechnicalDirector + "'," + "'" + tDesigner + "',"
                                 + "'" + tProofreader + "'," + "'" + tAuditor + "'," + "'" + tExecutor + "'," + "'" + tExpDays + "'," + "'" + tRemark + "',"
                                 + "'" + tDateFinish + "'," + "'" + tWorkCost + "'," + "'" + tFee + "'," + "'" + tDateCreate + "'," + "'" + tCreator + "'";
                #endregion
                if (mscDB.Insert("missions", tFIELD, tVALUES))
                {
                    rtDT = addTableHead("uploadMission", true, "添加任务成功", string.Empty, new DataTable());
                }
                else
                {
                    rtDT = addTableHead("uploadMission", false, "添加任务失败", string.Empty, rtDT);
                }
            }
            return(rtDT);
        }
Beispiel #16
0
        public static void Sorter(DataTable pDT, mcSocketServerClient pmSocketClient)
        {
            string    tCode    = pDT.Rows[0][0].ToString();
            string    tMessage = pDT.Rows[0][2].ToString();
            string    tFm      = pDT.Rows[0][3].ToString();
            DataTable tDT      = pDT.Copy();

            tDT.Rows.RemoveAt(0);

            switch (tCode)
            {
            case "checkVersion":
                checkVersion(tDT, pmSocketClient, tMessage);
                break;

            case "accountLogIn":    //账号登陆验证
                accountLogIn(tDT, pmSocketClient, tFm);
                break;

            case "accountSignIn":    //账号注册验证
                accountSignIn(tDT, pmSocketClient);
                break;

            case "updateStaffInfo":    //账号信息更新
                updateStaffInfo(tDT, pmSocketClient, tMessage, tFm);
                break;

            case "uploadMissions":    //批量上传任务
                uploadMissions(tDT, pmSocketClient, tFm);
                break;

            case "deleteMission":    //删除任务
                deleteMission(tDT, pmSocketClient, tFm);
                break;

            case "searchAuthority":
                searchAuthority(tDT, pmSocketClient);
                break;

            case "searchStaffs":    //查询下属人员
                searchStaffs(tDT, pmSocketClient);
                break;

            case "searchStaffsApp":    //查询申请人员
                searchStaffsApp(tDT, pmSocketClient, tMessage);
                break;

            case "searchMissions":    //查询下属任务
                searchMissions(tDT, pmSocketClient, tMessage, tFm);
                break;

            case "searchProject":    //查询项目
                searchProject(tDT, pmSocketClient, tMessage, tFm);
                break;

            case "searchDepartment":    //查询部门
                searchDepartment(tDT, pmSocketClient, tFm);
                break;

            case "closeClient":
                closeClient(tDT, pmSocketClient);
                break;

            default:
                break;
            }
        }
Beispiel #17
0
        private static void uploadMissions(DataTable pDT, mcSocketServerClient pmSocketClient, string pFm)
        {
            int           UpdateSucc = 0; int UpdateCnt = 0;
            int           InsertSucc = 0; int InsertCnt = 0;
            List <string> pushList = new List <string>();//推送列表

            foreach (DataRow feDR in pDT.Rows)
            {
                DataTable feDT      = uploadMission(feDR, pmSocketClient);
                string    tExecutor = string.Empty;
                if (feDR.Table.Columns.Contains("Executor"))
                {
                    tExecutor = feDR["Executor"].ToString();
                }
                switch (feDT.Rows[0][2].ToString())
                {
                case "编辑任务失败":
                    UpdateCnt++;
                    break;

                case "添加任务失败":
                    InsertCnt++;
                    break;

                case "编辑任务成功":
                    UpdateSucc++;
                    UpdateCnt++;
                    if (!pushList.Contains(tExecutor))
                    {
                        pushList.Add(tExecutor);
                    }
                    break;

                case "添加任务成功":
                    InsertSucc++;
                    InsertCnt++;
                    if (!pushList.Contains(tExecutor))
                    {
                        pushList.Add(tExecutor);
                    }
                    break;

                default:
                    break;
                }
            }
            DataTable tDT  = new DataTable();
            string    tStr = "编辑任务" + UpdateCnt.ToString() + "个,成功" + UpdateSucc.ToString() + "个;";

            tStr += "\r\n" + "添加任务" + InsertCnt.ToString() + "个,成功" + InsertSucc.ToString() + "个;";

            if (UpdateSucc + InsertSucc == 0)
            {
                tDT = addTableHead("uploadMissions", false, tStr, pFm, tDT);
            }
            else
            {
                tDT = addTableHead("uploadMissions", true, tStr, pFm, tDT);
            }
            pmSocketClient.Send(tDT);
            pushMessage(pmSocketClient, pushList);
        }