コード例 #1
0
ファイル: JobBll.cs プロジェクト: zluckymn/Remote.Quartz.Jobs
        /// <summary>
        /// 执行更新操作
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public InvokeResult Update(BsonDocument doc)
        {
            var storageData = new StorageData()
            {
                Name = tableName, Document = doc, Type = StorageType.Update, Query = Query.EQ(keyFieldName, doc.Text(keyFieldName))
            };

            //调用基类的_commonDbChangeHelper进行保存
            // var result = CommonDbChangeHelper.CommonSubmitChange(storageData);
            if (CommonDbChangeHelper.NeedQueue)
            {
                var result = NetQHelper.Broadcast <string>(doc.ToJson());
                return(new InvokeResult()
                {
                    Status = Status.Successful
                });
            }
            else
            {
                var result = CommonDbChangeHelper.CommonSubmitChange(storageData);
                return(new InvokeResult()
                {
                    Status = Status.Successful
                });
            }
        }
コード例 #2
0
        /// <summary>
        /// 执行更新操作
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public InvokeResult SubmitChangeViaQueue(StorageData doc)
        {
            var success = NetQHelper.Broadcast <StorageDataForSerialize>(doc.ToStorageDataForSerialize());

            return(new InvokeResult()
            {
                Status = success ? Status.Successful:Status.Failed
            });
        }