public GetScReceivingDetailsResponseDto GetSubContractReceivingDetails(Int64 VendorCode)
        {
            GetScReceivingDetailsResponseDto response;

            try
            {
                response = rSubContractProvider.GetSubContractReceivingDetails(VendorCode);
                response.ServiceResponseStatus = 1;
            }
            catch (SSException applicationException)
            {
                response = new GetScReceivingDetailsResponseDto
                {
                    ServiceResponseStatus = 0,
                    ErrorMessage          = applicationException.Message,
                    ErrorCode             = applicationException.ExceptionCode
                };
            }
            catch (Exception exception)
            {
                response = new GetScReceivingDetailsResponseDto
                {
                    ServiceResponseStatus = 0,
                    ErrorCode             = ExceptionAttributes.ExceptionCodes.InternalServerError,
                    ErrorMessage          = exception.Message
                };
            }

            return(response);
        }
        public GetScReceivingDetailsResponseDto GetSubContractReceivingDetails(Int64 VendorCode)
        {
            var response = new GetScReceivingDetailsResponseDto()
            {
                getSubContractReceivingResponseList = new List <GetSubContractReceivingResponse>()
            };

            var model = subContractRepository.GetSubContractReceivingDetails(VendorCode);


            foreach (var responseModel in model.getSubContractReceivingResponseModel)
            {
                var getsingle = new GetSubContractReceivingResponse
                {
                    getSubContractReceivingSerialList = new List <GetSubContractReceivingSerialList>()
                };
                var getWoMasterDetailsResponse = new GetSubContractReceivingSerialList();
                getWoMasterDetailsResponse.SerialNo = responseModel.SerialNo;
                getWoMasterDetailsResponse.WONumber = responseModel.WONumber;
                getWoMasterDetailsResponse.WOSerial = responseModel.WOSerial;

                if (response.getSubContractReceivingResponseList.Count > 0)
                {
                    var isExist = response.getSubContractReceivingResponseList.Any(dcMaster => dcMaster.WONumber == responseModel.WONumber && dcMaster.WOSerial == responseModel.WOSerial);
                    if (isExist)
                    {
                        var index = response.getSubContractReceivingResponseList.FindIndex(a => a.WONumber == responseModel.WONumber && a.WOSerial == responseModel.WOSerial);

                        response.getSubContractReceivingResponseList[index].getSubContractReceivingSerialList.Add(getWoMasterDetailsResponse);
                    }
                    else
                    {
                        getsingle.WONumber            = responseModel.WONumber;
                        getsingle.WOSerial            = responseModel.WOSerial;
                        getsingle.CustomerName        = responseModel.VendorName;
                        getsingle.DrawingNumber       = responseModel.DrawingNumber;
                        getsingle.ItemCode            = responseModel.ItemCode;
                        getsingle.MaterialCode        = responseModel.MaterialCode;
                        getsingle.MaterialDescription = responseModel.MaterialDescription;
                        getsingle.PartCode            = responseModel.PartCode;
                        getsingle.PartDescription     = responseModel.PartDescription;


                        getsingle.getSubContractReceivingSerialList.Add
                            (getWoMasterDetailsResponse);

                        response.getSubContractReceivingResponseList.Add(getsingle);
                    }
                }
                else
                {
                    getsingle.WONumber            = responseModel.WONumber;
                    getsingle.WOSerial            = responseModel.WOSerial;
                    getsingle.CustomerName        = responseModel.VendorName;
                    getsingle.DrawingNumber       = responseModel.DrawingNumber;
                    getsingle.ItemCode            = responseModel.ItemCode;
                    getsingle.MaterialCode        = responseModel.MaterialCode;
                    getsingle.MaterialDescription = responseModel.MaterialDescription;
                    getsingle.PartCode            = responseModel.PartCode;
                    getsingle.PartDescription     = responseModel.PartDescription;

                    getsingle.getSubContractReceivingSerialList.Add
                        (getWoMasterDetailsResponse);

                    response.getSubContractReceivingResponseList.Add(getsingle);
                }
            }

            return(response);
        }