Example #1
0
 /// <summary>
 /// get as an asynchronous operation.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <returns>Task&lt;MethodReturnResult&lt;PointDetail&gt;&gt;.</returns>
 public async Task <MethodReturnResult <PointDetail> > GetAsync(PointDetailKey key)
 {
     return(await Task.Run <MethodReturnResult <PointDetail> >(() =>
     {
         return base.Channel.Get(key);
     }));
 }
Example #2
0
 /// <summary>
 /// delete as an asynchronous operation.
 /// </summary>
 /// <param name="key">采集点设置明细标识符.</param>
 /// <returns>Task&lt;MethodReturnResult&gt;.</returns>
 public async Task <MethodReturnResult> DeleteAsync(PointDetailKey key)
 {
     return(await Task.Run <MethodReturnResult>(() =>
     {
         return base.Channel.Delete(key);
     }));
 }
Example #3
0
        /// <summary>
        /// 删除采集点设置明细。
        /// </summary>
        /// <param name="key">采集点设置明细标识符。</param>
        /// <returns><see cref="MethodReturnResult" />.</returns>
        public MethodReturnResult Delete(PointDetailKey key)
        {
            MethodReturnResult result = new MethodReturnResult();

            if (!this.PointDetailDataEngine.IsExists(key))
            {
                result.Code    = 1002;
                result.Message = String.Format(StringResource.PointDetailService_IsNotExists, key);
                return(result);
            }
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    Point p = this.PointDataEngine.Get(key.PointKey);
                    //根据采集设置组名获取记录
                    PagingConfig cfg = new PagingConfig()
                    {
                        IsPaging = false,
                        Where    = string.Format(@"EXISTS(From Point as p 
                                                       WHERE p.Key=self.Key.PointKey 
                                                       AND p.GroupName='{0}')
                                                AND Key.ParameterName='{1}'"
                                                 , p.GroupName
                                                 , key.ParameterName)
                    };
                    IList <PointDetail> lstPointDetail = this.PointDetailDataEngine.Get(cfg);
                    foreach (PointDetail item in lstPointDetail)
                    {
                        this.PointDetailDataEngine.Delete(item.Key);
                    }

                    this.PointDetailDataEngine.Delete(key);

                    ts.Complete();
                }
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = String.Format(StringResource.OtherError, ex.Message);
            }
            return(result);
        }
Example #4
0
        /// <summary>
        /// 获取采集点设置明细数据。
        /// </summary>
        /// <param name="key">采集点设置明细标识符.</param>
        /// <returns><see cref="MethodReturnResult&lt;PointDetail&gt;" />,采集点设置明细数据.</returns>
        public MethodReturnResult <PointDetail> Get(PointDetailKey key)
        {
            MethodReturnResult <PointDetail> result = new MethodReturnResult <PointDetail>();

            if (!this.PointDetailDataEngine.IsExists(key))
            {
                result.Code    = 1002;
                result.Message = String.Format(StringResource.PointDetailService_IsNotExists, key);
                return(result);
            }
            try
            {
                result.Data = this.PointDetailDataEngine.Get(key);
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = String.Format(StringResource.OtherError, ex.Message);
            }
            return(result);
        }
Example #5
0
 /// <summary>
 /// 获取采集点设置明细数据。
 /// </summary>
 /// <param name="key">采集点设置明细标识符.</param>
 /// <returns><see cref="MethodReturnResult&lt;PointDetail&gt;" />,采集点设置明细数据.</returns>
 public MethodReturnResult <PointDetail> Get(PointDetailKey key)
 {
     return(base.Channel.Get(key));
 }
Example #6
0
 /// <summary>
 /// 删除采集点设置明细。
 /// </summary>
 /// <param name="key">采集点设置明细标识符。</param>
 /// <returns><see cref="MethodReturnResult" />.</returns>
 public MethodReturnResult Delete(PointDetailKey key)
 {
     return(base.Channel.Delete(key));
 }