コード例 #1
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);
    }