Exemple #1
0
        public static bool MapRequestSearchAsInput(RequestSearchDTO requestSearchDTO)
        {
            bool result = default(bool);

            _RequestSearch = new RequestSearch();

            try
            {
                if (requestSearchDTO != null)
                {
                    _RequestSearch.Id            = requestSearchDTO.Id;
                    _RequestSearch.requestNumber = requestSearchDTO.requestNumber;

                    if (requestSearchDTO.totalQuantity != 0)
                    {
                        _RequestSearch.totalQuantity = requestSearchDTO.totalQuantity;
                    }

                    if (requestSearchDTO.customerID != null && requestSearchDTO.customerID.Id != 0)
                    {
                        _RequestSearch.customerID = requestSearchDTO.customerID.Id;
                    }

                    if (requestSearchDTO.creationUserID != null && requestSearchDTO.creationUserID.Id != 0)
                    {
                        _RequestSearch.creationUserID = requestSearchDTO.creationUserID.Id;
                    }

                    if (requestSearchDTO.approvalUserID != null && requestSearchDTO.approvalUserID.Id != 0)
                    {
                        _RequestSearch.approvalUserID = requestSearchDTO.approvalUserID.Id;
                    }

                    if (requestSearchDTO.receiveUserID != null && requestSearchDTO.receiveUserID.Id != 0)
                    {
                        _RequestSearch.receiveUserID = requestSearchDTO.receiveUserID.Id;
                    }

                    if (requestSearchDTO.rejectionUserID != null && requestSearchDTO.rejectionUserID.Id != 0)
                    {
                        _RequestSearch.rejectionUserID = requestSearchDTO.rejectionUserID.Id;
                    }

                    if (requestSearchDTO.rejectionReasonID != null && requestSearchDTO.rejectionReasonID.Id != 0)
                    {
                        _RequestSearch.rejectionReasonID = requestSearchDTO.rejectionReasonID.Id;
                    }

                    if (requestSearchDTO.requestTypeID != null && requestSearchDTO.requestTypeID.Id != 0)
                    {
                        _RequestSearch.requestTypeID = requestSearchDTO.requestTypeID.Id;
                    }

                    if (requestSearchDTO.requestStatusID != null && requestSearchDTO.requestStatusID.Id != 0)
                    {
                        _RequestSearch.requestStatusID = requestSearchDTO.requestStatusID.Id;
                    }

                    if (requestSearchDTO.requestCalssID != null && requestSearchDTO.requestCalssID.Id != 0)
                    {
                        _RequestSearch.requestCalssID = requestSearchDTO.requestCalssID.Id;
                    }

                    if (requestSearchDTO.requestPriorityID != null && requestSearchDTO.requestPriorityID.Id != 0)
                    {
                        _RequestSearch.requestPriorityID = requestSearchDTO.requestPriorityID.Id;
                    }


                    if (!string.IsNullOrWhiteSpace(requestSearchDTO.PDDFromString))
                    {
                        _RequestSearch.PDDFrom = Formatter.formatStringtoDate(requestSearchDTO.PDDFromString);
                    }

                    if (!string.IsNullOrWhiteSpace(requestSearchDTO.PDDToString))
                    {
                        _RequestSearch.PDDTo = Formatter.formatStringtoDate(requestSearchDTO.PDDToString);
                    }

                    if (!string.IsNullOrWhiteSpace(requestSearchDTO.creationDateFromString))
                    {
                        _RequestSearch.creationDateFrom = Formatter.formatStringtoDate(requestSearchDTO.creationDateFromString);
                    }

                    if (!string.IsNullOrWhiteSpace(requestSearchDTO.creationDateToString))
                    {
                        _RequestSearch.creationDateTo = Formatter.formatStringtoDate(requestSearchDTO.creationDateToString);
                    }

                    if (!string.IsNullOrWhiteSpace(requestSearchDTO.approvalDateFromString))
                    {
                        _RequestSearch.approvalDateFrom = Formatter.formatStringtoDate(requestSearchDTO.approvalDateFromString);
                    }

                    if (!string.IsNullOrWhiteSpace(requestSearchDTO.approvalDateToString))
                    {
                        _RequestSearch.approvalDateTo = Formatter.formatStringtoDate(requestSearchDTO.approvalDateToString);
                    }

                    if (!string.IsNullOrWhiteSpace(requestSearchDTO.receiveDateFromString))
                    {
                        _RequestSearch.receiveDateFrom = Formatter.formatStringtoDate(requestSearchDTO.receiveDateFromString);
                    }

                    if (!string.IsNullOrWhiteSpace(requestSearchDTO.receiveDateToString))
                    {
                        _RequestSearch.receiveDateTo = Formatter.formatStringtoDate(requestSearchDTO.receiveDateToString);
                    }

                    if (!string.IsNullOrWhiteSpace(requestSearchDTO.rejectionDateFromString))
                    {
                        _RequestSearch.rejectionDateFrom = Formatter.formatStringtoDate(requestSearchDTO.rejectionDateFromString);
                    }

                    if (!string.IsNullOrWhiteSpace(requestSearchDTO.rejectionDateToString))
                    {
                        _RequestSearch.rejectionDateTo = Formatter.formatStringtoDate(requestSearchDTO.rejectionDateToString);
                    }

                    if (requestSearchDTO.cardTypeDTO != null)
                    {
                        _RequestSearch.cardTypeID = requestSearchDTO.cardTypeDTO.Id;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(result);
        }
Exemple #2
0
        private static RequestDTO mapRequest(Request request)
        {
            RequestDTO _RequestMap = new RequestDTO();

            _RequestMap.Id            = request.Id;
            _RequestMap.requestNumber = request.requestNumber;

            if (request.totalQuantity != null)
            {
                _RequestMap.totalQuantity = request.totalQuantity.Value;
            }

            if (request.PDD != null)
            {
                _RequestMap.PDD = Formatter.formatDatetoString(request.PDD.Value);
            }

            _RequestMap.customerID = fillCustomerDTObyCustomerID(request.customerID);

            if (request.creationDate != null)
            {
                _RequestMap.creationDate = Formatter.formatDatetoString(request.creationDate.Value); // Format Date as required by FE
            }
            _RequestMap.creationUserID = fillUserDTObyUserID(request.creationUserID);

            if (request.approvalDate != null)
            {
                _RequestMap.approvalDate = Formatter.formatDatetoString(request.approvalDate.Value);
            }

            _RequestMap.approvalUserID = fillUserDTObyUserID(request.approvalUserID);

            if (request.receiveDate != null)
            {
                _RequestMap.receiveDate = Formatter.formatDatetoString(request.receiveDate.Value);
            }

            _RequestMap.receiveUserID = fillUserDTObyUserID(request.receiveUserID);

            if (request.rejectionDate != null)
            {
                _RequestMap.rejectionDate = Formatter.formatDatetoString(request.rejectionDate.Value);
            }

            if (request.rejectionUserID != null)
            {
                _RequestMap.rejectionUserID = fillUserDTObyUserID(request.rejectionUserID);
            }

            if (request.rejectionReasonID != null)
            {
                _RequestMap.rejectionReasonID = fillRejectionReasonDTObyReasonID(request.rejectionReasonID);
            }

            if (request.requestTypeID != null)
            {
                _RequestMap.requestTypeID = fillRequestTypeDTObyRequestTypeID(request.requestTypeID);
            }

            if (request.requestStatusID != null)
            {
                _RequestMap.requestStatusID = fillRequestStatusDTObyRequestStatusID(request.requestStatusID);
            }

            if (request.requestCalssID != null)
            {
                _RequestMap.requestCalssID = fillRequestClassDTObyRequestClassID(request.requestCalssID);
            }

            if (request.requestPriorityID != null)
            {
                _RequestMap.requestPriorityID = fillRequestPriorityDTObyRequestPriorityID(request.requestPriorityID);
            }

            _RequestMap.RequestDetailList = fillRequestDetailDto(request.Id);

            return(_RequestMap);
        }
Exemple #3
0
        public static bool MapRequestAsInput(RequestDTO requestDTO)
        {
            bool result = default(bool);

            _Request = new Request();
            _RequestDetailListInput = new List <RequestDetail>();
            RequestDetail _RequestDetailTemp = default(RequestDetail);

            try
            {
                if (requestDTO != null)
                {
                    // Request Data Part
                    _Request.Id            = requestDTO.Id;
                    _Request.requestNumber = requestDTO.requestNumber;
                    _Request.totalQuantity = requestDTO.totalQuantity;

                    _Request.PDD = Formatter.formatStringtoDate(requestDTO.PDD); // DateTime.ParseExact(requestDTO.PDD, "yyyy-MM-dd", CultureInfo.InvariantCulture);

                    if (requestDTO.customerID != null)
                    {
                        _Request.customerID = requestDTO.customerID.Id;
                    }

                    _Request.creationDate = Formatter.formatStringtoDate(requestDTO.creationDate); // DateTime.ParseExact(requestDTO.creationDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);

                    if (requestDTO.creationUserID != null)
                    {
                        _Request.creationUserID = requestDTO.creationUserID.Id;
                    }

                    _Request.approvalDate = Formatter.formatStringtoDate(requestDTO.approvalDate); //DateTime.ParseExact(requestDTO.approvalDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);

                    if (requestDTO.approvalUserID != null)
                    {
                        _Request.approvalUserID = requestDTO.approvalUserID.Id;
                    }

                    _Request.receiveDate = Formatter.formatStringtoDate(requestDTO.receiveDate); //DateTime.ParseExact(requestDTO.receiveDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);

                    if (requestDTO.receiveUserID != null)
                    {
                        _Request.receiveUserID = requestDTO.receiveUserID.Id;
                    }

                    _Request.rejectionDate = Formatter.formatStringtoDate(requestDTO.rejectionDate); //DateTime.ParseExact(requestDTO.rejectionDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);

                    if (requestDTO.rejectionUserID != null)
                    {
                        _Request.rejectionUserID = requestDTO.rejectionUserID.Id;
                    }

                    if (requestDTO.rejectionReasonID != null)
                    {
                        _Request.rejectionReasonID = requestDTO.rejectionReasonID.Id;
                    }

                    if (requestDTO.requestTypeID != null)
                    {
                        _Request.requestTypeID = requestDTO.requestTypeID.Id;
                    }

                    if (requestDTO.requestStatusID != null)
                    {
                        _Request.requestStatusID = requestDTO.requestStatusID.Id;
                    }

                    if (requestDTO.requestCalssID != null)
                    {
                        _Request.requestCalssID = requestDTO.requestCalssID.Id;
                    }

                    if (requestDTO.requestPriorityID != null)
                    {
                        _Request.requestPriorityID = requestDTO.requestPriorityID.Id;
                    }

                    // Request Details Data Part
                    if (requestDTO.RequestDetailList != null && requestDTO.RequestDetailList.Count > 0)
                    {
                        foreach (RequestDetailDTO _RequestDetailDTO in requestDTO.RequestDetailList)
                        {
                            _RequestDetailTemp           = new RequestDetail();
                            _RequestDetailTemp.Id        = _RequestDetailDTO.Id;
                            _RequestDetailTemp.quantity  = _RequestDetailDTO.quantity;
                            _RequestDetailTemp.requestID = requestDTO.Id;

                            if (_RequestDetailDTO.cardTypeDTO != null)
                            {
                                _RequestDetailTemp.cardTypeID = _RequestDetailDTO.cardTypeDTO.Id;
                            }

                            _RequestDetailListInput.Add(_RequestDetailTemp);
                        }
                    }

                    result = true;
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(result);
        }