Esempio n. 1
0
 public UnitOfWork(ObservationDataContext context)
 {
     _context = context;
     ObservationRepository    = new ObservationRepository(_context);
     SequenceRepository       = new SequenceRepository(_context);
     WorkingSectionRepository = new WorkingSectionRepository(_context);
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Initialize();


            var rep = new SequenceRepository();
            var res = rep.GetLastSequence();

            var dto  = RandomGenerator.CreateValue();
            var diff = dto.Value - res?.Value ?? 0.0;

            res = rep.CreateSequence(new Sequence()
            {
                CreatedOn = dto.CreateOn, Value = dto.Value, Differential = diff
            });
        }
Esempio n. 3
0
 public UnitOfWork(VegaContext context)
 {
     _context             = context;
     Clients              = new ClientRepository(_context);
     Users                = new UserRepository(_context);
     Supplier             = new SupplierRepository(_context);
     Component            = new ComponentRepository(_context);
     ImportingInvoice     = new ImportingInvoiceRepository(_context);
     UGroup               = new GroupsRepository(_context);
     FabricationOrder     = new FabricationOrderRepository(_context);
     Expence              = new ExpenceRepository(_context);
     ExpenceCat           = new  ExpenceCatRepository(_context);
     GroupPermission      = new  GroupPermissionRepository(_context);
     Permission           = new PermissionRepository(_context);
     Sequence             = new SequenceRepository(_context);
     Nomenclature         = new NomenclatureRepository(_context);
     NomenclatureSequence = new NomenclatureSequenceRepository(_context);
     Color                = new ColorRepository(_context);
     SellingInvoices      = new SellingInvoicesRepository(_context);
     RawMaterials         = new RawMaterialsRepository(_context);
     UsedRawMaterial      = new UsedRawMaterialRepository(_context);
     ProgressionChecks    = new ProgressionChecksRepository(_context);
 }
Esempio n. 4
0
    // eg. /Games/Game/1
    public ActionResult Game(int id)
    {
        var SequenceModel = SequenceRepository.GetSequenceById(id); //some way of getting your model from the ID

        return(View(SequenceModel));
    }
        public async Task <string> index()
        {
            PostModel postModel = TypeChange.UrlToEntities <PostModel>(Request.QueryString.Value);

            if (!CheckSignature.Check(postModel.Signature, postModel.Timestamp, postModel.Nonce, appConfig.WeiXin.Token))
            {
                return("参数错误!");
            }
            else
            {
                Request.EnableBuffering();

                using (var reader = new StreamReader(Request.Body, encoding: Encoding.UTF8))
                {
                    var body = await reader.ReadToEndAsync();

                    var    xml          = TypeChange.XmlToDict(body);
                    String toUserName   = xml.GetValueOrDefault("ToUserName");
                    String fromUserName = xml.GetValueOrDefault("FromUserName");
                    String msgType      = xml.GetValueOrDefault("MsgType");
                    String content      = xml.GetValueOrDefault("Content");
                    String eventType    = xml.GetValueOrDefault("Event");
                    String eventKey     = xml.GetValueOrDefault("EventKey");
                    String ticket       = xml.GetValueOrDefault("Ticket");
                    await weiXin.saveLog(new WxQuestLogEntity
                    {
                        id           = await SequenceRepository.GetNextID <WxQuestLogEntity>(),
                        toUserName   = toUserName,
                        fromUserName = fromUserName,
                        msgType      = msgType,
                        content      = content,
                        eventType    = eventType,
                        eventKey     = eventKey,
                        ticket       = ticket,
                    });

                    if (MessageUtil.MESSAGE_EVENT.Equals(msgType))
                    {
                        switch (eventType.ToLower())
                        {
                        case "subscribe":     //订阅
                            if (!string.IsNullOrEmpty(fromUserName))
                            {
                                var userinfo = Helper.WeiChat.Utility.GetUserInfo(fromUserName);
                                await weiXin.saveUser(userinfo, new List <string> {
                                    "nickname", "headimgurl", "subscribe", "subscribe_time", "remark", "groupid", "tagidListStr", "subscribe_scene", "qr_scene", "qr_scene_str"
                                });
                            }
                            break;

                        case "unsubscribe":     //取消订阅
                            var unsubscribeUser = new WxUserEntity()
                            {
                                subscribe      = 0,
                                openid         = fromUserName,
                                subscribe_time = Helper.DataTimeHelper.getDateLongTimestamp(DateTime.Now)
                            };
                            await weiXin.saveUser(unsubscribeUser, new List <string> {
                                "subscribe", "subscribe_time"
                            });

                            break;

                        case "click":     //点击事件
                            String replay = "";
                            switch (eventKey)
                            {
                            case MessageUtil.CLICK_DOWNURL:
                                replay = MessageUtil.downloadApp();
                                break;

                            case MessageUtil.CLICK_ETC_INSTALL:
                                replay = MessageUtil.etcInstallPlace();
                                break;

                            case MessageUtil.CLICK_GetMoney:
                                replay = MessageUtil.etcGetMoney(fromUserName);
                                break;
                            }
                            string message = MessageUtil.initText(toUserName, fromUserName, replay);
                            return(message);

                        case "view":     //url类型
                            break;
                        }
                    }

                    // Do some processing with body…
                    // Reset the request body stream position so the next middleware can read it
                    Request.Body.Position = 0;
                    return("");
                }
            }
        }