Exemplo n.º 1
0
        public ActionResult Store(Table model)
        {
            if (ModelState.IsValid)
            {
                ViewBag.Message = "All inputs are Valid!";

                TableService.doCreateOrUpdate(model);
                SetFlash(Enum.FlashMessageType.Success, (model.Id == Guid.Empty) ? "successfully created" : "successfully updated");
                return(RedirectToAction("List", new { IDProject = model.ProjectID }));
            }
            return(View(model));
        }
 public IHttpActionResult SaveDetail(tablesd Record)
 {
     try
     {
         using (TableService obj = new TableService())
             return(Ok(obj.SaveDetail(Record)));
     }
     catch (Exception Ex)
     {
         return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.BadRequest, Ex.Message.ToString())));
     }
 }
Exemplo n.º 3
0
 public TableView(Staff member)
 {
     PendingLabels = new Dictionary <int, Label>();
     ReadyLabels   = new Dictionary <int, Label>();
     InitializeComponent();
     tableService        = new TableService();
     this.member         = member;
     Tmr_Refresh.Enabled = true;
     LoadLabels("RT[0-9]+", ReadyLabels);
     LoadLabels("PT[0-9]+", PendingLabels);
     CheckReadyServe();
 }
 public IHttpActionResult DeleteDetail(Dictionary <string, object> SearchData)
 {
     try
     {
         using (TableService obj = new TableService())
             return(Ok(obj.DeleteDetail(SearchData)));
     }
     catch (Exception Ex)
     {
         return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.BadRequest, Ex.Message.ToString())));
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Validate the view.
        /// </summary>
        /// <param name="engineImportService">The engine import service.</param>
        /// <param name="streamTypeService">supplies the types of streams against which to validate</param>
        /// <param name="methodResolutionService">for resolving imports and classes and methods</param>
        /// <param name="timeProvider">for providing current time</param>
        /// <param name="variableService">for access to variables</param>
        /// <param name="tableService"></param>
        /// <param name="scriptingService">The scripting service.</param>
        /// <param name="exprEvaluatorContext">The expression evaluator context.</param>
        /// <param name="configSnapshot">The config snapshot.</param>
        /// <param name="schedulingService">The scheduling service.</param>
        /// <param name="engineURI">The engine URI.</param>
        /// <param name="sqlParameters">The SQL parameters.</param>
        /// <param name="eventAdapterService">The event adapter service.</param>
        /// <param name="statementName">Name of the statement.</param>
        /// <param name="statementId">The statement id.</param>
        /// <param name="annotations">The annotations.</param>
        /// <throws>  ExprValidationException is thrown to indicate an exception in validating the view </throws>
        public void Validate(
            EngineImportService engineImportService,
            StreamTypeService streamTypeService,
            MethodResolutionService methodResolutionService,
            TimeProvider timeProvider,
            VariableService variableService,
            TableService tableService,
            ScriptingService scriptingService,
            ExprEvaluatorContext exprEvaluatorContext,
            ConfigurationInformation configSnapshot,
            SchedulingService schedulingService,
            string engineURI,
            IDictionary <int, IList <ExprNode> > sqlParameters,
            EventAdapterService eventAdapterService,
            string statementName,
            string statementId,
            Attribute[] annotations)
        {
            _evaluators           = new ExprEvaluator[_inputParameters.Count];
            _subordinateStreams   = new SortedSet <int>();
            _exprEvaluatorContext = exprEvaluatorContext;

            int count             = 0;
            var validationContext = new ExprValidationContext(
                streamTypeService, methodResolutionService, null, timeProvider, variableService, tableService,
                exprEvaluatorContext, eventAdapterService, statementName, statementId, annotations, null, scriptingService,
                false, false, true, false, null, false);

            foreach (string inputParam in _inputParameters)
            {
                ExprNode raw = FindSQLExpressionNode(_myStreamNumber, count, sqlParameters);
                if (raw == null)
                {
                    throw new ExprValidationException(
                              "Internal error find expression for historical stream parameter " + count + " stream " +
                              _myStreamNumber);
                }
                ExprNode evaluator = ExprNodeUtility.GetValidatedSubtree(ExprNodeOrigin.DATABASEPOLL, raw, validationContext);
                _evaluators[count++] = evaluator.ExprEvaluator;

                ExprNodeIdentifierCollectVisitor visitor = new ExprNodeIdentifierCollectVisitor();
                visitor.Visit(evaluator);
                foreach (ExprIdentNode identNode in visitor.ExprProperties)
                {
                    if (identNode.StreamId == _myStreamNumber)
                    {
                        throw new ExprValidationException("Invalid expression '" + inputParam +
                                                          "' resolves to the historical data itself");
                    }
                    _subordinateStreams.Add(identNode.StreamId);
                }
            }
        }
Exemplo n.º 6
0
        public ActionResult Index()
        {
            //--- Obtem da Tabela ---
            TableService tableService = new TableService();

            _images = tableService.GetAllImages().Select(url => new ImageViewModel()
            {
                Url = url
            });
            //-----------------------
            return(View(_images));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Index des tables pour un utilisateur
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult IndexTableForUser(Guid id)
        {
            var indexViewModel = new IndexViewModel();
            var user           = UserService.GetUserById(id);

            indexViewModel.IdUser           = user.Id;
            indexViewModel.TableUtilisateur = TableService.GetTablesFromUser(user.Id).Select(p => new TableUserViewModel
            {
                Name = p.Nom,
                Id   = p.Id,
            });
            return(View(indexViewModel));
        }
Exemplo n.º 8
0
        public JsonResult Delete(int id)
        {
            bool res = TableService.DeleteById(id);

            if (res)
            {
                TableUserRoleService.DeleteByWhere(" where TableId=" + id);
                TableRowService.DeleteByWhere(" where TableId=" + id);
            }
            var result = res ? SuccessTip("删除成功") : ErrorTip("删除失败");

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 9
0
 public OrderHub(TableService getTablesService,
                 OrderService orderService,
                 OrderPosService orderPosService,
                 AssignOrderService assignOrderService,
                 TabletService tabletService
                 )
 {
     this.getTablesService   = getTablesService;
     this.orderService       = orderService;
     this.orderPosService    = orderPosService;
     this.assignOrderService = assignOrderService;
     this.tabletService      = tabletService;
 }
Exemplo n.º 10
0
 private EventTableIndexMetadata GetIndexMetaRepo(bool namedWindow)
 {
     if (namedWindow)
     {
         var processor = NamedWindowMgmtService.GetProcessor("MyInfra");
         return(processor.EventTableIndexMetadataRepo);
     }
     else
     {
         var metadata = TableService.GetTableMetadata("MyInfra");
         return(metadata.EventTableIndexMetadataRepo);
     }
 }
Exemplo n.º 11
0
        public FullBugViewModel GetFullBugById(int bugId)
        {
            var bug          = _bugRepository.GetById(bugId);
            var fullbugModel = _mapper.Map <Bug, FullBugViewModel>(bug);
            var tableService = new TableService();
            var comments     = tableService.RetrieveAllCommentsForBug(bugId.ToString());

            if (comments.Count != 0)
            {
                fullbugModel.Comments = _mapper.Map <List <CommentModel>, List <CommentViewModel> >(comments);
            }

            return(fullbugModel);
        }
Exemplo n.º 12
0
        // GET: TableServices/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TableService tableService = db.TableServices.Find(id);

            if (tableService == null)
            {
                return(HttpNotFound());
            }
            return(View(tableService));
        }
        public ActionResult Store(DataFieldForeignKey model, Guid ProjectID)
        {
            if (ModelState.IsValid)
            {
                ViewBag.Message = "All inputs are Valid!";

                DataFieldForeignKeyService.doCreateOrUpdate(model);
                SetFlash(Enum.FlashMessageType.Success, (model.Id == Guid.Empty) ? "successfully created" : "successfully updated");
                return(RedirectToAction("Detail", "Database", new { id = model.TableViewID }));
            }
            ViewBag.DataFieldViewID = new SelectList(TableService.doGetListEntity(x => x.ProjectID == ProjectID).Item1, "Id", "Name");

            return(View("Form", model));
        }
Exemplo n.º 14
0
        public async Task CreateStorageAccountAndGetTableCollection()
        {
            _resourceGroup = await CreateResourceGroupAsync();

            string accountName = await CreateValidAccountNameAsync("teststoragemgmt");

            StorageAccountCollection storageAccountCollection = _resourceGroup.GetStorageAccounts();

            _storageAccount = (await storageAccountCollection.CreateOrUpdateAsync(accountName, GetDefaultStorageAccountParameters())).Value;
            _tableService   = _storageAccount.GetTableService();
            _tableService   = await _tableService.GetAsync();

            _tableCollection = _tableService.GetTables();
        }
        public static void Run([IoTHubTrigger("messages/events", Connection = "EventHubConnectionAppSetting")] string message, ILogger log, ExecutionContext context)
        {
            log.LogInformation($"IoT Hub trigger function processed a message: {message}");
            // telemetry.TrackTrace($"IoT Hub trigger function processed a message: {message}");
            //SetEnvironment(context, log);

            #region Storage connection

            var config = new ConfigurationBuilder()
                         .SetBasePath(context.FunctionAppDirectory)
                         //.AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
                         .AddEnvironmentVariables()
                         .Build();
            var storageConnectionString = config["Framework.Services.Storage.StorageConnectionString"];

            #endregion Storage connection

            log.LogInformation($"IoT Hub trigger function --- completed setting of environment");
            TableService tableService = new TableService(storageConnectionString);
            log.LogInformation($"IoT Hub trigger function --- Created new instance of tableService");
            if (message.Contains("|"))
            {
                var messageArray = message.Split("|");
                // Check if the message is for retrieved security code or created security code. 5 means it is retrieved, 4 means it is created.
                log.LogInformation($"IoT Hub trigger function --- splitted into message array");
                // Update data store for the created security code
                if (messageArray.Length == 4)
                {
                    log.LogInformation($"IoT Hub trigger function --- splitted into message array -- In the four");
                    var singleEntityTask = tableService.GetSingleEntityAsync <TwoFactorRequestEntity>("TwoFactorRequest", messageArray[0], messageArray[1]);
                    var retrievedEntity  = singleEntityTask.Result;
                    retrievedEntity.CreatedSecurityCode      = messageArray[3];
                    retrievedEntity.RequestCreationTimestamp = System.DateTime.Now.ToString();
                    log.LogInformation($"IoT Hub trigger function --- About toupdate tableService sync");
                    var updateEntityTask = tableService.UpdateEntityAsync("TwoFactorRequest", retrievedEntity);
                }

                // Update data store for the retrieved (validated) security code
                if (messageArray.Length == 5)
                {
                    log.LogInformation($"IoT Hub trigger function --- splitted into message array -- In the five");
                    var singleEntityTask = tableService.GetSingleEntityAsync <TwoFactorRequestEntity>("TwoFactorRequest", messageArray[0], messageArray[1]);
                    var retrievedEntity  = singleEntityTask.Result;
                    retrievedEntity.RetrievedSecurityCode     = messageArray[3];
                    retrievedEntity.RequestValidatedTimestamp = System.DateTime.Now.ToString();
                    log.LogInformation($"IoT Hub trigger function --- About toupdate tableService sync");
                    var updateEntityTask = tableService.UpdateEntityAsync("TwoFactorRequest", retrievedEntity);
                }
            }
        }
Exemplo n.º 16
0
        /// <summary>Ctor. </summary>
        /// <param name="variableService">variables</param>
        public StatementVariableRefImpl(VariableService variableService, TableService tableService)
        {
            _variableToStmt  = new Dictionary <String, ICollection <String> >().WithNullSupport();
            _stmtToVariable  = new Dictionary <String, ICollection <String> >().WithNullSupport();
            _mapLock         = ReaderWriterLockManager.CreateLock(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            _variableService = variableService;
            _tableService    = tableService;

            _configuredVariables = new HashSet <String>();
            foreach (KeyValuePair <String, VariableReader> entry in variableService.VariableReadersNonCP)
            {
                _configuredVariables.Add(entry.Key);
            }
        }
Exemplo n.º 17
0
        public void TestOrderHub()
        {
            var context            = MockContextFactory.Create();
            var getTablesService   = new TableService(new MockDataService(context));
            var orderService       = new OrderService(new MockDataService(context));
            var orderPosService    = new OrderPosService(new MockDataService(context), orderService);
            var assignOrderService = new AssignOrderService(new MockDataService(context));
            var tabletService      = new TabletService(new MockDataService(context));

            context.Table.Add(new Database.Models.Table
            {
                Id   = 12,
                Name = "Hera",
            });

            context.Tablet.Add(new Database.Models.Tablet
            {
                Id         = 7,
                Identifier = "Mira",
                Mode       = Database.Models.Mode.Guest
            });
            context.SaveChanges();

            var request = new CreateOrderRequest();

            request.TableId          = 12;
            request.TabletIdentifier = "Mira";

            var command = new Command <CreateOrderRequest>();

            command.RequestId = "123";
            command.Arguments = request;

            var called = false;

            var hub = new OrderHub(getTablesService, orderService, orderPosService, assignOrderService, tabletService);

            var responseType = "CreateOrderResponse";
            var action       = new Action <Command <CreateOrderResponse> >((response) =>
            {
                Assert.Equal(response.RequestId, command.RequestId);
                Assert.NotNull(response.Arguments.Order);
                called = true;
            });

            hub.Clients = MockHubFactory.CreateClients(responseType, action);
            hub.CreateOrderRequest(command);

            Assert.True(called);
        }
Exemplo n.º 18
0
 public BackWorker(MainFormOption mainFormOption)
 {
     this.pageSettingService  = new PageSettingService();
     this.headerFooterService = new HeaderFooterService();
     this.docInfoService      = new DocInfoService();
     this.textReplaceService  = new TextReplaceService();
     this.paragraphService    = new ParagraphService();
     this.imageService        = new ImageService();
     this.hyperLinkService    = new HyperLinkService();
     this.tableService        = new TableService();
     this.pdfService          = new PdfService();
     this.mainFormOption      = mainFormOption;
     this.logger = LogManager.GetCurrentClassLogger();
 }
Exemplo n.º 19
0
        private void btnLogIn_Click(object sender, EventArgs e)
        {
            TableService tableService = new TableService(new CoffeShopContext());

            if (tableService.Insert(tbNameTable.Text, cbbArea.Text))
            {
                MessageBox.Show("Thêm Thành Công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Dispose();
            }
            else
            {
                MessageBox.Show("Thất Bại", "Thông Báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 20
0
 public StatementContextEngineServices(
     String engineURI,
     EventAdapterService eventAdapterService,
     NamedWindowMgmtService namedWindowMgmtService,
     VariableService variableService,
     TableService tableService,
     EngineSettingsService engineSettingsService,
     ValueAddEventService valueAddEventService,
     ConfigurationInformation configSnapshot,
     MetricReportingServiceSPI metricReportingService,
     ViewService viewService,
     ExceptionHandlingService exceptionHandlingService,
     ExpressionResultCacheService expressionResultCacheService,
     StatementEventTypeRef statementEventTypeRef,
     TableExprEvaluatorContext tableExprEvaluatorContext,
     EngineLevelExtensionServicesContext engineLevelExtensionServicesContext,
     RegexHandlerFactory regexHandlerFactory,
     StatementLockFactory statementLockFactory,
     ContextManagementService contextManagementService,
     ViewServicePreviousFactory viewServicePreviousFactory,
     EventTableIndexService eventTableIndexService,
     PatternNodeFactory patternNodeFactory,
     FilterBooleanExpressionFactory filterBooleanExpressionFactory,
     TimeSourceService timeSourceService)
 {
     EngineURI                           = engineURI;
     EventAdapterService                 = eventAdapterService;
     NamedWindowMgmtService              = namedWindowMgmtService;
     VariableService                     = variableService;
     TableService                        = tableService;
     EngineSettingsService               = engineSettingsService;
     ValueAddEventService                = valueAddEventService;
     ConfigSnapshot                      = configSnapshot;
     MetricReportingService              = metricReportingService;
     ViewService                         = viewService;
     ExceptionHandlingService            = exceptionHandlingService;
     ExpressionResultCacheService        = expressionResultCacheService;
     StatementEventTypeRef               = statementEventTypeRef;
     TableExprEvaluatorContext           = tableExprEvaluatorContext;
     EngineLevelExtensionServicesContext = engineLevelExtensionServicesContext;
     RegexHandlerFactory                 = regexHandlerFactory;
     StatementLockFactory                = statementLockFactory;
     ContextManagementService            = contextManagementService;
     ViewServicePreviousFactory          = viewServicePreviousFactory;
     EventTableIndexService              = eventTableIndexService;
     PatternNodeFactory                  = patternNodeFactory;
     FilterBooleanExpressionFactory      = filterBooleanExpressionFactory;
     TimeSourceService                   = timeSourceService;
 }
        public void ListTablesDoesNotThrowAnException()
        {
            IAzure azure = new Azure()
            {
                Account = "marksandbox",
                SharedKey = "ELIDED"
            };

            var tableService = new TableService(azure);

            Trace.WriteLine("Working");

            Assert.That(() => tableService.ListAllTables(), Throws.Nothing);
            Assert.True(true);
        }
Exemplo n.º 22
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DataTable    yourDataTable = gridControl1.DataSource as DataTable;
            TableService tableService  = new TableService(new CoffeShopContext());

            if (tableService.updateTables(yourDataTable))
            {
                MessageBox.Show("Lưu Thành Công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Thất Bại", "Thông Báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
            }
            loadData();
        }
Exemplo n.º 23
0
        protected async Task CreateTable()
        {
            ShowErrors = false;
            var result = await TableService.Create(PokerTable);

            if (result.Successful)
            {
                BlazoredModal.Close();
            }
            else
            {
                Errors     = result.Errors;
                ShowErrors = true;
            }
        }
Exemplo n.º 24
0
        public void loadData()
        {
            btnDelete.Enabled = false;
            TableService tableService = new TableService(new CoffeShopContext());

            gridControl1.DataSource = tableService.GetAllTable();
            AreaService areaService = new AreaService(new CoffeShopContext());

            RepositoryItemComboBox _riEditor = new RepositoryItemComboBox();

            _riEditor.Items.AddRange(areaService.GetAllNameArea());
            gridControl1.RepositoryItems.Add(_riEditor);
            gridView1.Columns[4].ColumnEdit = _riEditor;
            btnDelete.Enabled = false;
        }
Exemplo n.º 25
0
 private static bool IsJoinWithTable(StatementSpecRaw statementSpecRaw, TableService tableService)
 {
     foreach (var stream in statementSpecRaw.StreamSpecs)
     {
         if (stream is FilterStreamSpecRaw)
         {
             var filter = (FilterStreamSpecRaw)stream;
             if (tableService.GetTableMetadata(filter.RawFilterSpec.EventTypeName) != null)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Exemplo n.º 26
0
        public JsonResult AddTable(ScadaTableModel model)
        {
            model.CreateTime   = DateTime.Now;
            model.CreateUserId = Operator.UserId;
            model.UpdateTime   = DateTime.Now;
            model.UpdateUserId = Operator.UserId;
            model.ColNum       = 26;
            List <int>    colWidths = new List <int>();
            List <string> colTitles = new List <string>();

            for (int i = 0; i < model.ColNum; i++)
            {
                colTitles.Add(ExcelConvert.ToName(i));
                colWidths.Add(120);
            }

            model.ColimnWidths = string.Join(",", colWidths.ToArray());
            model.ColumnTitles = string.Join(",", colTitles.ToArray());
            model.RowNum       = 100;
            model.FilterRule   = "";
            int  id    = 0;
            bool isres = TableService.Insert(model, out id);

            if (isres)
            {
                TableUserRoleService.DeleteByWhere(" where TableId=" + id);
                if (model.RoleUserID != null)
                {
                    string[] users = model.RoleUserID.Split(',');
                    for (int i = 0; i < users.Length; i++)
                    {
                        ScadaTableUserRoleModel role = new ScadaTableUserRoleModel();
                        role.CreateTime   = DateTime.Now;
                        role.CreateTime   = DateTime.Now;
                        role.CreateUserId = Operator.UserId;
                        role.UpdateTime   = DateTime.Now;
                        role.UpdateUserId = Operator.UserId;
                        role.SortCode     = i + 1;
                        role.TableId      = id;
                        role.UserId       = int.Parse(users[i]);
                        TableUserRoleService.Insert(role);
                    }
                }
            }
            var result = isres ? SuccessTip("添加成功") : ErrorTip("添加失败");

            return(Json(result));
        }
Exemplo n.º 27
0
        public ExprValidationContext(
            IContainer container,
            StreamTypeService streamTypeService,
            EngineImportService engineImportService,
            StatementExtensionSvcContext statementExtensionSvcContext,
            ViewResourceDelegateUnverified viewResourceDelegate,
            TimeProvider timeProvider,
            VariableService variableService,
            TableService tableService,
            ExprEvaluatorContext exprEvaluatorContext,
            EventAdapterService eventAdapterService,
            string statementName,
            int statementId,
            Attribute[] annotations,
            ContextDescriptor contextDescriptor,
            ScriptingService scriptingService,
            bool disablePropertyExpressionEventCollCache,
            bool allowRollupFunctions,
            bool allowBindingConsumption,
            bool isUnidirectionalJoin,
            string intoTableName,
            bool isFilterExpression)
        {
            Container                    = container;
            StreamTypeService            = streamTypeService;
            EngineImportService          = engineImportService;
            StatementExtensionSvcContext = statementExtensionSvcContext;
            ViewResourceDelegate         = viewResourceDelegate;
            TimeProvider                 = timeProvider;
            VariableService              = variableService;
            TableService                 = tableService;
            ExprEvaluatorContext         = exprEvaluatorContext;
            EventAdapterService          = eventAdapterService;
            StatementName                = statementName;
            StatementId                  = statementId;
            Annotations                  = annotations;
            ContextDescriptor            = contextDescriptor;
            ScriptingService             = scriptingService;
            IsDisablePropertyExpressionEventCollCache = disablePropertyExpressionEventCollCache;
            IsAllowRollupFunctions    = allowRollupFunctions;
            IsAllowBindingConsumption = allowBindingConsumption;
            IsResettingAggregations   = isUnidirectionalJoin;
            IntoTableName             = intoTableName;
            IsFilterExpression        = isFilterExpression;

            IsExpressionAudit       = AuditEnum.EXPRESSION.GetAudit(annotations) != null;
            IsExpressionNestedAudit = AuditEnum.EXPRESSION_NESTED.GetAudit(annotations) != null;
        }
Exemplo n.º 28
0
        public JsonResult TableDesignSave(string data, int id = 0)
        {
            JavaScriptSerializer js      = new JavaScriptSerializer(); //实例化一个能够序列化数据的类
            TableDesignModel     myModel = js.Deserialize <TableDesignModel>(data);
            ScadaTableRowsModel  model   = new ScadaTableRowsModel();

            model.Id              = 0;
            model.TableId         = id;
            model.CreateTime      = DateTime.Now;
            model.CreateUserId    = Operator.UserId;
            model.UpdateTime      = DateTime.Now;
            model.UpdateUserId    = Operator.UserId;
            model.FieldBackColors = js.Serialize(myModel.backcolor);
            model.FieldColors     = js.Serialize(myModel.fontcolor);
            model.FieldFontSizes  = js.Serialize(myModel.fontsize);
            model.FieldWeights    = js.Serialize(myModel.fontweight);
            model.FieldIOPaths    = js.Serialize(myModel.data);
            var rowModes = TableRowService.GetByWhere("where TableId=" + id);
            var result   = "保存失败";

            if (rowModes.Count() > 0)
            {
                var TableModel = TableService.GetById(id);
                if (TableModel != null)
                {
                    TableModel.ColimnWidths = myModel.columnwidth;
                    TableModel.ColumnTitles = myModel.columntitle;
                    TableService.UpdateById(TableModel);
                }
                model.Id = rowModes.First().Id;
                result   = TableRowService.UpdateById(model) ? "保存设计成功" : "保存失败";
            }
            else
            {
                var TableModel = TableService.GetById(id);
                if (TableModel != null)
                {
                    TableModel.ColimnWidths = myModel.columnwidth;
                    TableModel.ColumnTitles = myModel.columntitle;
                    TableService.UpdateById(TableModel);
                    model.Id      = 0;
                    model.TableId = TableModel.Id;
                    result        = TableRowService.Insert(model) ? "保存设计成功" : "保存失败";
                }
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 29
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <ITableRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Table>(null));
            var service = new TableService(mock.LoggerMock.Object,
                                           mock.RepositoryMock.Object,
                                           mock.ModelValidatorMockFactory.TableModelValidatorMock.Object,
                                           mock.BOLMapperMockFactory.BOLTableMapperMock,
                                           mock.DALMapperMockFactory.DALTableMapperMock);

            ApiTableResponseModel response = await service.Get(default(int));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Exemplo n.º 30
0
        public void Throw_WhenInvalidParameterAreProvided()
        {
            // Arrange
            var tableRepository   = new Mock <IEfRepository <Table> >();
            var productRepository = new Mock <IEfRepository <Product> >();
            var saveContext       = new Mock <ISaveContext>();

            ITableService tableService = new TableService(
                tableRepository.Object,
                productRepository.Object,
                saveContext.Object);

            // Act & Assert
            Assert.Throws <NullReferenceException>(() =>
                                                   tableService.GetTableByID(null));
        }
Exemplo n.º 31
0
        private void SetTable(List <Appointment> appointments)
        {
            if (appointments == null)
            {
                return;
            }

            if (_customer != null) // because we show all the customers appointments we don't need the filters
            {
                monthRadio.Visible = false;
                weekRadio.Visible  = false;
                dayRadio.Visible   = false;
            }

            TableService.SetData <Appointment>(ref appointmentTable, appointments, (string key) => _translator.Translate($"appointment.{key}"));
        }
Exemplo n.º 32
0
 public void ListsTables()
 {
     var helper = new AzureHelper
                      {
                          Account = "azuredecktest",
                          SharedKey =
                              "NXqAP07hSjgGiTlyCCcMoAYt4+NNd3qGT45HFgqOK2bqL4my1QFuGjVVa4NEQ8hXjLJEA0BERl8tNpPwEBZRng=="
                      };
     var tableService = new TableService(helper);
     var listTask = tableService.ListTablesAsync();
     listTask.Wait();
     Assert.False(listTask.IsFaulted);
     var list = listTask.Result.ToList();
     Assert.Equal(3, list.Count);
     Assert.Contains("foo", list);
     Assert.Contains("bar", list);
     Assert.Contains("quux", list);
 }