Exemple #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                var role = CreateNewRole();

                if (roleSerivce.IsRoleExsist(role.Name, role.ID, false))
                {
                    Fxm.Utility.Page.MessageBox.Show("该名称的角色已经存在,请修改");
                    return;
                }

                if (roleSerivce.GenericService.FirstOrDefault(r => r.Code == txtCode.Text.Trim()) != null)
                {
                    Fxm.Utility.Page.MessageBox.Show("该名称的编号已经存在,请修改");
                    return;
                }

                roleSerivce.GenericService.Add(role);
                roleSerivce.GenericService.Save();
                SaveRole(role.ID);
            }
            catch (Exception ex)
            {
                Fxm.Utility.Page.MessageBox.Show("保存过程发生错误,请重试!");

                //记录错误日志
                NySoftland.Core.Log4.LogHelper.Error("新增角色异常[AddRole.aspx]", ex);
            }

            Fxm.Utility.Page.JsHelper.CloseWindow(true, "数据保存成功!");
        }
Exemple #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                var role = CreateRole();

                if (roleSerivce.IsRoleExsist(role.Name, role.ID, true))
                {
                    Fxm.Utility.Page.MessageBox.Show("该名称的角色已经存在,请修改");
                    return;
                }

                roleSerivce.GenericService.Update(role);
                roleSerivce.GenericService.Save();
            }
            catch (Exception ex)
            {
                Fxm.Utility.Page.MessageBox.Show("保存过程发生错误,请重试!");
                //记录错误日志
                NySoftland.Core.Log4.LogHelper.Error("编辑角色异常[EditRole.aspx]", ex);
            }

            Fxm.Utility.Page.JsHelper.CloseWindow(true, "数据保存成功!");
        }