예제 #1
0
        public WebOperationResult CreateTerminalFilter(FilterDefs terminalFilter)
        {
            terminalFilter.CreatedBy= user.UserId;

            var result= cdManager.CreateTerminalFilter(terminalFilter);
            return new WebOperationResult(result.Result, result.Result
                                                              ? "Template created successfully"
                                                              : result.Message, "", result.ResultCode);
        }
예제 #2
0
        internal static FilterDefs FillTerminalFilterFromReader(SqlDataReader reader)
        {
            var terminalFilter = new FilterDefs();

            if (reader != null && !reader.IsClosed)
            {
                DataTable dt = reader.GetSchemaTable();
                if (dt.Select("ColumnName='" + "FilterId" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("FilterId")))
                        terminalFilter.FilterId = reader.GetInt32(reader.GetOrdinal("FilterId"));
                if (dt.Select("ColumnName='" + "FilterName" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("FilterName")))
                        terminalFilter.FilterName = reader.GetString(reader.GetOrdinal("FilterName"));
                if (dt.Select("ColumnName='" + "Description" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("Description")))
                        terminalFilter.Description = reader.GetString(reader.GetOrdinal("Description"));
                if (dt.Select("ColumnName='" + "SQL" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("SQL")))
                        terminalFilter.SQL = reader.GetString(reader.GetOrdinal("SQL"));
                if (dt.Select("ColumnName='" + "FilterExpression" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("FilterExpression")))
                        terminalFilter.FilterExpression = reader.GetString(reader.GetOrdinal("FilterExpression"));
                if (dt.Select("ColumnName='" + "CreatedOn" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("CreatedOn")))
                        terminalFilter.CreatedOn = reader.GetDateTime(reader.GetOrdinal("CreatedOn"));
                if (dt.Select("ColumnName='" + "CreatedBy" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("CreatedBy")))
                        terminalFilter.CreatedBy = reader.GetInt16(reader.GetOrdinal("CreatedBy"));
                if (dt.Select("ColumnName='" + "VisibleToOthers" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("VisibleToOthers")))
                        terminalFilter.VisibleToOthers = reader.GetByte(reader.GetOrdinal("VisibleToOthers"));
                if (dt.Select("ColumnName='" + "ShownOnModules" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("ShownOnModules")))
                        terminalFilter.ShownOnModules = reader.GetInt32(reader.GetOrdinal("ShownOnModules"));
            }
            return terminalFilter;
        }
예제 #3
0
        public WebOperationResult UpdateTerminalFilter(string filterId, FilterDefs terminalFilter)
        {
            terminalFilter.CreatedBy = user.UserId;
            var result = cdManager.UpdateTerminalFilter(filterId, terminalFilter);

            return new WebOperationResult(result.Result, result.Result
                                                                      ? "Template updated successfully"
                                                                      : result.Message, result.Data, result.ResultCode);
        }
예제 #4
0
        public IOperationResult UpdateTerminalFilter(string filterId, FilterDefs terminalFilter)
        {
            if (!GetTerminalFilters().Any(c => c.FilterId == Convert.ToInt32(filterId)))
                return new OperationResult() { Result = false, Message = "Terminal Filter does not exist!", Data = new List<object> { filterId } };

            bool result;

            using (var transactionContext = new TransactionContext())
            {
                result = cdDataProvider.UpdateTerminalFilter(filterId, terminalFilter, transactionContext);

                if (result)
                {
                    transactionContext.Commit();
                }
            }
            return new OperationResult() { Result = result, Data = new List<object> { terminalFilter.FilterId } };
        }
예제 #5
0
        public IOperationResult CreateTerminalFilter(FilterDefs terminalFilter)
        {
            if (GetTerminalFilters().Any(c => c.FilterId == terminalFilter.FilterId || c.FilterName == terminalFilter.FilterName))
                return new OperationResult() { Result = false, Message = "Terminal Filter already exist!", Data = new List<object> { terminalFilter.FilterId, terminalFilter.FilterName } };

            bool result;

            using (var transactionContext = new TransactionContext())
            {
                result = cdDataProvider.CreateTerminalFilter(terminalFilter, transactionContext);

                if (result)
                {
                    transactionContext.Commit();
                }
            }

            return new OperationResult() { Result = result, Data = new List<object> { terminalFilter.FilterId } };
        }
예제 #6
0
 public WebOperationResult CreateTerminalFilter(FilterDefs terminalFilter)
 {
     return (WebOperationResult)webMessageHandler.CreateTerminalFilter(terminalFilter);
 }
예제 #7
0
 public WebOperationResult UpdateTerminalFilter(string filterId, FilterDefs terminalFilter)
 {
     return (WebOperationResult)webMessageHandler.UpdateTerminalFilter(filterId, terminalFilter);
 }