Exemple #1
0
        public static bool Delete(RightLkFunctionCommand rightLKFunctionCommand, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
DELETE FROM T_RIGHT
WHERE FUNCTION_SYSID=@FunctionSysid
    AND COMMAND_SYSID=@CommandSysid ";

            return(Dapper.Save(rightLKFunctionCommand, sql, conn, trans));
        }
Exemple #2
0
        public static bool Delete(RightLkFunctionCommand rightLKFunctionCommand, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
            DELETE FROM T_RIGHT
            WHERE FUNCTION_SYSID=@FunctionSysid
            AND COMMAND_SYSID=@CommandSysid ";

            return Dapper.Save(rightLKFunctionCommand, sql, conn, trans);
        }
Exemple #3
0
        public static bool Insert(RightLkFunctionCommand rightLkFunctionCommand, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
INSERT INTO T_RIGHT_LK_FUNCTION_COMMAND(FUNCTION_SYSID,COMMAND_SYSID)
VALUES(@FunctionSysid,@CommandSysid)

";

            return(Dapper.Save(rightLkFunctionCommand, sql, conn, trans));
        }
        public static bool Insert(RightLkFunctionCommand rightLkFunctionCommand, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
            INSERT INTO T_RIGHT_LK_FUNCTION_COMMAND(FUNCTION_SYSID,COMMAND_SYSID)
            VALUES(@FunctionSysid,@CommandSysid)

            ";

            return Dapper.Save(rightLkFunctionCommand, sql, conn, trans);
        }
        //用编辑框数据填充实体
        /// <summary>
        /// 用编辑框数据填充实体
        /// </summary>
        private List<RightLkFunctionCommand> BuildEntity(out List<RightLkFunctionCommand> deleteList)
        {
            var insertlist = new List<RightLkFunctionCommand>();
            deleteList = new List<RightLkFunctionCommand>();
            var rightFunction = gridViewFunc.SelectedRows[0].DataBoundItem as RightFunction;
            if (rightFunction == null)
                return insertlist;

            foreach (var row in gridViewCommand.Rows)
            {
                var command = row.DataBoundItem as DictionaryItem;
                if (command == null)
                    continue;

                var rightLkFunctionCommand = new RightLkFunctionCommand
                                                 {
                                                     CommandSysid = command.Sysid,
                                                     FunctionSysid = rightFunction.Sysid
                                                 };
                var isInDbChecked = _commandsInDb.FindAll(p => p.Sysid == command.Sysid).Count > 0;
                var value = row.Cells[0].Value;
                if (value == null || value.ToString().ToLower() == "false")
                {
                    if (isInDbChecked)
                        deleteList.Add(rightLkFunctionCommand);
                    continue;
                }
                if (!isInDbChecked)
                    insertlist.Add(rightLkFunctionCommand);
            }
            return insertlist;
        }