Пример #1
0
        void CreateTree(TreeView tv)
        {
            String    NodeName;
            DataTable dt     = MyManager.GetDataSet("select ID,name,(case when FingerTmpStr is null then 0 when FingerTmpStr IS not null then 1 end) as sign  from userlist order by Name asc");
            TreeNode  p_node = tv.Nodes.Add("全体人员");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["sign"].ToString() == "0")
                {
                    NodeName = dt.Rows[i]["Name"].ToString() + "(N)";
                }
                else
                {
                    NodeName = dt.Rows[i]["Name"].ToString() + "(Y)";
                }
                NodeTag nt = new NodeTag();
                nt.UserName      = dt.Rows[i]["Name"].ToString();
                nt.UserID        = dt.Rows[i]["ID"].ToString();
                nt.HaveFingerTmp = Convert.ToInt32(dt.Rows[i]["sign"].ToString());
                TreeNode node = new TreeNode(NodeName);
                node.Tag = nt;
                if (nt.HaveFingerTmp == 0)
                {
                    node.ForeColor = Color.Red;
                }

                p_node.Nodes.Add(node);
            }
            p_node.Expand();
            //tv.Nodes.Add(p_node);
        }
Пример #2
0
    protected void btnLogin_Click(object sender, ImageClickEventArgs e)
    {
        if (txtUserName.Text == "" || txtPassword.Text == "")
        {
            ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('输入信息完整!');</script>");
            return;
        }


        DataTable dt = MyManager.GetDataSet("SELECT UserList.*, Corps.CorpName,Corps.CorpType,Corps.ParentID FROM UserList left join Corps on UserList.CorpID = Corps.CorpID Where UserName = '******' And Pwd = '" + System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text, "MD5").ToUpper() + "'");


        if (dt.Rows.Count == 0)
        {
            ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('认证失败!');</script>");
            return;
        }

        Session["UserID"]       = dt.Rows[0]["ID"];
        Session["Name"]         = dt.Rows[0]["Name"];
        Session["LoginTime"]    = DateTime.Now.ToString("HH:mm:ss");
        Session["UserType"]     = dt.Rows[0]["UserType"];
        Session["CorpName"]     = dt.Rows[0]["CorpName"];
        Session["CorpID"]       = dt.Rows[0]["CorpID"];
        Session["CorpType"]     = dt.Rows[0]["CorpType"];
        Session["CorpParentID"] = dt.Rows[0]["ParentID"];
        Response.Redirect("Main.aspx");
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String txtUserName = "", txtPassword = "", json = "{}";


        StringWriter sw     = new StringWriter();
        JsonWriter   jWrite = new JsonTextWriter(sw);

        StreamReader reader = new StreamReader(Request.InputStream);

        json = reader.ReadToEnd();

        try
        {
            JObject JO = JObject.Parse(json);

            txtUserName = JO["username"].ToString();

            txtPassword = JO["pwd"].ToString();

            /*Response.Write("dat:" +json+"\n");
             * Response.Write("parse:" + txtUserName + txtPassword + "\n");
             * Response.Write("response:");*/
            if (txtUserName == "" || txtPassword == "")
            {
                json = "{\"status\":\"failed\",\"Msg\":\"请输入用户名和密码!\"}";
                Response.Write(json);
                return;
            }

            //Response.Write("h1\n");

            DataTable dt = MyManager.GetDataSet("SELECT UserList.*, Corps.CorpName,Corps.CorpType,Corps.ParentID FROM UserList left join Corps on UserList.CorpID = Corps.CorpID Where UserName = '******' And Pwd = '" + System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword, "MD5").ToUpper() + "'");

            //  Response.Write("h2\n");
            if (dt.Rows.Count == 0)
            {
                json = "{\"status\":\"failed\",\"Msg\":\"密码错误!\"}";
                Response.Write(json);
            }
            //  Response.Write("h3\n")


            Session["UserID"]       = dt.Rows[0]["ID"];
            Session["Name"]         = dt.Rows[0]["Name"];
            Session["LoginTime"]    = DateTime.Now.ToString("HH:mm:ss");
            Session["UserType"]     = dt.Rows[0]["UserType"];
            Session["CorpName"]     = dt.Rows[0]["CorpName"];
            Session["CorpID"]       = dt.Rows[0]["CorpID"];
            Session["CorpType"]     = dt.Rows[0]["CorpType"];
            Session["CorpParentID"] = dt.Rows[0]["ParentID"];
            json = "{\"status\":\"success\",\"url\":\"Main.aspx\"}";
            Response.Write(json);
        }
        catch (Exception ee)
        {
            json = "{\"status\":\"failed\",\"Msg\":\"" + ee.ToString() + "\"}";
        }
        //Response.Redirect("RealMain.aspx");
    }
Пример #4
0
    protected ArrayList GetGropInfoList(String CorpID) //获取本科队小组信息
    {
        ArrayList ls = new ArrayList();

        DataTable dt = MyManager.GetDataSet("SELECT * FROM Corps WHERE CorpType = 2 And ParentID=" + CorpID + " ORDER BY CorpID ASC");

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            GropInfo GI = new GropInfo();
            GI.CorpID = dt.Rows[i]["CorpID"].ToString();
            GI.Name   = dt.Rows[i]["CorpName"].ToString();
            ls.Add(GI);
        }

        return(ls);
    }
Пример #5
0
    public void FillTaskBlanks(String TaskID)
    {
        DataRow[] dr;
        DataTable dt = MyManager.GetDataSet("SELECT A.*,B.TypeName FROM Tasks as A Left Join  TaskTypes AS B on A.Type = B.TypeID where A.ID = " + TaskID);

        DataTable Corpsdt = MyManager.GetDataSet("SELECT * FROM Corps");

        DataTable UserListdt = MyManager.GetDataSet("SELECT * FROM UserList");

        dr = Corpsdt.Select(" CorpID = " + dt.Rows[0]["RecvCorpID"].ToString());

        RecvCorpName = dr[0]["CorpName"].ToString();
        RecvCorpID   = dr[0]["CorpID"].ToString();
        TaskState    = dt.Rows[0]["State"].ToString();
        TaskType     = dt.Rows[0]["Type"].ToString();
        label1.Text  = dt.Rows[0]["TaskCode"].ToString();
        Label2.Text  = dt.Rows[0]["TypeName"].ToString();
        Label3.Text  = dt.Rows[0]["Name"].ToString();
        Label4.Text  = dt.Rows[0]["CreateTime"].ToString();
        Label18.Text = dt.Rows[0]["Memo"].ToString();
        dr           = UserListdt.Select(" ID = " + dt.Rows[0]["CreateUser"].ToString());
        Label5.Text  = dr[0]["Name"].ToString();

        dr           = Corpsdt.Select("  CorpID = " + dt.Rows[0]["CreateCorpID"].ToString());
        Label14.Text = dr[0]["CorpName"].ToString();

        if (dt.Rows[0]["DealCorpID"].ToString() != "")
        {
            dr           = Corpsdt.Select("  CorpID = " + dt.Rows[0]["DealCorpID"].ToString());
            Label13.Text = dr[0]["CorpName"].ToString();

            dr = UserListdt.Select(" [UserType] = 1  AND  CorpID = " + dt.Rows[0]["DealCorpID"].ToString());

            Label17.Text = dr[0]["Name"].ToString();

            dr = UserListdt.Select(" [UserType] = 2  AND CorpID = " + dt.Rows[0]["DealCorpID"].ToString());

            for (int i = 0; i < dr.Length; i++)
            {
                Label16.Text = Label16.Text + " " + dr[i]["Name"].ToString();
            }
        }
        else
        {
            Label13.Text = "待领导分配";
        }
    }
Пример #6
0
    protected String GetCommentShowStr(String TaskID)
    {
        int           i  = 0;
        StringBuilder sb = new StringBuilder("");

        DataTable dt = MyManager.GetDataSet("SELECT A.*,B.Name,C.CorpName FROM TaskComments AS A left join UserList AS B on A.UserID= B.ID left join Corps AS C on C.CorpID = B.CorpID WHERE TaskID =" + TaskID + " ORDER BY DateTime ASC");

        if (dt.Rows.Count == 0)
        {
            return("");
        }

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

        for (i = 0; i < dr.Length; i++)
        {
            sb.Append(s1).Append(dr[i]["Title"].ToString()).Append(s2).Append(dr[i]["Name"].ToString()).Append(s3).Append(dr[i]["DateTime"].ToString()).Append(s4).Append(dr[i]["Content"].ToString()).Append(s5).Append(s6);
        }

        return(sb.ToString());
    }
Пример #7
0
 protected void TabContainer1_ActiveTabChanged(object sender, EventArgs e)
 {
     if (TabContainer1.ActiveTab.ID == "TabPanel3")
     {
         Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='JavaScript'>Jump('" + MyManager.GetDealPage(Convert.ToInt32(TaskType), TaskID) + "','TaskDATA')</script>");
     }
     if (TabContainer1.ActiveTab.ID == "TabPanel6")
     {
         Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='JavaScript'>Jump('TaskComments.aspx?TaskID=" + TaskID + "','TaskComments')</script>");
     }
     if (TabContainer1.ActiveTab.ID == "TabPanel4")
     {
         TaskLogGV.DataSource = MyManager.GetDataSet("SELECT * FROM TaskLog WHERE TaskID = " + TaskID + " ORDER BY DateTime ASC");
         TaskLogGV.DataBind();
     }
     if (TabContainer1.ActiveTab.ID == "TabPanel5")
     {
         TaskFlowGV.DataSource = MyManager.GetDataSet("SELECT A.* ,B.CorpName as fsbm,c.CorpName as jsbm,D.Name as fsz FROM TaskFlow as A left join  corps as B on A.SendCorp = B.CorpID left join corps AS C ON A.RecvCorp = C.CorpID left Join UserList as D On A.Senduser= D.ID where A.taskid =" + TaskID + " ORDER BY A.DateTime ASC");
         TaskFlowGV.DataBind();
     }
 }
Пример #8
0
        private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            NodeTag nt = (NodeTag)e.Node.Tag;

            label2.Text     = "未登记";
            button1.Enabled = true;
            button2.Enabled = false;
            button3.Enabled = false;
            if (nt.HaveFingerTmp == 1)
            {
                label2.Text = "已登记";
                DataTable dt = MyManager.GetDataSet("SELECT FingerTmpStr,FingerTmpBin,FingerImg From UserList Where ID = " + nt.UserID);
                textBox1.Text = dt.Rows[0]["FingerTmpStr"].ToString();
                // pictureBox1.Image
                // pictureBox1.Load(dt.Rows[0]["FingerImg"].ToString());
                button1.Enabled = false;
                button2.Enabled = false;
                button3.Enabled = true;
            }
            //MessageBox.Show(e.Node.Text + "" + nt.UserID);
        }
Пример #9
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);
        }
    }
Пример #10
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);
        }
    }
Пример #11
0
 protected void GV2Bind()
 {
     GridView2.DataSource = MyManager.GetDataSet("select F.Name as TaskStatus ,A.TaskID,A.State,A.Memo,A.Content,A.DateTime,B.TaskCode,B.Name AS TaskName,C.CorpName as SendCropName ,E.TypeName FROM [TaskProcess] as A  left join Tasks as B On A.TaskID = B.ID left join Corps AS  C on A.SendCorpID = C.CorpID left join TaskTypes AS E on B.Type = E.TypeID left join TaskProcessState AS F On A.State = F.State  WHERE A.State = 2 AND  A.RecvUser = "******"UserID"].ToString() + " ORDER BY A.DateTime DESC");
     GridView2.DataBind();
 }
Пример #12
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();
    }
Пример #13
0
    public void CreateReport(String HitTaskID)
    {
        int    i, j, k, iCount = 1, t;
        String Type, Note = "", mTableName, subTableName, zdName, State;/*批注*/

        DataRow[] dr, dr1;
        DataTable dt2;

        dt2 = MyManager.GetDataSet("SELECT * From [HitTool] Where State = 1 AND TaskID = '" + HitTaskID + "'");
        if (dt2.Rows.Count == 0)
        {
            return;
        }
        Type = dt2.Rows[0]["Type"].ToString();

        if (Type == "1")
        {
            mTableName = "StoredTool"; subTableName = "StoredToolValue"; zdName = "StoredID"; State = "4";
        }
        else
        {
            mTableName = "CoreTool"; subTableName = "CoreToolValue"; zdName = "CoreID"; State = "1";
        }

        Aspose.Cells.Workbook  workbook = new Aspose.Cells.Workbook(Server.MapPath("./") + "Template\\mb.xls");
        Aspose.Cells.Worksheet sheet    = workbook.Worksheets[0];
        Aspose.Cells.Cells     cells    = sheet.Cells;

        DataTable dt = MyManager.GetDataSet("SELECT * FROM " + mTableName + " where [State] = " + State + " AND [RelatedTask] = '" + HitTaskID + "'");

        for (i = 0, iCount = 1; i < dt.Rows.Count; i++)
        {
            DataTable dt1 = MyManager.GetDataSet("SELECT A.*,B.Name FROM " + subTableName + " AS A join [CLassPropertys] AS B on A.PropertyID = B.ID Where " + zdName + " = '" + dt.Rows[i]["ID"].ToString() + "'");
            sheet = workbook.Worksheets[workbook.Worksheets.AddCopy("Bak")];
            cells = sheet.Cells;
            dr    = dt1.Select("ValueType = 3 ");
            for (j = 0; j < dr.Length; j++)
            {
                t = j % 44;           //t始终在0-51内变化
                if (t == 0 && j != 0) /*证明本页已经填完,需要加页*/
                {
                    sheet = workbook.Worksheets[workbook.Worksheets.AddCopy("Bak")];
                    cells = sheet.Cells;
                }
                if (j % 22 == 0)/*页内或者页间表格切换*/
                {
                    cells[2, (t / 22) * 6].PutValue("      工具箱编号:" + dt.Rows[i][Type == "1" ? "rkID" : "ToolID"].ToString() + "          名称:" + dt.Rows[i][Type == "1" ? "StoredName" : "ToolName"].ToString());
                    //------------------增加批注-----------------------

                    dr1 = dt1.Select("ValueType = 2 AND ParentID = " + dt.Rows[i]["ID"].ToString());
                    for (k = 0, Note = ""; k < dr1.Length; k++)
                    {
                        Note += dr1[k]["Name"].ToString().Trim() + ":" + dr1[k]["Value"].ToString() + "\n\r";
                    }
                    sheet.Comments.Add(2, (t / 22) * 6);
                    sheet.Comments[2, (t / 22) * 6].Note = Note;
                    //------------------------------------------------
                }

                cells[4 + t % 22, (t / 22) * 6].PutValue(j + 1);
                cells[4 + t % 22, (t / 22) * 6 + 1].PutValue(dr[j]["Value"].ToString());
                cells[4 + t % 22, (t / 22) * 6 + 2].PutValue(dr[j][Type == "1" ? "rkID" : "ToolID"].ToString());
                //------------------增加批注-----------------------
                dr1 = dt1.Select("ValueType = 4 AND ParentID = " + dr[j]["ID"].ToString());
                for (k = 0, Note = ""; k < dr1.Length; k++)
                {
                    Note += dr1[k]["Name"].ToString().Trim() + ":" + dr1[k]["Value"].ToString() + "\n\r";
                }
                sheet.Comments.Add(4 + t % 22, (t / 22) * 6 + 1);
                sheet.Comments[4 + t % 22, (t / 22) * 6 + 1].Note = Note;
                //------------------------------------------------

                iCount++;
            }
        }
        workbook.Worksheets.RemoveAt("Bak");
        XlsSaveOptions saveOptions = new XlsSaveOptions();

        workbook.Save(Response, "工具清单.xls", ContentDisposition.Inline, saveOptions);
    }
Пример #14
0
 protected void GV1Bind()
 {
     GridView1.DataSource = MyManager.GetDataSet("SELECT * FROM HitTool Where State = 1 ");
     GridView1.DataBind();
 }