/// <summary>
    /// 保存信息
    /// </summary>
    protected void ModelSave()
    {
        string Field = "ClassId,", Val = this.ClassId.SelectedValue + "{$split$}";
        mField mF = new mField();
        bField bF = new bField();

        mF.TableName = mm.TableName;
        DataSet ds = bF.FieldList(mF);

        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            string ValTemp = System.Web.HttpContext.Current.Request.Form[ds.Tables[0].Rows[i]["Field"].ToString()];
            if (ValTemp != string.Empty && ValTemp != null)
            {
                Field += ds.Tables[0].Rows[i]["Field"].ToString() + ",";
                Val   += HXD.ModelField.Common.FieldType.FormatField(ds.Tables[0].Rows[i]["Type"].ToString(), ds.Tables[0].Rows[i]["Field"].ToString()) + "{$split$}";
            }
        }
        if (mm.Id == 0)
        {
            bm.ModelInsert(mm.TableName, Field, Val);
        }
        else
        {
            bm.ModelUpdate(mm.Id, mm.TableName, Field, Val);
        }
        if (MenuId == 0)
        {
            Jscript.Alert("保存成功!", this.Page); binder();
        }
        else
        {
            Response.Redirect("Model_Manage.aspx?MenuId=" + MenuId);
        }
    }
Exemple #2
0
    /// <summary>
    /// 保存管理员信息
    /// </summary>
    protected void UserSave()
    {
        mU.UserName = this.UserName.Text;
        mU.UserPwd  = Encryp.DESEncrypt(this.UserPwd.Text);
        mField mF = new mField();
        bField bF = new bField();

        mF.TableName = mm.TableName;
        DataSet ds = bF.FieldList(mF);
        string  Field = "", Val = "";

        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            Field += ds.Tables[0].Rows[i]["Field"].ToString() + ",";
            Val   += HXD.ModelField.Common.FieldType.FormatField(ds.Tables[0].Rows[i]["Type"].ToString(), ds.Tables[0].Rows[i]["Field"].ToString()) + "{$split$}";
        }
        if (mU.Id == 0)
        {
            Field += "Id";
            Val   += bU.UserInsert(mU).ToString();
            bm.ModelInsert(mm.TableName, Field, Val);
        }
        else
        {
            Field += "1";
            Val   += "1";
            bU.UserUpdate(mU);
            bm.ModelUpdate(mm.Id, mm.TableName, Field.Trim(','), Val.Trim(','));
        }
        StringDeal.Alter("保存完成!", "User_Manage.aspx?GroupId=" + mU.GroupId + "");
    }