コード例 #1
0
 public ShareResponse(ShareModel resource) : base(resource)
 {
 }
コード例 #2
0
 // POST api/<controller>
 public void Post([FromBody] ShareModel entity)
 {
     _service.Add(entity);
 }
コード例 #3
0
        private void CompareExpectedResult(ShareModel result)
        {
            Assert.Equal("||localhost|smb1", result.Properties.ShareName);

            Assert.Equal("\\\\localhost\\smb1", result.Properties.UncPath);

            Assert.Equal(HealthStatus.Warning, result.Properties.HealthStatus);

            Assert.Equal((ulong)500, result.Properties.TotalCapacity);

            Assert.Equal((ulong)40, result.Properties.UsedCapacity);

            Assert.Equal((ulong)460, result.Properties.FreeCapacity);
        }
コード例 #4
0
 public Task CreateAsync(ShareModel model)
 => api.CreateBeingAsync(beingId, model);
コード例 #5
0
 public void Remove(ShareModel shares)
 {
     this._shares.DeleteOne <ShareModel>(i => i.id == shares.id);
 }
コード例 #6
0
 public Task CreateAsync(ShareModel model)
 => api.CreateEntryAsync(entryId, model);
コード例 #7
0
 public Task CreateAsync(ShareModel model)
 => api.CreateStoryAsync(storyId, model);
        public async Task Run([OrchestrationTrigger] IDurableOrchestrationContext context,
                              ILogger log)
        {
            var teamModel = context.GetInput <TeamModel>();

            await context.CallActivityAsync(nameof(SchedulingGroupsActivity), teamModel);

            var weeks = context.CurrentUtcDateTime.Date
                        .Range(_options.PastWeeks, _options.FutureWeeks, _options.StartDayOfWeek);

            // give the wfm provider connector the opportunity to prepare the data for the sync if necessary
            await context.CallActivityAsync(nameof(PrepareSyncActivity), new PrepareSyncModel
            {
                Type               = SyncType.Shifts,
                TeamId             = teamModel.TeamId,
                WfmId              = teamModel.WfmBuId,
                FirstWeekStartDate = weeks.Min(),
                LastWeekStartDate  = weeks.Max(),
                TimeZoneInfoId     = teamModel.TimeZoneInfoId
            });

            var weekModels = weeks
                             .Select(startDate => new WeekModel
            {
                StartDate      = startDate,
                WfmBuId        = teamModel.WfmBuId,
                TeamId         = teamModel.TeamId,
                TimeZoneInfoId = teamModel.TimeZoneInfoId
            });

            var weekTasks = weekModels
                            .Select(weekModel => context.CallSubOrchestratorAsync <bool>(nameof(ShiftsWeekOrchestrator), weekModel));

            var allTasks = Task.WhenAll(weekTasks);

            bool changesProcessed = false;

            try
            {
                var results = await allTasks;
                changesProcessed = results.Any(b => b);
            }
            finally
            {
                // always commit what we have successfully applied to Teams so far
                if (_options.DraftShiftsEnabled && changesProcessed)
                {
                    var shareModel = new ShareModel
                    {
                        TeamId    = teamModel.TeamId,
                        StartDate = weekModels.Min(w => w.StartDate),
                        EndDate   = weekModels.Max(w => w.StartDate).AddWeek()
                    };
                    await context.CallActivityAsync(nameof(ShareActivity), shareModel);
                }
            }

            if (allTasks.Status == TaskStatus.Faulted)
            {
                log.LogAggregateOrchestrationError(allTasks.Exception, teamModel, nameof(ShiftsOrchestrator));
            }
        }
コード例 #9
0
 public void Add(ShareModel entity)
 {
     _repository.Add(entity);
 }
コード例 #10
0
 public void Add(ShareModel entity)
 {
     db.Shares.Add(entity);
     db.SaveChanges();
 }
コード例 #11
0
 public void Update(ShareModel entity)
 {
     db.Entry(entity).State = EntityState.Modified;
     db.SaveChanges();
 }
コード例 #12
0
 public IActionResult Index(ShareModel model)
 {
    return View(model);
 }
コード例 #13
0
 public ActionResult Create(ShareModel share)
 {
     share.date = DateTime.Now.ToString("o", CultureInfo.InvariantCulture);
     this.shareService.Create(share);
     return(CreatedAtRoute("GetShare", new { id = share.id }, share));
 }
コード例 #14
0
 public Task <ShareResponseModel> PostShare(ShareModel share, Action <ShareResponseModel> callback = null)
 {
     return(restService.PostShare(share, callback));
 }
コード例 #15
0
 public ShareResponse(ShareModel resource) : base(resource)
 {
 }
コード例 #16
0
 public void Update(ShareModel entity)
 {
     _repository.Update(entity);
 }
コード例 #17
0
        protected async Task OnDeleteAsync(ShareModel model)
        {
            await api.DeleteAsync(model);

            await LoadAsync();
        }
コード例 #18
0
        private void StartResquestForSharePoster(ShareAction shareAction)
        {
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("babyId", PlayerPrefsUtil.GetBabyId());
            paramDict.Add("shareType", 2);
            paramDict.Add("medalGrade", mData.medalModel.medalGrade);
            HttpUtil.PostWithSign <string>(UrlConst.SharePoster, paramDict)
            .Subscribe(response =>
            {
                Log.I("图片地址: " + response);
                if (shareAction == ShareAction.Save)
                {
                    if (Application.platform == RuntimePlatform.Android)
                    {
                        NativeGallery.RequestPermission((result, action) =>
                        {
                            if (result == (int)NativeGallery.Permission.Granted)
                            {
                                AndroidForUnity.CallAndroidForSavePicToAlbum(response);
                                CommonUtil.toast("保存成功");
                            }
                        }, (int)NativeAction.Album);
                    }
                    else if (Application.platform == RuntimePlatform.IPhonePlayer)
                    {
                        IOSClientUtil.SaveImageToAlubmCallIOSClient(response);
                    }
                }
                else if (shareAction == ShareAction.Wechat)
                {
                    if (Application.platform == RuntimePlatform.Android)
                    {
                        ShareModel shareModel   = new ShareModel();
                        shareModel.imageUrl     = response;
                        shareModel.platformName = AppConst.SHARE_WECHAT;
                        shareModel.type         = AppConst.SHARE_IMAGE_TYPE;
                        shareModel.title        = AppConst.SHARE_TITLE;
                        if (mData.medalModel.isShare == 0)
                        {
                            shareModel.toastMessage = "分享成功+" + mData.medalModel.medalShareScore + "积分";
                        }
                        AndroidForUnity.CallAndroidForShare(SerializeHelper.ToJson(shareModel));
                    }
                    else if (Application.platform == RuntimePlatform.IPhonePlayer)
                    {
                        Dictionary <string, object> sharParmsDic = new Dictionary <string, object>();
                        sharParmsDic.Add("platformType", "WechatSession");
                        sharParmsDic.Add("shareType", "image");
                        sharParmsDic.Add("image", response);
                        if (mData.medalModel.isShare == 0)
                        {
                            string shareToastMessage = "分享成功+" + mData.medalModel.medalShareScore + "积分";
                            sharParmsDic.Add("shareToastMsg", shareToastMessage);
                        }
                        IOSClientUtil.ShareObjectCallIOSClient(SerializeHelper.ToJson(sharParmsDic));
                    }
                }
                else if (shareAction == ShareAction.WechatMoments)
                {
                    if (Application.platform == RuntimePlatform.Android)
                    {
                        ShareModel shareModel   = new ShareModel();
                        shareModel.imageUrl     = response;
                        shareModel.platformName = AppConst.SHARE_WECHAT_MOMENTS;
                        shareModel.type         = AppConst.SHARE_IMAGE_TYPE;
                        shareModel.title        = AppConst.SHARE_TITLE;
                        if (mData.medalModel.isShare == 0)
                        {
                            shareModel.toastMessage = "分享成功+" + mData.medalModel.medalShareScore + "积分";
                        }
                        AndroidForUnity.CallAndroidForShare(SerializeHelper.ToJson(shareModel));
                    }
                    else if (Application.platform == RuntimePlatform.IPhonePlayer)
                    {
                        Dictionary <string, object> sharParmsDic = new Dictionary <string, object>();
                        sharParmsDic.Add("platformType", "WechatTimeLine");
                        sharParmsDic.Add("shareType", "image");
                        sharParmsDic.Add("image", response);

                        if (mData.medalModel.isShare == 0)
                        {
                            string shareToastMessage = "分享成功+" + mData.medalModel.medalShareScore + "积分";
                            sharParmsDic.Add("shareToastMsg", shareToastMessage);
                        }
                        IOSClientUtil.ShareObjectCallIOSClient(SerializeHelper.ToJson(sharParmsDic));
                    }
                }
            }
                       , e =>
            {
                if (e is HttpException)
                {
                    HttpException http = e as HttpException;
                    Log.E("弹吐司" + http.Message);
                }
            }).AddTo(this);
        }
コード例 #19
0
 public Task DeleteAsync(ShareModel model)
 => api.DeleteEntryAsync(entryId, model);
コード例 #20
0
ファイル: HomeController.cs プロジェクト: chefuzi/chefuzi
        public ActionResult Share(int classtype = 0, long aboutid = 0)
        {
            ShareModel myShareModel = new ShareModel();

            myShareModel.ClassType  = classtype;//属于哪一个表的内容
            myShareModel.AboutTitle = "芮卡家园";
            //
            #region 根据类别取出分享的内容
            using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作
            {
                switch (classtype)
                {///1点一点;2听一听;3看一看;
                ///4课程讲解;5幼儿公开课;6教育技能;
                ///7操作说明;8教师社区;9精彩瞬间;
                case 1:    //点一点
                    #region 点一点
                    Child_Book_Click myChild_Book_Click = new Child_Book_Click();
                    myChild_Book_Click = myOperating.Child_Book_Click.FirstOrDefault(p => p.BookID == aboutid);
                    if (myChild_Book_Click != null)
                    {
                        myShareModel.AboutTitle = myChild_Book_Click.BookName;
                        if (!String.IsNullOrWhiteSpace(myChild_Book_Click.BookImage))
                        {
                            myShareModel.AboutImages = StaticVarClass.BookClickResourceUrl + myChild_Book_Click.BookImage;
                        }
                    }
                    #endregion
                    return(View("ShareClick", myShareModel));

                //break;
                case 2:    //2听一听
                    #region 听一听
                    Child_Audio_List myChild_Audio_List = new Child_Audio_List();
                    myChild_Audio_List = myOperating.Child_Audio_List.FirstOrDefault(p => p.AudioId == aboutid);
                    if (myChild_Audio_List != null)
                    {
                        myShareModel.AboutTitle = myChild_Audio_List.AudioTitle;
                        #region 取专辑图片
                        int AlibumId = myChild_Audio_List.AlbumId;
                        try
                        {
                            Child_Audio_Album myChild_Audio_Album = new Child_Audio_Album();
                            myChild_Audio_Album = myOperating.Child_Audio_Album.FirstOrDefault(p => p.AlbumId == AlibumId);
                            if (myChild_Audio_Album != null)
                            {
                                if (!String.IsNullOrWhiteSpace(myChild_Audio_Album.Anchor))
                                {
                                    myShareModel.AboutAuthor = myChild_Audio_Album.Anchor;
                                }
                                if (!String.IsNullOrWhiteSpace(myChild_Audio_Album.AlbumImage))
                                {
                                    myShareModel.AboutImages = StaticVarClass.myDomain + myChild_Audio_Album.AlbumImage;
                                }
                            }
                        }
                        catch { }
                        #endregion
                        if (!String.IsNullOrWhiteSpace(myChild_Audio_List.AudioUrl))
                        {
                            myShareModel.AboutAudio = StaticVarClass.myDomain + myChild_Audio_List.AudioUrl;
                        }
                        myShareModel.AboutContent = myChild_Audio_List.AudioWords;
                        DateTime myDateTime = DateTime.Now;
                        DateTime.TryParse(myChild_Audio_List.AddDate.ToString(), out myDateTime);
                        myShareModel.AddDate = myDateTime;
                    }
                    #endregion
                    break;

                case 3:    //3看一看
                    #region  一看
                    Child_Video_List myChild_Video_List = new Child_Video_List();
                    myChild_Video_List = myOperating.Child_Video_List.FirstOrDefault(p => p.VideoId == aboutid);
                    if (myChild_Video_List != null)
                    {
                        myShareModel.AboutTitle = myChild_Video_List.VideoTitle;
                        if (!String.IsNullOrWhiteSpace(myChild_Video_List.VideoImage))
                        {
                            myShareModel.AboutImages = StaticVarClass.myDomain + myChild_Video_List.VideoImage;
                        }
                        if (!String.IsNullOrWhiteSpace(myChild_Video_List.VideoUrl))
                        {
                            myShareModel.AboutVideo = StaticVarClass.myDomain + myChild_Video_List.VideoUrl;
                        }

                        myShareModel.AboutContent = myChild_Video_List.VideoDes;
                        DateTime myDateTime = DateTime.Now;
                        DateTime.TryParse(myChild_Video_List.AddDate.ToString(), out myDateTime);
                        myShareModel.AddDate = myDateTime;
                    }
                    #endregion
                    break;

                case 4:
                case 5:
                case 6:
                case 7:    //4课程讲解;5幼儿公开课;6教育技能;7操作说明
                    #region 教师视频
                    Teacher_Video_List myTeacher_Video_List = new Teacher_Video_List();
                    myTeacher_Video_List = myOperating.Teacher_Video_List.FirstOrDefault(p => p.VideoId == aboutid);
                    if (myTeacher_Video_List != null)
                    {
                        myShareModel.AboutTitle = myTeacher_Video_List.VideoTitle;
                        if (!String.IsNullOrWhiteSpace(myTeacher_Video_List.VideoImage))
                        {
                            myShareModel.AboutImages = StaticVarClass.myDomain + myTeacher_Video_List.VideoImage;
                        }
                        if (!String.IsNullOrWhiteSpace(myTeacher_Video_List.VideoUrl))
                        {
                            myShareModel.AboutVideo = StaticVarClass.myDomain + myTeacher_Video_List.VideoUrl;
                        }
                        myShareModel.AboutContent = myTeacher_Video_List.VideoDes;
                        DateTime myDateTime = DateTime.Now;
                        DateTime.TryParse(myTeacher_Video_List.AddDate.ToString(), out myDateTime);
                        myShareModel.AddDate = myDateTime;
                    }
                    #endregion
                    break;

                case 8:    //8教师社区
                    #region 教师社区
                    Teacher_Article myTeacher_Article = new Teacher_Article();
                    myTeacher_Article = myOperating.Teacher_Article.FirstOrDefault(p => p.ArticlId == aboutid);
                    if (myTeacher_Article != null)
                    {
                        myShareModel.AboutTitle = myTeacher_Article.ArticleTitle;
                        if (!String.IsNullOrWhiteSpace(myTeacher_Article.ArticleImages))
                        {
                            myShareModel.AboutImages = StaticVarClass.myDomain + myTeacher_Article.ArticleImages;
                        }
                        if (!String.IsNullOrWhiteSpace(myTeacher_Article.ArticleVideo))
                        {
                            myShareModel.AboutVideo = StaticVarClass.myDomain + myTeacher_Article.ArticleVideo;
                        }
                        myShareModel.AboutContent = myTeacher_Article.ArticleContent;
                        DateTime myDateTime = DateTime.Now;
                        DateTime.TryParse(myTeacher_Article.AddDate.ToString(), out myDateTime);
                        myShareModel.AddDate = myDateTime;
                    }
                    #endregion
                    break;

                case 9:    //9精彩瞬间
                    #region 精彩瞬间
                    Discover_Article myDiscover_Article = new Discover_Article();
                    myDiscover_Article = myOperating.Discover_Article.FirstOrDefault(p => p.ArticlId == aboutid);
                    if (myDiscover_Article != null)
                    {
                        myShareModel.AboutTitle   = myDiscover_Article.ArticleTitle;
                        myShareModel.AboutImages  = myDiscover_Article.ArticleImages;
                        myShareModel.AboutVideo   = myDiscover_Article.ArticleVideo;
                        myShareModel.AboutContent = myDiscover_Article.ArticleContent;
                        DateTime myDateTime = DateTime.Now;
                        DateTime.TryParse(myDiscover_Article.AddDate.ToString(), out myDateTime);
                        myShareModel.AddDate = myDateTime;
                    }
                    #endregion
                    break;
                }
            }
            #endregion

            return(View(myShareModel));
        }
コード例 #21
0
 public Task DeleteAsync(ShareModel model)
 => api.DeleteStoryAsync(storyId, model);
コード例 #22
0
        private void CompareExpectedResult(ShareModel result)
        {
            Assert.Equal(result.Properties.ShareName, "smb1");

            Assert.Equal(result.Properties.UncPath, "\\\\localhost\\smb1");

            Assert.Equal(result.Properties.HealthStatus, HealthStatus.Warning);

            Assert.Equal(result.Properties.TotalCapacity, (ulong)500);

            Assert.Equal(result.Properties.UsedCapacity, (ulong)40);

            Assert.Equal(result.Properties.FreeCapacity, (ulong)460);
        }
コード例 #23
0
 public Task DeleteAsync(ShareModel model)
 => api.DeleteBeingAsync(beingId, model);
コード例 #24
0
 public ShareModel Create(ShareModel share)
 {
     this._shares.InsertOne(share);
     return(share);
 }