コード例 #1
0
    //将数据保存
    protected void btn1_Click(object sender, EventArgs e)
    {
        CommTable comm1 = new CommTable();

        comm1.TabName = "ZX_RCAP";

        //保存老的数据
        if (this.id.Value == "")
        {
            Hashtable ht = new Hashtable();
            ht["time0"] = DateTime.Now.ToString();
            ht["sname"] = User.Identity.Name;
            U_UserNameBU user1 = new U_UserNameBU();
            ht["depart"] = user1.GetDepart1(User.Identity.Name);
            user1.Close();

            ht["plantime"] = this.plantime.Text;
            ht["subject"]  = Util.GetMaxLenth(this.subject.Text, 90);
            ht["remark"]   = this.remark.Text;
            comm1.InsertData(ht);
        }
        else
        {
            string             infoid = this.id.Value;
            List <SearchField> list1  = new List <SearchField>();
            list1.Add(new SearchField("id", infoid, SearchFieldType.数值型));
            list1.Add(new SearchField("sname", User.Identity.Name));

            Hashtable ht = new Hashtable();
            ht["plantime"] = this.plantime.Text;
            ht["subject"]  = Util.GetMaxLenth(this.subject.Text, 90);
            ht["remark"]   = this.remark.Text;
            comm1.EditQuickData(list1, ht);
        }
        comm1.Close();
        Response.Redirect("MyRcaiPai.aspx", true);
    }