コード例 #1
0
 public Model.Request Map(Model.Request request,
                          Code customerCode,
                          Code groupCode,
                          HalalTeam halal,
                          Premise premise,
                          Characteristic characteristic,
                          RFA rfa,
                          Log log,
                          Attachment attachment,
                          RequestLineItem lineItem,
                          Review review,
                          ReviewLineItem reviewLineItem,
                          Characteristic lineItemChar)
 {
     return(InternalMap(request,
                        customerCode,
                        groupCode,
                        lineItem,
                        lineItemChar,
                        halal,
                        premise,
                        characteristic,
                        attachment,
                        rfa,
                        log,
                        review,
                        reviewLineItem));
 }
コード例 #2
0
 public Model.Request Map(Model.Request request,
                          RequestLineItem lineItem = null,
                          Premise premise          = null)
 {
     return(InternalMap(request,
                        lineItem: lineItem,
                        premise: premise
                        ));
 }
コード例 #3
0
 public Model.Request Map(Model.Request request,
                          Code customerCode        = null,
                          RequestLineItem lineItem = null,
                          Premise premise          = null,
                          RFA rfa = null,
                          Characteristic lineItemChar = null)
 {
     return(InternalMap(request,
                        customerCode,
                        lineItem: lineItem,
                        premise: premise,
                        rfa: rfa,
                        lineItemChar: lineItemChar));
 }
コード例 #4
0
        public async Task <Model.Request> GetRequestByRefID(string refID)
        {
            var param = new DynamicParameters();

            param.Add("@RefID", refID);

            var mapper = new RequestMapper();

            return((await SqlMapper.QueryAsync(_unitOfWork.Connection,
                                               "GetRequestByRefID",
                                               new[]
            {
                typeof(Model.Request),
                typeof(HalalTeam),
                typeof(Premise),
                typeof(Characteristic),
                typeof(RFA),
                typeof(Log),
                typeof(Attachment),
                typeof(RequestLineItem),
                typeof(Review),
                typeof(ReviewLineItem),
                typeof(Characteristic)
            },
                                               obj =>
            {
                Model.Request re = obj[0] as Model.Request;
                HalalTeam ha = obj[1] as HalalTeam;
                Premise pr = obj[2] as Premise;
                Characteristic ch = obj[3] as Characteristic;
                RFA r = obj[4] as RFA;
                Log l = obj[5] as Log;
                Attachment att = obj[6] as Attachment;
                RequestLineItem rli = obj[7] as RequestLineItem;
                Review rev = obj[8] as Review;
                ReviewLineItem revli = obj[9] as ReviewLineItem;
                Characteristic licha = obj[10] as Characteristic;

                return mapper.Map(re, null, null, ha, pr, ch, r, l, att, rli, rev, revli, licha);
            },
                                               param,
                                               splitOn: "ID,HalalTeamID,PremiseID,CharID,RFAID,LogID,AttID,LineItemID,ReviewID," +
                                               "ReviewLineItemID,LiCharID",
                                               commandType: CommandType.StoredProcedure,
                                               transaction: _unitOfWork.Transaction)).FirstOrDefault());
        }
コード例 #5
0
        public async Task <long> UpdateRequestLineItem(RequestLineItem requestLineItem, long RequestID)
        {
            var param = new DynamicParameters();

            param.Add("@Scheme", requestLineItem.Scheme);
            param.Add("@SubScheme", requestLineItem.SubScheme);
            param.Add("@RequestID", RequestID);
            param.Add("@IsDeleted", requestLineItem.IsDeleted);
            param.Add("@ID", dbType: DbType.Int64, direction: ParameterDirection.Output);

            await SqlMapper.ExecuteAsync(_unitOfWork.Connection,
                                         "UpdateReqLineItem",
                                         param,
                                         commandType : CommandType.StoredProcedure,
                                         transaction : _unitOfWork.Transaction);

            var lineItemID = param.Get <long>("ID");

            return(lineItemID);
        }
コード例 #6
0
ファイル: DataConverter.cs プロジェクト: israelsam/Qantler
 public static void ToRequestLineItemCharacteristicData(
     RequestLineItem requestLineItem, int requestLineItemIndex,
     DataTable lineItemCharacteristic)
 {
     if (requestLineItem.Characteristics != null)
     {
         int j = 0;
         foreach (Characteristic ch in requestLineItem.Characteristics)
         {
             lineItemCharacteristic.Rows.Add(
                 ch.Type,
                 ch.Value,
                 j = j + 1,
                 requestLineItemIndex,
                 ch.CreatedOn,
                 ch.ModifiedOn
                 );
         }
     }
 }
コード例 #7
0
        Model.Request InternalMap(Model.Request request,
                                  Code customerCode             = null,
                                  Code groupCode                = null,
                                  RequestLineItem lineItem      = null,
                                  Characteristic lineItemChar   = null,
                                  HalalTeam halalTeam           = null,
                                  Premise premise               = null,
                                  Characteristic characteristic = null,
                                  Attachment attachment         = null,
                                  RFA rfa       = null,
                                  Log log       = null,
                                  Review review = null,
                                  ReviewLineItem reviewLineItem = null)
        {
            if (!_cache.TryGetValue(request.ID, out Model.Request result))
            {
                _cache[request.ID] = request;
                result             = request;
            }

            if ((customerCode?.ID ?? 0) > 0)
            {
                result.CustomerCode = customerCode;
            }

            if ((groupCode?.ID ?? 0) > 0)
            {
                result.GroupCode = groupCode;
            }

            RequestLineItem outLineItem = null;

            if ((lineItem?.ID ?? 0L) != 0L &&
                !_lineItemCache.TryGetValue(lineItem.ID, out outLineItem))
            {
                if (result.LineItems == null)
                {
                    result.LineItems = new List <RequestLineItem>();
                }
                result.LineItems.Add(lineItem);

                _lineItemCache[lineItem.ID] = lineItem;
                outLineItem = lineItem;
            }

            if (outLineItem != null &&
                (lineItemChar?.ID ?? 0L) != 0L &&
                !_lineItemCharCache.ContainsKey(lineItemChar.ID))
            {
                if (outLineItem.Characteristics == null)
                {
                    outLineItem.Characteristics = new List <Characteristic>();
                }

                _lineItemCharCache[lineItemChar.ID] = lineItemChar;
                outLineItem.Characteristics.Add(lineItemChar);
            }

            if ((halalTeam?.ID ?? 0L) != 0L &&
                !_halalCache.ContainsKey(halalTeam.ID))
            {
                _halalCache[halalTeam.ID] = halalTeam;

                if (result.Teams == null)
                {
                    result.Teams = new List <HalalTeam>();
                }
                result.Teams.Add(halalTeam);
            }

            if ((premise?.ID ?? 0L) != 0L &&
                result.Premises?.FirstOrDefault(e => e.ID == premise.ID) == null)
            {
                if (result.Premises == null)
                {
                    result.Premises = new List <Premise>();
                }

                result.Premises.Add(premise);
            }

            if ((characteristic?.ID ?? 0L) != 0L &&
                !_characteristicsCache.ContainsKey(characteristic.ID))
            {
                _characteristicsCache[characteristic.ID] = characteristic;

                if (result.Characteristics == null)
                {
                    result.Characteristics = new List <Characteristic>();
                }
                result.Characteristics.Add(characteristic);
            }

            if ((attachment?.ID ?? 0L) != 0L &&
                !_attachmentCache.ContainsKey(attachment.ID))
            {
                _attachmentCache[attachment.ID] = attachment;

                if (result.Attachments == null)
                {
                    result.Attachments = new List <Attachment>();
                }
                result.Attachments.Add(attachment);
            }

            if ((rfa?.ID ?? 0L) != 0L &&
                !_rfaCache.ContainsKey(rfa.ID))
            {
                _rfaCache[rfa.ID] = rfa;

                if (result.RFAs == null)
                {
                    result.RFAs = new List <RFA>();
                }
                result.RFAs.Add(rfa);
            }

            if ((log?.ID ?? 0L) != 0L &&
                !_logCache.ContainsKey(log.ID))
            {
                _logCache[log.ID] = log;

                if (result.Logs == null)
                {
                    result.Logs = new List <Log>();
                }
                result.Logs.Add(log);
            }


            Review outReview = null;

            if ((review?.ID ?? 0L) != 0L &&
                !_reviewCache.TryGetValue(review.ID, out outReview))
            {
                if (result.Reviews == null)
                {
                    result.Reviews = new List <Review>();
                }
                result.Reviews.Add(review);

                _reviewCache[review.ID] = review;
                outReview = review;
            }

            if (outReview != null &&
                (reviewLineItem?.ID ?? 0L) != 0L &&
                !_reviewLineItemCache.ContainsKey(reviewLineItem.ID))
            {
                _reviewLineItemCache[reviewLineItem.ID] = reviewLineItem;

                if (outReview.LineItems == null)
                {
                    outReview.LineItems = new List <ReviewLineItem>();
                }
                outReview.LineItems.Add(reviewLineItem);
            }

            return(result);
        }