Exemplo n.º 1
0
            public SomeModule()
            {
                _readModel = new ReadModel();

                For <EventMessage <SomethingHappened> >()
                .Handle(_ => _readModel.Count++);
            }
Exemplo n.º 2
0
    public ReadResult <TestData> Read(ReadModel readModel)
    {
        var readResult = new ReadResult <TestData>(datas);

        if (readModel.Filters.IsReady())
        {
            foreach (var filter in readModel.Filters)
            {
                readResult.Datas = readResult.Datas.Find(filter.Names, filter.Value, filter.Type).ToList();
            }
        }

        readResult.TotalRow = readResult.Datas.Count;

        if (readModel.Sorters.IsReady())
        {
            var orderDatas = readResult.Datas.OrderBy(readModel.Sorters[0].Name, readModel.Sorters[0].Type);
            for (int s = 1; s < readModel.Sorters.Count; s++)
            {
                orderDatas = orderDatas.OrderNext(readModel.Sorters[s].Name, readModel.Sorters[s].Type);
            }
            readResult.Datas = orderDatas.ToList();
        }

        if (readModel.Pager.IsReady())
        {
            readResult.Datas = readResult.Datas.Skip(readModel.Pager.Size * readModel.Pager.Index).Take(readModel.Pager.Size).ToList();
        }

        return(readResult);
    }
 public AddProductToBasketCommandHandler(IBasketRepository basketRepository,
                                         ReadModel product_repository,
                                         IBasketPricingService basket_pricing_service)
 {
     _basketRepository     = basketRepository;
     _basketPricingService = basket_pricing_service;
 }
Exemplo n.º 4
0
        //public ActionResult Footer()
        //{
        //    return View();
        //}
        // GET: Home
        public ActionResult Index(string id)
        {
            IEnumerable <Contacts> _lstContacts = new List <Contacts>();
            ReadModel _readModel = new ReadModel();

            _lstContacts = _readModel.ReadContacts(id, "MainWebsite");

            if (!String.IsNullOrEmpty(_readModel.ExceptionMessage))
            {
                ModelState.AddModelError("", _readModel.ExceptionMessage);
                TempData["ErrorMessage"] = _readModel.ExceptionMessage;
            }
            string _Contact = "";

            foreach (var contact in _lstContacts)
            {
                if (contact.IsExists)
                {
                    if (contact.Preference == "1")
                    {
                        foreach (var subitem in contact.LstContactInfo.Where(m => m.ContactType == "Phone"))
                        {
                            _Contact += subitem.Value;
                        }
                    }
                }
            }

            Session["Phone"] = _Contact;
            return(View(_lstContacts));
        }
Exemplo n.º 5
0
        public ActionResult SocialLinks()
        {
            IEnumerable <SocialLinks> _lstSocialLinks = new List <SocialLinks>();
            ReadModel _readModel = new ReadModel();

            _lstSocialLinks = _readModel.ReadSocialLinks();
            return(View(_lstSocialLinks));
        }
Exemplo n.º 6
0
            public SomeModule()
            {
                _readModel = new ReadModel();

                For<EventMessage<SomethingHappened>>()
                    .Handle(_ => _readModel.Count++);

            }
Exemplo n.º 7
0
        //public ActionResult VerticalMenu()
        //{
        //    return View();
        //}

        //public ActionResult Dashboard()
        //{
        //    if (Session["MenuList"] == null)
        //        return RedirectToAction("InsertMenu", "Insert", "Insert");
        //    return View();
        //}

        public ActionResult Footer()
        {
            IEnumerable <Services> _lstServices = new List <Services>();
            ReadModel _readModel = new ReadModel();

            _lstServices = _readModel.ReadServices();

            return(View(_lstServices));
        }
Exemplo n.º 8
0
        public ServiceResult <bool> Read(ReadModel model)
        {
            new ArticleComponent().Read(model.Id, this.GetMerchantAccountId(), model.Type);

            return(new ServiceResult <bool>
            {
                Data = true
            });
        }
Exemplo n.º 9
0
 public static UserModel FromReadModel(ReadModel.UserIndexItem item)
 {
     return new UserModel()
     {
         Id = item.Id,
         Username = item.Username,
         FirstName = item.FirstName,
         LastName = item.LastName,
         Email = item.Email,
         IsAdmin = item.IsAdmin
     };
 }
Exemplo n.º 10
0
        public IActionResult Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "user/{id}")]
            HttpRequest req,

            [SqlInputBinding(Query = "SELECT * FROM TestData WHERE Id = {id}")]
            ReadModel entity,
            ILogger log)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");

            return(new OkObjectResult(entity));
        }
Exemplo n.º 11
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            BundleTable.Bundles.RegisterTemplateBundles();

            ReadModel.RegisterHandlersInvenotryItemDetailView();
            ReadModel.RegisterHandlersInventoryListView();
        }
Exemplo n.º 12
0
        public ActionResult Contacts(string id)
        {
            IEnumerable <Contacts> _lstContacts = new List <Contacts>();
            ReadModel _readModel = new ReadModel();

            _lstContacts = _readModel.ReadContacts(id, "MainWebsite");

            if (!String.IsNullOrEmpty(_readModel.ExceptionMessage))
            {
                ModelState.AddModelError("", _readModel.ExceptionMessage);
                TempData["ErrorMessage"] = _readModel.ExceptionMessage;
            }
            return(View(_lstContacts));
        }
Exemplo n.º 13
0
        public ActionResult Edit(ReadModel.UserIndexItem item)
        {
            foreach (var property in item.Properties)
            {
                SetProperty(new Commanding.SetUserPropertyCommand
                                {
                    UserID = item.Id,
                    Name = property.Key,
                    Value = property.Value.Value
                });
            }

            return RedirectToAction("Details", new { id=item.Id });
        }
Exemplo n.º 14
0
    public void BeginNewGame()
    {
        ServerResponse response = PlayerController.BeginGame();

        if (!response.error)
        {
            ReadModel player = ModelRepository.Get(response.modelName, response.aggregateIdentifier);
            GameReducer.Reduce(ActionTypes.NEW_GAME_BEGUN, player);
            Debug.Log($"Success: New Player");
        }
        else
        {
            Debug.Log("Failed");
        }
    }
Exemplo n.º 15
0
    public void CreateCharacter(string characterName, string greeting)
    {
        ServerResponse response = CharacterController.CreateCharacter(characterName, greeting);

        if (!response.error)
        {
            ReadModel character = ModelRepository.Get(response.modelName, response.aggregateIdentifier);
            GameReducer.Reduce(ActionTypes.CHARACTER_CREATED, character);
            Debug.Log($"Success: New Character {name}");
        }
        else
        {
            Debug.Log("Failed");
        }
    }
Exemplo n.º 16
0
        public async Task <ObjectDetailsModel> Read(string typeIdentifier, [FromBody] ReadModel filters)
        {
            var type   = schemaRegistry.GetTypeByTypeIdentifier(typeIdentifier);
            var schema = schemaRegistry.GetSchemaByTypeIdentifier(typeIdentifier);
            var result = await schemaRegistry.GetConnector(typeIdentifier).Read(filters.Filters).ConfigureAwait(false);

            var typeInfo = TypeInfoExtractor.Extract(result, type, schema.PropertyDescriptionBuilder, schema.CustomPropertyConfigurationProvider);
            var obj      = ObjectsConverter.StoredToApi(typeInfo, type, result, schema.CustomPropertyConfigurationProvider);

            return(new ObjectDetailsModel
            {
                Object = obj,
                TypeInfo = typeInfo,
            });
        }
Exemplo n.º 17
0
        public ActionResult Services()
        {
            IEnumerable <Services> _lstServiceData = new List <Services>();
            ReadModel _readModel = new ReadModel();

            _lstServiceData = _readModel.ReadServices();

            if (!String.IsNullOrEmpty(_readModel.ExceptionMessage))
            {
                ModelState.AddModelError("", _readModel.ExceptionMessage);
                TempData["ErrorMessage"] = _readModel.ExceptionMessage;
            }

            return(View(_lstServiceData));
        }
Exemplo n.º 18
0
 public static void SetLogin(LogOnModel model, ReadModel.UserIndexItem user)
 {
     HttpContext.Current.Session.Add("UserID", user.Id);
     var ticket = new FormsAuthenticationTicket(
         1,
         user.Username,
         DateTime.UtcNow,
         DateTime.UtcNow.AddMinutes(60),
         model.RememberMe,
         user.SerializeRoles(),
         FormsAuthentication.FormsCookiePath);
     string hash = FormsAuthentication.Encrypt(ticket);
     HttpCookie cookie = new HttpCookie(
         FormsAuthentication.FormsCookieName,
         hash);
     if (ticket.IsPersistent) cookie.Expires = ticket.Expiration;
     HttpContext.Current.Response.Cookies.Add(cookie);
 }
Exemplo n.º 19
0
        //IEnumerable<MenuItem> _lstMenuData = new List<MenuItem>();
        //    LoginModel _loginModel = new LoginModel();

        //    if (ModelState.IsValid && Session["UserName"] != null)
        //    {
        //        _loginModel.UserName = Session["UserName"].ToString();
        //        _loginModel.RoleID = Session["RoleId"].ToString();

        //        _lstMenuData = _loginModel.ReadMenu();

        //        Session["MenuList"] = _lstMenuData;
        //        //if(_lstMenuData.ToList<MenuItem>().Count <= 0)
        //        //{
        //        //    return RedirectToAction("Menu", "Login", "Login");
        //        //}
        //    }
        //    else
        //    {
        //        ModelState.AddModelError("", _loginModel.ExceptionMessage);
        //        TempData["ErrorMessage"] = _loginModel.ExceptionMessage;
        //    }

        //    return View(_lstMenuData);

        public ActionResult Portfolio()
        {
            IEnumerable <Portfolio> _lstPortfolio = new List <Portfolio>();
            ReadModel _readModel = new ReadModel();

            _lstPortfolio = _readModel.ReadExistingPortfolio();

            //var PortfolioGrouped = from b in _lstPortfolio
            //                   group b by b.ServiceId into g
            //                   select new Group<string, Data.Portfolio> { Key = g.Key, Values = g };

            if (!String.IsNullOrEmpty(_readModel.ExceptionMessage))
            {
                ModelState.AddModelError("", _readModel.ExceptionMessage);
                TempData["ErrorMessage"] = _readModel.ExceptionMessage;
            }
            return(View(_lstPortfolio));
        }
Exemplo n.º 20
0
        private void Read(object obj)
        {
            ReadModel para = (ReadModel)obj;

            try
            {
                switch (para.BtnName)
                {
                case "btn_ReadInt16":
                    ShowMsgToReadRegion(mbClient.ReadInt16(para.Address).ToString());
                    break;

                case "btn_ReadInt32":
                    ShowMsgToReadRegion(mbClient.ReadInt32(para.Address).ToString());
                    break;

                case "btn_ReadUInt16":
                    ShowMsgToReadRegion(mbClient.ReadUInt16(para.Address).ToString());
                    break;

                case "btn_ReadUInt32":
                    ShowMsgToReadRegion(mbClient.ReadUInt32(para.Address).ToString());
                    break;

                case "btn_ReadCoil":
                    ShowMsgToReadRegion(mbClient.ReadCoil(para.Address).ToString());
                    break;

                case "btn_ReadFloat":
                    ShowMsgToReadRegion(mbClient.ReadFloat(para.Address).ToString());
                    break;

                case "btn_ReadDouble":
                    ShowMsgToReadRegion(mbClient.ReadDouble(para.Address).ToString());
                    break;

                default: return;
                }
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
            }
        }
Exemplo n.º 21
0
        private void ReadHandle(object sender, EventArgs e)
        {
            ReadModel readModel = new ReadModel();

            try
            {
                readModel.Address = Convert.ToInt32(tb_ReadAddr.Text, 16).ToString();
            }
            catch
            {
                ShowMsg("请输入正确的16进制地址");
                return;
            }
            try
            {
                Button btn = (Button)sender;
                readModel.BtnName = btn.Name;



                if (cb_ContinuousRead.Checked)
                {
                    if (ReadModel.threadTimer == null)
                    {
                        ReadModel.threadTimer     = new System.Threading.Timer(new System.Threading.TimerCallback(Read), readModel, 0, Convert.ToInt32(tb_period.Text));
                        ReadModel.IsRun           = true;
                        btn_ReadTimerStop.Enabled = true;
                        ShowMsg("已启用循环读取");
                    }
                }
                else
                {
                    Read(readModel);
                }
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
            }
        }
Exemplo n.º 22
0
 public static void CreateReadModelDB()
 {
     ReadModel.CreateReadModelSchema(container.GetInstance <ReadModelConnectionString>());
 }
        private void GenerateDummyData()
        {
            //Solo se carga en el modo diseño
            for (int i = 0; i < 150; i++)
            {
                var readModel = new ReadModel
                {
                    Email   = $"mail@prueba{i}.com",
                    Picture = "http://placehold.it/400x400",
                    Name    = $"Nombre : {i}",
                    Last    = $"Apellido : {i}",
                    Notices = new List <NoticeModel>
                    {
                        new NoticeModel
                        {
                            Date = RandomDay().ToString(),
                            Id   = i,
                            Tags = new List <string>
                            {
                                $"Tag - {i}",
                                $"Tag - {i - 5}"
                            },
                            Text =
                                "Ex cupidatat culpa consequat enim laborum in deserunt anim occaecat. Deserunt eiusmod quis occaecat id deserunt est voluptate do fugiat adipisicing. Ut laboris in magna adipisicing amet non nulla in. Duis irure qui mollit ea et amet esse tempor dolor reprehenderit do.",
                            Title = $"Titulo numero  : {i}",
                            Image = "http://placehold.it/400x400"
                        },
                        new NoticeModel
                        {
                            Date = RandomDay().ToString(),
                            Id   = i,
                            Tags = new List <string>
                            {
                                $"Tag - {i}",
                                $"Tag - {i - 5}"
                            },
                            Text =
                                "Ex cupidatat culpa consequat enim laborum in deserunt anim occaecat. Deserunt eiusmod quis occaecat id deserunt est voluptate do fugiat adipisicing. Ut laboris in magna adipisicing amet non nulla in. Duis irure qui mollit ea et amet esse tempor dolor reprehenderit do.",
                            Title = $"Titulo numero  : {i}",
                            Image = "http://placehold.it/400x400"
                        },
                        new NoticeModel
                        {
                            Date = RandomDay().ToString(),
                            Id   = i,
                            Tags = new List <string>
                            {
                                $"Tag - {i}",
                                $"Tag - {i - 5}"
                            },
                            Text =
                                "Ex cupidatat culpa consequat enim laborum in deserunt anim occaecat. Deserunt eiusmod quis occaecat id deserunt est voluptate do fugiat adipisicing. Ut laboris in magna adipisicing amet non nulla in. Duis irure qui mollit ea et amet esse tempor dolor reprehenderit do.",
                            Title = $"Titulo numero  : {i}",
                            Image = "http://placehold.it/400x400"
                        },
                        new NoticeModel
                        {
                            Date = RandomDay().ToString(),
                            Id   = i,
                            Tags = new List <string>
                            {
                                $"Tag - {i}",
                                $"Tag - {i - 5}"
                            },
                            Text =
                                "Ex cupidatat culpa consequat enim laborum in deserunt anim occaecat. Deserunt eiusmod quis occaecat id deserunt est voluptate do fugiat adipisicing. Ut laboris in magna adipisicing amet non nulla in. Duis irure qui mollit ea et amet esse tempor dolor reprehenderit do.",
                            Title = $"Titulo numero  : {i}",
                            Image = "http://placehold.it/400x400"
                        }
                    }
                };


                ReadModels.Add(readModel);
            }
            if (ReadModels != null && ReadModels.Count > 0)
            {
                this.SelectedRead = ReadModels.First();
            }
            //FilterText();
        }
 protected void Register(ReadModel readModel) => _readModels.Add(readModel);
Exemplo n.º 25
0
        public static void GenerateSchemaToFile(string schemaFile)
        {
            string data = ReadModel.ExportReadModelSchema(container.GetInstance <ReadModelConnectionString>());

            System.IO.File.WriteAllText(schemaFile, data.ToString());
        }
Exemplo n.º 26
0
 public void UpdateModel(string aggregateId, ReadModel update)
 {
     entries [aggregateId] = update;
 }
Exemplo n.º 27
0
 public void InsertModel(string aggregateId, ReadModel initialValue)
 {
     entries.Add(aggregateId, initialValue);
 }
Exemplo n.º 28
0
 public Task <ObjectDetailsModel> Read(string typeIdentifier, [FromBody] ReadModel filters)
 {
     return(impl.Read(typeIdentifier, filters));
 }
Exemplo n.º 29
0
 public MoneyTopUpEventHandler(ReadModel readModel)
 {
     _readModel = readModel;
 }
Exemplo n.º 30
0
 public MoneyWithdrawnEventHandler(ReadModel readModel)
 {
     _readModel = readModel;
 }
Exemplo n.º 31
0
 public BalanceController(EventStore eventStore, ReadModel readModel)
 {
     _eventStore = eventStore;
     _readModel  = readModel;
 }
Exemplo n.º 32
0
        public ActionResult Portfolio(HttpPostedFileBase file, Portfolio objPortfolio)
        {
            InsertModel _model = new InsertModel();

            ReadModel _readModel = new ReadModel();

            List <Services> _lstServices = _readModel.ReadServices();

            List <SelectListItem> list = new List <SelectListItem>();
            var servlst = (from c in _lstServices select c).ToArray();

            for (int i = 0; i < servlst.Length; i++)
            {
                list.Add(new SelectListItem
                {
                    Text  = servlst[i].ServiceName,
                    Value = servlst[i].ServiceId.ToString(),
                });
            }
            ViewData["ServiceLst"] = list;

            if (ModelState.IsValid && Session["UserName"] != null)
            {
                try
                {
                    if (file != null && file.ContentLength > 0)
                    {
                        string ImageName = objPortfolio.Title + "-" + objPortfolio.ServiceId + Path.GetExtension(file.FileName);

                        string path = Path.Combine(Server.MapPath("~/Content/images/Portfolio"),
                                                   ImageName);

                        file.SaveAs(path);

                        if (!objPortfolio.Link.StartsWith("http"))
                        {
                            string Link = objPortfolio.Link;
                            objPortfolio.Link = "http://" + Link;
                        }


                        objPortfolio.objImage           = new Image();
                        objPortfolio.objImage.ImagePath = "Content/images/Portfolio/" + ImageName;

                        objPortfolio.objImage.ImageName     = objPortfolio.Title;
                        objPortfolio.objImage.Description   = "Image is for Portfolio " + objPortfolio.Title;
                        objPortfolio.objImage.IsExists      = true;
                        objPortfolio.objImage.LastUpdatedBy = Session["UserName"].ToString();
                        objPortfolio.objImage.LastUpdatedOn = DateTime.Now;
                        objPortfolio.objImage.ImageType     = "PortfolioImage";

                        //objPortfolio.objServices = new Services();
                        //objPortfolio.objServices.ServiceId = objPortfolio.ServiceId;

                        objPortfolio.IsExists      = true;
                        objPortfolio.LastUpdatedBy = Session["UserName"].ToString();
                        objPortfolio.LastUpdatedOn = DateTime.Now;

                        if (_model.InsertPortfolio(objPortfolio))
                        {
                            TempData["ErrorMessage"] = "Saved";
                        }
                        else
                        {
                            ModelState.AddModelError("", _model.ExceptionMessage);

                            TempData["ErrorMessage"] = _model.ExceptionMessage;
                        }

                        ModelState.Clear();
                    }
                }
                catch (Exception exp)
                {
                    ModelState.AddModelError("Error in Inserting Portfolio", exp.Message.ToString());
                }
            }

            return(View());
        }
Exemplo n.º 33
0
    public static WebResult Read(ReadModel readModel)
    {
        var readResult = testProcess.Read(readModel);

        return(new WebResult(readResult));
    }
 public ReadViewModel()
 {
     readModel = new ReadModel();
 }