Exemplo n.º 1
0
    private int sava()
    {
        ArrayList list      = new ArrayList();
        string    datalist  = "";
        string    datafield = "";

        System.Collections.Specialized.NameObjectCollectionBase.KeysCollection keys = Request.Params.Keys;//取得所有Request的Key值
        for (int i = 0; i < keys.Count; i++)
        {
            //过滤其它Request的Key值留以DATA_开头的Key
            if (keys[i].ToString().IndexOf("DATA_") >= 0)
            {
                list.Add(keys[i].ToString());          //将key值存入数组
                datafield += keys[i].ToString() + ","; //将key值存入字符串
            }
        }
        //获取表单提交过来的值
        for (int j = 0; j < list.Count; j++)
        {
            datalist += Request.Form[list[j].ToString()] + "<@Sep@>";//值用<@Sep@>隔开以便存入数据库
        }
        mtb.b_content = datalist;
        if (!string.IsNullOrEmpty(datafield))
        {
            datafield = datafield.Substring(0, datafield.Length - 1);//去掉最后的的','
        }
        mtb.b_datefield = datafield;
        if (!"".Equals(this.SaveFiles()))
        {
            if (null != Request.Form["hfile"] && !"".Equals(Request.Form["hfile"]))
            {
                mtb.b_file = Request.Form["hfile"] + "," + this.SaveFiles();//批量附件上传
            }
            else
            {
                mtb.b_file = this.SaveFiles();//批量附件上传
            }
        }
        else
        {
            if (null != Request.Form["hfile"] && !"".Equals(Request.Form["hfile"]))
            {
                mtb.b_file = Request.Form["hfile"];
            }
            else
            {
                mtb.b_file = "";
            }
        }
        mf                = bf.GetModel(int.Parse(Request.Params["Flow"]));
        mtb.b_title       = TextBox1.Text.Trim();
        mtb.b_time        = DateTime.Now;
        mtb.b_user        = ul.LoginID;
        mtf               = tf.GetModel(mf.f_form);
        mtb.b_formcontent = mtf.f_content;
        mtb.b_sort        = int.Parse(Request.Params["Flow"]);
        mtb.b_state       = (mf.f_state == 0 ? 1 : 2);
        mtb.b_suser       = (RadioButtonList3.SelectedValue == "1" ? int.Parse(m_value.Value) : 0);
        return(btb.Add(mtb));
    }
Exemplo n.º 2
0
    /// <summary>
    /// 保存表单
    /// </summary>
    /// <returns></returns>
    private void sava()
    {
        mtb = btb.GetModel(Convert.ToInt32(Request.Params["bid"]));
        ArrayList list      = new ArrayList();
        string    datalist  = "";
        string    datafield = "";

        System.Collections.Specialized.NameObjectCollectionBase.KeysCollection keys = Request.Params.Keys;//取得所有Request的Key值
        for (int i = 0; i < keys.Count; i++)
        {
            //过滤其它Request的Key值留以DATA_开头的Key
            if (keys[i].ToString().IndexOf("DATA_") >= 0)
            {
                list.Add(keys[i].ToString());          //将key值存入数组
                datafield += keys[i].ToString() + ","; //将key值存入字符串
            }
        }
        //获取表单提交过来的值
        for (int j = 0; j < list.Count; j++)
        {
            datalist += Request.Form[list[j].ToString()] + "<@Sep@>";//值用<@Sep@>隔开以便存入数据库
        }
        mtb.b_content = datalist;
        if (!string.IsNullOrEmpty(datafield))
        {
            datafield = datafield.Substring(0, datafield.Length - 1);//去掉最后的的','
        }
        mtb.b_datefield = datafield;
        if (!"".Equals(this.SaveFiles()))
        {
            if (null != Request.Form["hfile"] && !"".Equals(Request.Form["hfile"]))
            {
                mtb.b_file = Request.Form["hfile"] + "," + this.SaveFiles();//批量附件上传
            }
            else
            {
                mtb.b_file = this.SaveFiles();//批量附件上传
            }
        }
        else
        {
            if (null != Request.Form["hfile"] && !"".Equals(Request.Form["hfile"]))
            {
                mtb.b_file = Request.Form["hfile"];
            }
            else
            {
                mtb.b_file = "";
            }
        }
        mtb.b_title = TextBox1.Text.Trim();
        mtb.b_state = 2;
        btb.Update(mtb);
    }