public static bool Delete(RightFunctionGroup rightFunctionGroup)
        {
            using (var conn = new SqlConnection(Conn.getConn()))
            {
                if (conn.State != ConnectionState.Open)
                    conn.Open();

                using (var trans = conn.BeginTransaction())
                {
                    //1、删除功能组
                    var result = Delete(rightFunctionGroup, conn, trans);
                    if (!result)
                    {
                        trans.Rollback();
                        return false;
                    }
                    //2、删除当前组对应的功能分组信息
                    RightLkFunctionGroupDal.DeleteByGroupSysid(new RightLkFunctionGroup { GroupSysid = rightFunctionGroup.Sysid }, conn, trans);

                    //3、删除当前组对应的权限分配信息
                    RightDal.DeleteByFunctionGroupSysid(new Right { FunctionGroupSysid = rightFunctionGroup.Sysid }, conn, trans);

                    trans.Commit();
                }

                if (conn.State != ConnectionState.Closed)
                    conn.Close();
            }

            return true;
        }
        public static bool Insert(RightFunctionGroup rightFunctionGroup, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
            INSERT INTO T_RIGHT_FUNCTION_GROUP(SYSID,GROUP_NAME,SEQUENCE,GROUP_NAME_CN,GROUP_NAME_US,GROUP_NAME_TW,GROUP_NAME_EN,GROUP_NAME_GE,GROUP_NAME_VI,GROUP_NAME_JP,GROUP_NAME_KO,GROUP_NAME_FR,CREATED_ON,CREATED_BY,MODIFIED_ON,MODIFIED_BY,RECORD_STATUS)
            VALUES(@Sysid,@GroupName,@Sequence,@GroupNameCn,@GroupNameUs,@GroupNameTw,@GroupNameEn,@GroupNameGe,@GroupNameVi,@GroupNameJp,@GroupNameKo,@GroupNameFr,CONVERT(NVARCHAR(50),GETDATE(),121),@CreatedBy,CONVERT(NVARCHAR(50),GETDATE(),121),@ModifiedBy,@RecordStatus)

            ";

            return Dapper.Save(rightFunctionGroup, sql, conn, trans);
        }
        public static bool Delete(RightFunctionGroup rightFunctionGroup, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
            DELETE FROM T_RIGHT_FUNCTION_GROUP
            WHERE SYSID=@Sysid

            ";

            return Dapper.Save(rightFunctionGroup, sql, conn, trans);
        }
Esempio n. 4
0
        public static bool Delete(RightFunctionGroup rightFunctionGroup, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
DELETE FROM T_RIGHT_FUNCTION_GROUP
WHERE SYSID=@Sysid

";

            return(Dapper.Save(rightFunctionGroup, sql, conn, trans));
        }
Esempio n. 5
0
        public static bool Insert(RightFunctionGroup rightFunctionGroup, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
INSERT INTO T_RIGHT_FUNCTION_GROUP(SYSID,GROUP_NAME,SEQUENCE,GROUP_NAME_CN,GROUP_NAME_US,GROUP_NAME_TW,GROUP_NAME_EN,GROUP_NAME_GE,GROUP_NAME_VI,GROUP_NAME_JP,GROUP_NAME_KO,GROUP_NAME_FR,CREATED_ON,CREATED_BY,MODIFIED_ON,MODIFIED_BY,RECORD_STATUS)
VALUES(@Sysid,@GroupName,@Sequence,@GroupNameCn,@GroupNameUs,@GroupNameTw,@GroupNameEn,@GroupNameGe,@GroupNameVi,@GroupNameJp,@GroupNameKo,@GroupNameFr,CONVERT(NVARCHAR(50),GETDATE(),121),@CreatedBy,CONVERT(NVARCHAR(50),GETDATE(),121),@ModifiedBy,@RecordStatus)

";

            return(Dapper.Save(rightFunctionGroup, sql, conn, trans));
        }
Esempio n. 6
0
        public static List <RightFunctionGroup> QueryMutileRightFunctionGroup(RightFunctionGroup rightFunctionGroup)
        {
            const string sql = @"
SELECT SYSID AS Sysid,GROUP_NAME AS GroupName,SEQUENCE AS Sequence,CREATED_ON AS CreatedOn,CREATED_BY AS CreatedBy,MODIFIED_ON AS ModifiedOn,MODIFIED_BY AS ModifiedBy,RECORD_STATUS AS RecordStatus
FROM T_RIGHT_FUNCTION_GROUP WITH(NOLOCK) 
WHERE 1 = 1
	AND GROUP_NAME = @GroupName "    ;

            return(Dapper.Query <RightFunctionGroup>(sql, rightFunctionGroup));
        }
Esempio n. 7
0
        public static bool Update(RightFunctionGroup rightFunctionGroup, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
UPDATE T_RIGHT_FUNCTION_GROUP
SET GROUP_NAME=@GroupName,SEQUENCE=@Sequence,GROUP_NAME_CN=@GroupNameCn,GROUP_NAME_US=@GroupNameUs,GROUP_NAME_TW=@GroupNameTw,GROUP_NAME_EN=@GroupNameEn,GROUP_NAME_GE=@GroupNameGe,GROUP_NAME_VI=@GroupNameVi,GROUP_NAME_JP=@GroupNameJp,GROUP_NAME_KO=@GroupNameKo,GROUP_NAME_FR=@GroupNameFr,CREATED_BY=@CreatedBy,MODIFIED_ON=CONVERT(NVARCHAR(50),GETDATE(),121),MODIFIED_BY=@ModifiedBy,RECORD_STATUS=@RecordStatus
WHERE SYSID=@Sysid

";

            return(Dapper.Save(rightFunctionGroup, sql, conn, trans));
        }
Esempio n. 8
0
        //新增数据
        /// <summary>
        /// 新增数据
        /// </summary>
        /// <returns></returns>
        internal override bool Add()
        {
            EditEntity = null;
            pageViewMain.SelectedPage = pageEditData;
            UI.ClearUi(pageEditData);
            UI.ReadOnlyUi(pageEditData, false);

            var rightFunctionGroups = RightFunctionGroupBll.QueryAll();
            if (rightFunctionGroups != null && rightFunctionGroups.Count > 0)
                UI.SetValue(txtSequence, rightFunctionGroups.Count.ToString());

            return true;
        }
 public static bool InsertRightFunctionGroup(RightFunctionGroup rightFunctionGroup, out string msg)
 {
     var rightFunctionGroups = RightFunctionGroupDal.QueryMutileRightFunctionGroup(rightFunctionGroup);
     if (rightFunctionGroups != null && rightFunctionGroups.Count > 0)
     {
         msg = string.Format("名称{0}的记录已经存在", rightFunctionGroup.GroupName);
         return false;
     }
     if (!RightFunctionGroupDal.Insert(rightFunctionGroup))
     {
         msg = "新增失败";
         return false;
     }
     msg = "新增成功";
     return true;
 }
Esempio n. 10
0
        public static bool InsertRightFunctionGroup(RightFunctionGroup rightFunctionGroup, out string msg)
        {
            var rightFunctionGroups = RightFunctionGroupDal.QueryMutileRightFunctionGroup(rightFunctionGroup);

            if (rightFunctionGroups != null && rightFunctionGroups.Count > 0)
            {
                msg = string.Format("名称{0}的记录已经存在", rightFunctionGroup.GroupName);
                return(false);
            }
            if (!RightFunctionGroupDal.Insert(rightFunctionGroup))
            {
                msg = "新增失败";
                return(false);
            }
            msg = "新增成功";
            return(true);
        }
Esempio n. 11
0
 public static bool UpdateRightFunctionGroup(RightFunctionGroup rightFunctionGroup, out string msg)
 {
     var rightFunctionGroups = RightFunctionGroupDal.QueryMutileRightFunctionGroup(rightFunctionGroup);
     if (rightFunctionGroups != null && rightFunctionGroups.Count > 0)
     {
         if (rightFunctionGroups.FindAll(p => p.Sysid != rightFunctionGroup.Sysid).Count > 0)
         {
             msg = string.Format("名称{0}的记录已经存在", rightFunctionGroup.GroupName);
             return false;
         }
     }
     if (!RightFunctionGroupDal.Update(rightFunctionGroup))
     {
         msg = "修改失败";
         return false;
     }
     msg = "修改成功";
     return true;
 }
Esempio n. 12
0
        public static bool UpdateRightFunctionGroup(RightFunctionGroup rightFunctionGroup, out string msg)
        {
            var rightFunctionGroups = RightFunctionGroupDal.QueryMutileRightFunctionGroup(rightFunctionGroup);

            if (rightFunctionGroups != null && rightFunctionGroups.Count > 0)
            {
                if (rightFunctionGroups.FindAll(p => p.Sysid != rightFunctionGroup.Sysid).Count > 0)
                {
                    msg = string.Format("名称{0}的记录已经存在", rightFunctionGroup.GroupName);
                    return(false);
                }
            }
            if (!RightFunctionGroupDal.Update(rightFunctionGroup))
            {
                msg = "修改失败";
                return(false);
            }
            msg = "修改成功";
            return(true);
        }
Esempio n. 13
0
        public static bool Delete(RightFunctionGroup rightFunctionGroup)
        {
            using (var conn = new SqlConnection(Conn.getConn()))
            {
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }

                using (var trans = conn.BeginTransaction())
                {
                    //1、删除功能组
                    var result = Delete(rightFunctionGroup, conn, trans);
                    if (!result)
                    {
                        trans.Rollback();
                        return(false);
                    }
                    //2、删除当前组对应的功能分组信息
                    RightLkFunctionGroupDal.DeleteByGroupSysid(new RightLkFunctionGroup {
                        GroupSysid = rightFunctionGroup.Sysid
                    }, conn, trans);

                    //3、删除当前组对应的权限分配信息
                    RightDal.DeleteByFunctionGroupSysid(new Right {
                        FunctionGroupSysid = rightFunctionGroup.Sysid
                    }, conn, trans);

                    trans.Commit();
                }

                if (conn.State != ConnectionState.Closed)
                {
                    conn.Close();
                }
            }

            return(true);
        }
Esempio n. 14
0
        public static List<RightFunctionGroup> QueryMutileRightFunctionGroup(RightFunctionGroup rightFunctionGroup)
        {
            const string sql = @"
            SELECT SYSID AS Sysid,GROUP_NAME AS GroupName,SEQUENCE AS Sequence,CREATED_ON AS CreatedOn,CREATED_BY AS CreatedBy,MODIFIED_ON AS ModifiedOn,MODIFIED_BY AS ModifiedBy,RECORD_STATUS AS RecordStatus
            FROM T_RIGHT_FUNCTION_GROUP WITH(NOLOCK)
            WHERE 1 = 1
            AND GROUP_NAME = @GroupName ";

            return Dapper.Query<RightFunctionGroup>(sql, rightFunctionGroup);
        }
Esempio n. 15
0
 public static bool DeleteRightFunctionGroup(RightFunctionGroup rightFunctionGroup)
 {
     return RightFunctionGroupDal.Delete(rightFunctionGroup);
 }
Esempio n. 16
0
        public static bool Update(RightFunctionGroup rightFunctionGroup, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
            UPDATE T_RIGHT_FUNCTION_GROUP
            SET GROUP_NAME=@GroupName,SEQUENCE=@Sequence,GROUP_NAME_CN=@GroupNameCn,GROUP_NAME_US=@GroupNameUs,GROUP_NAME_TW=@GroupNameTw,GROUP_NAME_EN=@GroupNameEn,GROUP_NAME_GE=@GroupNameGe,GROUP_NAME_VI=@GroupNameVi,GROUP_NAME_JP=@GroupNameJp,GROUP_NAME_KO=@GroupNameKo,GROUP_NAME_FR=@GroupNameFr,CREATED_BY=@CreatedBy,MODIFIED_ON=CONVERT(NVARCHAR(50),GETDATE(),121),MODIFIED_BY=@ModifiedBy,RECORD_STATUS=@RecordStatus
            WHERE SYSID=@Sysid

            ";

            return Dapper.Save(rightFunctionGroup, sql, conn, trans);
        }
Esempio n. 17
0
        //设置选中的实体
        /// <summary>
        /// 设置选中的实体
        /// </summary>
        private void SetSelectedEntity()
        {
            if (grdQueryResult.SelectedRows == null ||
                grdQueryResult.SelectedRows.Count <= 0)
                return;

            EditEntity = grdQueryResult.SelectedRows[0].DataBoundItem as RightFunctionGroup;

            InitEditForm();
        }
Esempio n. 18
0
        //用编辑框数据填充实体
        /// <summary>
        /// 用编辑框数据填充实体
        /// </summary>
        private void BuildEntity()
        {
            if (CurrentOperationStatus == OperationStatus.New)
                EditEntity = new RightFunctionGroup
                                 {
                                     Sysid = Sysid.NewId(""),
                                     CreatedBy = GloableData.Instance.UserId
                                 };

            EditEntity.ModifiedBy = GloableData.Instance.UserId;
            EditEntity.GroupName = UI.GetValue(txtFuncGroupName);
            EditEntity.Sequence = UI.GetInt(txtSequence);
            EditEntity.RecordStatus = UI.GetValue(chkIsEnable);
        }
Esempio n. 19
0
 //删除数据
 /// <summary>
 /// 删除数据
 /// </summary>
 /// <returns></returns>
 internal override bool Delete()
 {
     if (EditEntity == null)
     {
         UI.ShowWarn("请选择待删除数据");
         return false;
     }
     if (!UI.Confirm("确定要删除吗?"))
         return false;
     if (!RightFunctionGroupBll.DeleteRightFunctionGroup(EditEntity))
     {
         UI.ShowError("删除失败");
         return false;
     }
     EditEntity = null;
     UI.ClearUi(pageEditData);
     return true;
 }
Esempio n. 20
0
 public static bool DeleteRightFunctionGroup(RightFunctionGroup rightFunctionGroup)
 {
     return(RightFunctionGroupDal.Delete(rightFunctionGroup));
 }