예제 #1
0
    protected void Button2_Click1(object sender, EventArgs e)
    {
        String Content = Server.HtmlEncode(Request.Form["content1"].ToString());

        if (TextBox1.Text == "")
        {
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='JavaScript'>showDlg('还没有输入标题呢。。');</script>");
            return;
        }

        if (MyManager.ExecSQL("INSERT INTO TaskComments ([TargetID],[TaskID],[UserID] ,[Type] ,[Title],[Content] ,[DateTime]) Values ('"
                              + "0','"
                              + TaskID + "','"
                              + Session["UserID"].ToString() + "','1','"
                              + TextBox1.Text + "','"
                              + Content.Replace("'", "&apos;") + "','"
                              + DateTime.Now.ToString() + "')") == 1)
        {
//            Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='JavaScript'>CloseArtDialog();</script>");
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='JavaScript'>CloseMeOnshowDlg('发布成功!');</script>");
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='JavaScript'>showDlg('发布失败!');</script>");
        }
    }
예제 #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (false == VerifyTask(TaskID))
        {
            Button1.Visible = false;
            lb.Text         = "无权限转出!请关闭窗口!";
            return;
        }

        if (DropDownList1.Text == "")
        {
            return;
        }


        String RecvCorpID = DropDownList1.SelectedItem.Value;

        MyManager.ExecSQL("DELETE FROM TaskProcess WHERE TaskID=" + TaskID + " AND RecvCorpID IN (SELECT CorpID FROM Corps WHERE ParentID = " + Session["CorpParentID"].ToString() + ") ");
        FlowTask(TaskID, RecvCorpID);
        MyManager.WriteTaskFlow(TaskID, Session["UserID"].ToString(), Session["CorpID"].ToString(), RecvCorpID, TextBox1.Text, DateTime.Now.ToString());
        MyManager.ExecSQL("UPDATE Tasks Set Memo='" + TextBox1.Text + "',State = 1,SendCorpID=" + Session["CorpParentID"].ToString() + ",RecvCorpID=" + RecvCorpID + " WHERE ID = " + TaskID);
        MyManager.ExecSQL("INSERT INTO TaskLog (TaskID,CreateUserName,CreateUserID,Title,Content,DateTime) Values ('"
                          + TaskID + "','"
                          + Session["Name"].ToString() + "',"
                          + Session["UserID"].ToString() + ",'任务转发','接收部门:" + DropDownList1.SelectedItem.Text + RecvUserName + "','" + DateTime.Now.ToString() + "')");
        lb.Text               = "任务已转发至->" + DropDownList1.SelectedItem.Text + "!";
        Label1.Visible        = false;
        Label2.Visible        = false;
        TextBox1.Visible      = false;
        DropDownList1.Visible = false;
        Button1.Visible       = false;
        //Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='JavaScript'>art.dialog({ id: 'dg_test34243' }).close();</script>");

        // Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='JavaScript'>tDialog();</script>");
    }
예제 #3
0
    static public String GetNextID()/*获取下一个工具包前两位编号*/
    {
        String[] arr = { "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
        String   ID = MyManager.GetFiledByInput("Select Top 1 NextID FROM NextID", "NextID");
        int      i, j, k, t;

        if (MyManager.SELCount("SELECT  count(ID) as Count FROM CoreTool WHERE ToolID like '" + ID + "%'", "Count") > 0)
        {
            if (ID[ID.Length - 1].ToString() == arr[arr.Length - 1])//最后一位字母为字符表中最后一个字母,需要进位
            {
                //开始层层进位
                for (i = ID.Length - 1; i >= 0; i--)
                {
                    if (ID[i].ToString() == arr[arr.Length - 1])
                    {
                        ID = (i == 0 ? "" : ID.Substring(0, i)) + arr[0] + (i == ID.Length - 1 ? "" : ID.Substring(i + 1, ID.Length - 1 - i));
                        //ID = ID.Substring(0, i) + arr[0];//某位为最后一个字母则证明前位需要进位,而本位变为第一个字母
                    }
                    else //碰到不为最后一个字母的,则该位变为下一个字母,然后退出循环即可。
                    {
                        j = 0;
                        while (ID[i].ToString() != arr[j])
                        {
                            j++;
                        }

                        ID = (i == 0 ? "" : ID.Substring(0, i)) + arr[j + 1] + (i == ID.Length - 1 ? "" : ID.Substring(i + 1, ID.Length - 1 - i));

                        break;
                    }
                }
                if (i < 0)//需要加位
                {
                    ID = arr[0] + ID;
                }
            }
            else
            {
                j = 0;
                while (ID[ID.Length - 1].ToString() != arr[j])
                {
                    j++;
                }

                ID = ID.Substring(0, ID.Length - 1) + arr[j + 1];
            }
        }

        MyManager.ExecSQL("Update NextID Set NextID = '" + ID + "' WHERE ID =1");

        return(ID);
    }
예제 #4
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        WriteTaskProcess(TaskID, TaskType, RecvCorpID);
        MyManager.WriteTaskFlow(TaskID, Session["UserID"].ToString(), Session["CorpID"].ToString(), RecvCorpID, "任务创建", DateTime.Now.ToString());
        MyManager.ExecSQL("UPDATE Tasks Set State = 1 WHERE ID = " + TaskID);
        MyManager.ExecSQL("INSERT INTO TaskLog (TaskID,CreateUserName,CreateUserID,Title,Content,DateTime) Values ('"
                          + TaskID + "','"
                          + Session["Name"].ToString() + "',"
                          + Session["UserID"].ToString() + ",'任务提交','接收部门:" + RecvCorpName + RecvUserName + "','" + DateTime.Now.ToString() + "')");

        TaskState       = "1";//任务状态变成1,屏蔽提交任务按钮。
        Button1.Visible = false;
        Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='JavaScript'>$.alert.messager('提示','任务转发成功!');</script>");
    }
예제 #5
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        String TaskID = "", RecvCorpID = "";

        if (DropDownList1.Text == "")
        {
            Label2.Text = "未选择任务类型!";
            return;
        }

        if (TextBox1.Text == "" || !MyManager.FuckSQLInject(TextBox1.Text))
        {
            Label2.Text = "请输入任务名称,并不可带有非法字符。";
            return;
        }

        if (DropDownList2.Text == "")
        {
            Label2.Text = "未选择任务接受部门!";
            return;
        }

        if (Session["CorpID"] == null || Session["UserID"] == null)
        {
            Label2.Text = "会话状态读取失败,请重新登陆!";
            return;
        }

        RecvCorpID = DropDownList2.SelectedItem.Value;

        String[] Arr = DropDownList1.SelectedItem.Value.Split('|');

        TaskID = MyManager.CreateTask(Arr[0], TextBox1.Text, TaskCode, Session["UserID"].ToString(), Session["CorpID"].ToString(), DropDownList2.SelectedItem.Value, TextBox2.Text);



        MyManager.ExecSQL("INSERT INTO TaskLog (TaskID,CreateUserName,CreateUserID,Title,Content,DateTime) Values ('"
                          + TaskID + "','"
                          + Session["Name"].ToString() + "',"
                          + Session["UserID"].ToString() + ",'创建任务','创建任务','" + DateTime.Now.ToString() + "')");



        TaskCode           = "";
        Label1.Text        = "";
        TextBox1.Text      = "";
        DropDownList1.Text = DropDownList2.Text = "";

        Response.Redirect("TaskDetails.aspx?TaskID=" + TaskID);
    }
예제 #6
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        Button Btn = (Button)sender;
        String SQL, SQL1, Type = MyManager.GetFiledByInput("SELECT Type From HitTool Where TaskID='" + Btn.CommandArgument + "'", "Type");

        if (Type == "1")
        {
            SQL = "UPDATE [StoredTool] SET State = 0 WHERE [RelatedTask] = '" + Btn.CommandArgument + "';UPDATE HitTool Set State = 0 Where TaskID = '" + Btn.CommandArgument + "';";
            MyManager.ExecSQL(SQL);
        }
        else
        {
            MyManager.ExecSQL("UPDATE [CoreTool] SET State = 0 WHERE [RelatedTask] = '" + Btn.CommandArgument + "';UPDATE HitTool Set State = 0 Where TaskID = '" + Btn.CommandArgument + "';");
            MyManager.ExecSQL("UPDATE [CoreToolValue] SET State = 0 WHERE (ValueType =1 or Valuetype = 3) AND  CoreID IN(SELECT ID FROM CoreTool WHERE [RelatedTask] = '" + Btn.CommandArgument + "')");
        }

        GV1Bind();
    }
예제 #7
0
    public void WriteTaskProcess(String TaskID, String TaskType, String RecvCorpID)//转发任务函数,默认转发给科队的0和1组
    {
        String sTxt = "";

        DataTable dt = MyManager.GetDataSet("SELECT * FROM UserList WHERE CorpID IN (SELECT CorpID FROM Corps WHERE ParentID = (SELECT ParentID FROM Corps WHERE CorpID = " + RecvCorpID + "))");

        DataRow[] dr = dt.Select(" 1=1 ");

        if (TaskType != "1")                           //如果是借工具则,发给工具房所有人。
        {
            if (Session["UserType"].ToString() == "0") //科队领导创建任务,发给当前部门的0组
            {
                dr = dt.Select("  UserType <> 2 ");
            }
            else if (Session["UserType"].ToString() == "1") //小组长创建任务,只发给转发部门0组
            {
                dr = dt.Select("  UserType = 0  ");
            }
            else
            {
                dr = dt.Select(" [UserType] = 1  AND CorpID = " + Session["CorpID"].ToString());
            }
        }

        RecvUserName = "";

        for (int i = 0; i < dr.Length; i++)
        {
            RecvUserName += " " + dr[i]["Name"].ToString();

            sTxt = "INSERT INTO TaskProcess(TaskID,SendUser,SendCorpID,RecvCorpID,RecvUser,State,Content,DateTime) VALUES ("
                   + TaskID + ","
                   + Session["UserID"].ToString() + ","
                   + Session["CorpID"].ToString() + ","
                   + RecvCorpID + ","
                   + dr[i]["ID"].ToString() + ",1,'待领取','" + DateTime.Now.ToString() + "')";
            MyManager.ExecSQL(sTxt);
        }
    }
예제 #8
0
    public void FlowTask(String TaskID, String RecvCorpID)//转发任务函数,默认转发给科队的0和1组
    {
        String sTxt = "";

        DataTable dt = MyManager.GetDataSet("SELECT * FROM UserList WHERE UserType <>2 AND CorpID IN (SELECT CorpID FROM Corps WHERE ParentID = (SELECT ParentID FROM Corps WHERE CorpID = " + RecvCorpID + "))");

        DataRow[] dr = dt.Select(" 1=1 ");


        RecvUserName = "";

        for (int i = 0; i < dr.Length; i++)
        {
            RecvUserName += " " + dr[i]["Name"].ToString();

            sTxt = "INSERT INTO TaskProcess(TaskID,SendUser,SendCorpID,RecvCorpID,RecvUser,State,Content,DateTime) VALUES ("
                   + TaskID + ","
                   + Session["UserID"].ToString() + ","
                   + Session["CorpID"].ToString() + ","
                   + RecvCorpID + ","
                   + dr[i]["ID"].ToString() + ",1,'待领取','" + DateTime.Now.ToString() + "')";
            MyManager.ExecSQL(sTxt);
        }
    }
예제 #9
0
 static public int DeleteToolApp(String AppID)
 {
     return(MyManager.ExecSQL("DELETE FROM ToolApp WHERE TaskID =(SELECT TaskID FROM ToolApp WHERE ID=" + AppID + ") AND ParentID=(SELECT ParentID FROM ToolApp WHERE ID=" + AppID + ")"));
 }
예제 #10
0
    protected void RollBackBtn_Click1(object sender, EventArgs e)
    {
        int    i = 0;
        Button Btn = (Button)sender;
        String txt = Btn.Text;
        String TaskID = "";
        String RealTaskProcessState = "", RowIndex = "", GVTaskProcessState = "";

        String[]  Arr = Btn.CommandArgument.Split('|');
        DataTable dt;
        String    Msg = "", Title = "";


        TaskID               = Arr[0];
        RowIndex             = Arr[1];
        GVTaskProcessState   = Arr[2];
        RealTaskProcessState = MyManager.GetFiledByInput("SELECT  top 1 State FROM TaskProcess WHERE TaskID = " + TaskID + " AND RecvUser="******"UserID"].ToString(), "State");

        if (RealTaskProcessState != GVTaskProcessState)
        {
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='JavaScript'>showDlg('任务状态有更新,请重新查看!');</script>");
            GV1Bind();
            return;
        }

        if (Session["UserType"].ToString() == "1" && Btn.CommandName == "退回")//组长
        {
            //通知自己和组员,任务被该组长退回
            MyManager.ExecSQL("UPDATE TaskProcess Set Content='任务被" + Session["Name"].ToString() + "退回',State = 5 WHERE  TaskID = " + TaskID + " AND RecvUser IN (SELECT ID FROM UserList WHERE  CorpID = " + Session["CorpID"].ToString() + ") ");

            //通知科长,任务被该组长撤回
            MyManager.ExecSQL("UPDATE TaskProcess Set Content='任务被" + Session["Name"].ToString() + "退回',State = 5 WHERE  TaskID = " + TaskID + " AND RecvUser IN (SELECT ID FROM UserList WHERE UserType =0 AND CorpID = " + Session["CorpParentID"].ToString() + ") ");

            //写任务流转记录
            MyManager.WriteTaskFlow(TaskID, Session["UserID"].ToString(), Session["CorpID"].ToString(), Session["CorpParentID"].ToString(), "科队内流转:任务退回", DateTime.Now.ToString());

            //写任务日志
            MyManager.ExecSQL("INSERT INTO TaskLog (TaskID,CreateUserID,CreateUserName,Title,Content,DateTime) VAlues('"
                              + TaskID + "','"
                              + Session["UserID"].ToString() + "','"
                              + Session["Name"].ToString() + "','"
                              + "任务退回" + "','"
                              + "" + "','"
                              + DateTime.Now.ToString() + "')");
        }

        if (Session["UserType"].ToString() == "0" && Btn.CommandName == "撤回") //领导
        {
            String   CC, CurCorpID, CurCorpName;                              //CC部门ID和名 34|质检科
            String[] tArr;

            CC          = MyManager.GetFiledByInput("SELECT (convert(varchar(4),CorpID) + '|' + CorpName) AS CC  FROM Tasks AS A join Corps AS B on A.RecvCorpID = B.CorpID Where A.ID=" + TaskID, "CC");
            tArr        = CC.Split('|');
            CurCorpID   = tArr[0];
            CurCorpName = tArr[1];

            //通知该组组长和组员,任务被撤回
            MyManager.ExecSQL("UPDATE TaskProcess Set Content='任务被" + Session["Name"].ToString() + "撤回',State = 5 WHERE  TaskID = " + TaskID + " AND RecvUser IN (SELECT ID FROM UserList WHERE  CorpID =  (SELECT RecvCorpID FROM Tasks WHERE ID = " + TaskID + " )) ");

            //通知"科长们",任务被撤回
            MyManager.ExecSQL("UPDATE TaskProcess Set Content='任务被" + Session["Name"].ToString() + "撤回',State = 5 WHERE  TaskID = " + TaskID + " AND RecvUser IN (SELECT ID FROM UserList WHERE UserType =0 AND CorpID = " + Session["CorpParentID"].ToString() + ") ");

            //写任务流转记录
            MyManager.WriteTaskFlow(TaskID, Session["UserID"].ToString(), CurCorpID, Session["CorpParentID"].ToString(), "科队内流转:任务被撤回", DateTime.Now.ToString());

            //写任务日志
            MyManager.ExecSQL("INSERT INTO TaskLog (TaskID,CreateUserID,CreateUserName,Title,Content,DateTime) VAlues('"
                              + TaskID + "','"
                              + Session["UserID"].ToString() + "','"
                              + Session["Name"].ToString() + "','"
                              + "任务撤回" + "','"
                              + "原部门:" + CurCorpName + "','"
                              + DateTime.Now.ToString() + "')");
        }
        GV2Bind();
    }
예제 #11
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        int    i = 0;
        Button Btn = (Button)sender;
        String txt = Btn.Text;
        String TaskID = "";
        String UserType = Session["UserType"].ToString();
        String RealTaskProcessState = "", RowIndex = "", GVTaskProcessState = "";

        String[]  Arr = Btn.CommandArgument.Split('|');
        DataTable dt;
        String    Msg = "", Title = "";

        TaskID             = Arr[0];
        RowIndex           = Arr[1];
        GVTaskProcessState = Arr[2];

        RealTaskProcessState = MyManager.GetFiledByInput("SELECT State FROM TaskProcess WHERE TaskID = " + TaskID + " AND RecvUser="******"UserID"].ToString(), "State");


        if (RealTaskProcessState != GVTaskProcessState)
        {
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='JavaScript'>showDlg('任务状态有更新,请重新查看!');</script>");
            GV1Bind();
            return;
        }

        if (UserType == "0")
        {
            if (RealTaskProcessState == "1" || RealTaskProcessState == "5" || RealTaskProcessState == "6")//科长 State = 1 开始分配任务。
            {
                Title = "任务分配";

                //任务分配后,科长该任务状态变为处理中2
                MyManager.ExecSQL("UPDATE TaskProcess Set Content='任务已分配',DateTime = '" + DateTime.Now.ToString() + "',State = 2 WHERE TaskID =" + TaskID + " AND RecvUser = "******"UserID"].ToString());

                DropDownList dList = (DropDownList)GridView1.Rows[Convert.ToInt32(RowIndex)].FindControl("DropDownList1");

                if (dList.Text == "")
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='JavaScript'>showDlg('没选择分配小组!');</script>");
                    return;
                }

                //更改任务发送和接收部门 Tasks RecvCorpID 和 SendCorpID

                MyManager.ExecSQL("UPDATE Tasks Set SendCorpID = " + Session["CorpID"].ToString() + ",RecvCorpID=" + dList.SelectedItem.Value + " WHERE ID = " + TaskID);

                dt = MyManager.GetDataSet("SELECT A.*,B.CorpID,C.CorpName,B.Name,B.UserType,C.CorpType FROM TaskProcess AS A left join UserList  AS B on A.RecvUser = B.ID left join Corps AS C On B.CorpID = C.CorpID  WHERE TaskID = " + TaskID);
                DataRow[] dr;

                dr = dt.Select(" CorpID = " + dList.SelectedItem.Value); //给制定小组长分配任务

                if (dr.Length > 0)                                       //TaskProcess中存在小组长信息说明任务从部门外转来
                {
                    Msg = "分配至小组:" + dr[0]["CorpName"];
                    for (i = 0; i < dr.Length; i++)
                    {
                        MyManager.ExecSQL("UPDATE TaskProcess Set Content='任务被分配至本组',DateTime = '" + DateTime.Now.ToString() + "',State = 7 WHERE ID=" + dr[i]["ID"].ToString());
                    }

                    //告知其他小组长任务已分配。
                    dr = dt.Select(" UserType = 1 AND  CorpID <> " + dList.SelectedItem.Value);

                    Msg += " 告知:";

                    for (i = 0; i < dr.Length; i++)
                    {
                        Msg += " " + dr[i]["Name"].ToString();
                        MyManager.ExecSQL("UPDATE TaskProcess Set Content='领导分配任务至他组',DateTime = '" + DateTime.Now.ToString() + "',State = 8 WHERE ID=" + dr[i]["ID"].ToString());
                    }

                    //给小组组员分配任务
                    dt = MyManager.GetDataSet("SELECT * FROM Userlist WHERE UserType = 2 AND CorpID = " + dList.SelectedItem.Value);



                    for (i = 0; i < dt.Rows.Count; i++)
                    {
                        //每次插入TaskProcess 之前确保之前没有记录,保证TaskProces中,对于每个任务每人只有一条记录
                        MyManager.ExecSQL("DELETE FROM TaskProcess Where TaskID = " + TaskID + " AND RecvUser = "******"ID"].ToString());

                        MyManager.ExecSQL("INSERT INTO TaskProcess(TaskID,SendUser,SendCorpID,RecvCorpID,RecvUser,State,Content,DateTime) VALUES ("
                                          + TaskID + ","
                                          + Session["UserID"].ToString() + ","
                                          + Session["CorpID"].ToString() + ","
                                          + dList.SelectedItem.Value + ","
                                          + dt.Rows[i]["ID"].ToString() + ",7,'领导分配任务到本组','" + DateTime.Now.ToString() + "')");
                    }



                    MyManager.WriteTaskFlow(TaskID, Session["UserID"].ToString(), Session["CorpID"].ToString(), dList.SelectedItem.Value, "科队内流转", DateTime.Now.ToString());
                }
                else
                {
                    dt = MyManager.GetDataSet("SELECT * FROM Userlist WHERE  CorpID = " + dList.SelectedItem.Value);

                    for (i = 0; i < dt.Rows.Count; i++)
                    {
                        //每次插入TaskProcess 之前确保之前没有记录,保证TaskProces中,对于每个任务每人只有一条记录

                        MyManager.ExecSQL("DELETE FROM TaskProcess Where TaskID = " + TaskID + " AND RecvUser = "******"ID"].ToString());

                        MyManager.ExecSQL("INSERT INTO TaskProcess(TaskID,SendUser,SendCorpID,RecvCorpID,RecvUser,State,Content,DateTime) VALUES ("
                                          + TaskID + ","
                                          + Session["UserID"].ToString() + ","
                                          + Session["CorpID"].ToString() + ","
                                          + dList.SelectedItem.Value + ","
                                          + dt.Rows[i]["ID"].ToString() + ",7,'领导分配任务到本组','" + DateTime.Now.ToString() + "')");
                    }
                }
            }
            else if (RealTaskProcessState == "4")
            {
                Title = "获知任务分配";
                MyManager.ExecSQL("UPDATE TaskProcess Set Content='任务被领取已获知',State = 2 WHERE RecvUser = "******"UserID"].ToString());
                Msg = Session["Name"].ToString() + " 已获知任务被领取,开始任务监督。";
            }

            MyManager.ExecSQL("INSERT INTO TaskLog (TaskID,CreateUserID,CreateUserName,Title,Content,DateTime) VAlues('"
                              + TaskID + "','"
                              + Session["UserID"].ToString() + "','"
                              + Session["Name"].ToString() + "','"
                              + Title + "','"
                              + Msg + "','"
                              + DateTime.Now.ToString() + "')");
        }

        if (UserType == "1")
        {
            if (RealTaskProcessState == "1")//组长 State = 1 开始领取任务。
            {
                Title = "组长领取任务";
                //更改任务发送和接收部门 Tasks RecvCorpID 和 SendCorpID
                MyManager.ExecSQL("UPDATE Tasks Set SendCorpID = " + Session["CorpParentID"].ToString() + ",RecvCorpID=" + Session["CorpID"].ToString() + " WHERE ID = " + TaskID);

                //组长该任务状态变为处理中2
                MyManager.ExecSQL("UPDATE TaskProcess Set Content='任务领取',DateTime = '" + DateTime.Now.ToString() + "',State = 2 WHERE TaskID =" + TaskID + " AND RecvUser = "******"UserID"].ToString());

                ///给小组成员分配任务
                dt = MyManager.GetDataSet("select A.CorpName,A.Corptype,A.CorpID,B.ID AS UserID,B.UserType,B.Name from Corps AS A left join UserList AS B On A.CorpID = B.CorpID WHERE A.ParentID =" + Session["CorpParentID"].ToString());
                DataRow[] dr;
                dr  = dt.Select(" UserType=2 AND CorpID = " + Session["CorpID"]);
                Msg = "接收人员:";
                for (i = 0; i < dr.Length; i++)
                {
                    Msg += " " + dr[i]["Name"].ToString();
                    //每次插入TaskProcess 之前确保之前没有记录,保证TaskProces中,对于每个任务每人只有一条记录
                    MyManager.ExecSQL("DELETE FROM TaskProcess Where TaskID = " + TaskID + " AND RecvUser = "******"UserID"].ToString());

                    MyManager.ExecSQL("INSERT INTO TaskProcess(TaskID,SendUser,SendCorpID,RecvCorpID,RecvUser,State,Content,DateTime) VALUES ("
                                      + TaskID + ","
                                      + Session["UserID"].ToString() + ","
                                      + Session["CorpID"].ToString() + ","
                                      + Session["CorpID"].ToString() + ","
                                      + dr[i]["UserID"].ToString() + ",1,'组长分配','" + DateTime.Now.ToString() + "')");
                }
                //写log
                MyManager.ExecSQL("INSERT INTO TaskLog (TaskID,CreateUserID,CreateUserName,Title,Content,DateTime) VAlues('"
                                  + TaskID + "','"
                                  + Session["UserID"].ToString() + "','"
                                  + Session["Name"].ToString() + "','"
                                  + Title + "','"
                                  + Msg + "','"
                                  + DateTime.Now.ToString() + "')");

                //通知科长和其他小组组长,任务已被我组认领

                dr    = dt.Select(" UserType<> 2 AND UserID<>" + Session["UserID"].ToString());
                Title = "通知任务被认领";
                Msg   = "通知";
                for (i = 0; i < dr.Length; i++)
                {
                    Msg += " " + dr[i]["Name"].ToString();
                    MyManager.ExecSQL("UPDATE TaskProcess Set Content = '任务被" + Session["CorpName"].ToString() + "领取',DateTime = '" + DateTime.Now.ToString() + "',State = 4 WHERE TaskID = " + TaskID + " AND RecvUser = "******"UserID"].ToString());
                }

                MyManager.ExecSQL("INSERT INTO TaskLog (TaskID,CreateUserID,CreateUserName,Title,Content,DateTime) VAlues("
                                  + TaskID + ","
                                  + Session["UserID"].ToString() + ",'"
                                  + Session["Name"].ToString() + "','"
                                  + Msg + "','"
                                  + "任务被" + Session["CorpName"].ToString() + "认领" + "','"
                                  + DateTime.Now.ToString() + "')");
                MyManager.WriteTaskFlow(TaskID, Session["UserID"].ToString(), Session["CorpParentID"].ToString(), Session["CorpID"].ToString(), "科队内流转", DateTime.Now.ToString());
            }
            else if (RealTaskProcessState == "7")
            {
                MyManager.ExecSQL("UPDATE TaskProcess Set Content='任务分配至本组',DateTime = '" + DateTime.Now.ToString() + "',State = 2 WHERE TaskID =" + TaskID + " AND RecvUser = "******"UserID"].ToString());

                MyManager.ExecSQL("INSERT INTO TaskLog (TaskID,CreateUserID,CreateUserName,Title,Content,DateTime) VAlues('"
                                  + TaskID + "','"
                                  + Session["UserID"].ToString() + "','"
                                  + Session["Name"].ToString() + "','"
                                  + "任务认领" + "','"
                                  + Session["Name"].ToString() + "','"
                                  + DateTime.Now.ToString() + "')");
            }
            else //4 5 6 8 任务被认领 被退回 被撤回 已分配他组
            {
                MyManager.ExecSQL("UPDATE TaskProcess Set DateTime = '" + DateTime.Now.ToString() + "',State = 9 WHERE TaskID =" + TaskID + " AND RecvUser = "******"UserID"].ToString());

                MyManager.ExecSQL("INSERT INTO TaskLog (TaskID,CreateUserID,CreateUserName,Title,Content,DateTime) VAlues('"
                                  + TaskID + "','"
                                  + Session["UserID"].ToString() + "','"
                                  + Session["Name"].ToString() + "','"
                                  + "获知" + "','"
                                  + GridView1.Rows[Convert.ToInt32(RowIndex)].Cells[7].Text + "','"
                                  + DateTime.Now.ToString() + "')");
            }
        }
        /*-------------------------------------组员---------------------------------------------------------*/
        if (UserType == "2")                                                //组员
        {
            if (RealTaskProcessState == "1" || RealTaskProcessState == "7") //组员 State = 7开始领取任务。
            {
                Title = "任务领取";
                //组员该任务状态变为处理中2
                MyManager.ExecSQL("UPDATE TaskProcess Set Content='处理中',DateTime = '" + DateTime.Now.ToString() + "',State = 2 WHERE TaskID =" + TaskID + " AND RecvUser = "******"UserID"].ToString());

                MyManager.ExecSQL("INSERT INTO TaskLog (TaskID,CreateUserID,CreateUserName,Title,Content,DateTime) VAlues('"
                                  + TaskID + "','"
                                  + Session["UserID"].ToString() + "','"
                                  + Session["Name"].ToString() + "','"
                                  + Title + "','"
                                  + GridView1.Rows[Convert.ToInt32(RowIndex)].Cells[5].Text + "','"
                                  + DateTime.Now.ToString() + "')");
            }
            else // 5 6任务被撤回或者退回
            {
                MyManager.ExecSQL("UPDATE TaskProcess Set Content='',DateTime = '" + DateTime.Now.ToString() + "',State = 9 WHERE TaskID =" + TaskID + " AND RecvUser = "******"UserID"].ToString());

                MyManager.ExecSQL("INSERT INTO TaskLog (TaskID,CreateUserID,CreateUserName,Title,Content,DateTime) VAlues('"
                                  + TaskID + "','"
                                  + Session["UserID"].ToString() + "','"
                                  + Session["Name"].ToString() + "','"
                                  + "获知" + "','"
                                  + GridView1.Rows[Convert.ToInt32(RowIndex)].Cells[7].Text + "','"
                                  + DateTime.Now.ToString() + "')");
            }
        }

        GV1Bind();
    }