Exemple #1
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();
            int id = WS.RequestInt("id");
            UserGroup g = (from l in ent.UserGroup where l.ID == id select l).FirstOrDefault();
            if (g == null)
            {
                g = new UserGroup();
            }

            g.GroupName = txt_GroupName.Text;
            g.Grade = txt_grade.Text.ToInt32();
            g.MaxPost = txt_MaxPost.Text.ToInt32();
            g.PostAotuAudit = chk_PostAotuAudit.Checked;
            g.EnableReg = chk_EnableReg.Checked;
            g.RegAutoAudit = chk_RegAutoAudit.Checked;
            g.RegForm = ddl_RegForm.SelectedValue.ToInt32();

            if (g.ID <= 0)
            {
                ent.AddToUserGroup(g);
            }
            ent.SaveChanges();
            ent.Dispose();
            Js.AlertAndChangUrl("保存成功!", "GroupList.aspx");
        }