public JsonResult GetPosMerchant(System.Int32 id)
        {
            DataTableViewModel data1;

            GetPosMerchantRequest request = new GetPosMerchantRequest();

            request.MerchantId = id;
            DetailPosMerchant_PosMerchantDetailView data = _posMerchantService.GetPosMerchant(request).PosMerchant.ConvertToDetailPosMerchant_PosMerchantDetailView();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetDetail(System.Int32 id)
        {
            PosMerchantDetailView vm      = new PosMerchantDetailView();
            GetPosMerchantRequest request = new GetPosMerchantRequest();

            request.MerchantId = id;
            GetPosMerchantResponse response = _posMerchantService.GetPosMerchant(request);

            if (response.PosMerchantFound)
            {
                vm = response.PosMerchant.ConvertToPosMerchantDetailView();
            }

            return(Json(vm, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Create(PosReceiptOfTestingDetailView vm)
        {
            CreatePosReceiptOfTestingRequest request = new CreatePosReceiptOfTestingRequest();

            request.TestDate = vm.TestDate;
            GetPosMerchantRequest posMerchantRequest = new GetPosMerchantRequest();

            posMerchantRequest.MerchantId = vm.PosMerchantMerchantId;
            request.PosMerchant           = _posMerchantService.GetPosMerchant(posMerchantRequest).PosMerchant;
            request.AgentAName            = vm.AgentAName;
            request.AgentBName            = vm.AgentBName;
            request.PosId = vm.PosId;
            CreatePosReceiptOfTestingResponse response = _posReceiptOfTestingService.CreatePosReceiptOfTesting(request);

            return(Json(response));
        }
        public JsonResult GetPosReceiptOfTestingDataTable(System.Int32 id)
        {
            DataTableViewModel data;

            GetPosMerchantRequest request = new GetPosMerchantRequest();

            request.MerchantId = id;
            PosMerchantView posMerchant = _posMerchantService.GetPosMerchant(request).PosMerchant;

            data                 = new DataTableViewModel();
            data.draw            = "1";
            data.recordsTotal    = posMerchant.PosReceiptOfTestings.ToList().Count.ToString();
            data.recordsFiltered = posMerchant.PosReceiptOfTestings.ToList().Count.ToString();

            data.data = posMerchant.PosReceiptOfTestings.ConvertToDetailPosMerchantPosReceiptOfTestingDetailViews().ToList <object>();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        public GetPosMerchantResponse GetPosMerchant(GetPosMerchantRequest request)
        {
            GetPosMerchantResponse response = new GetPosMerchantResponse();

            PosMerchant posMerchant = _posMerchantRepository
                                      .FindBy(request.MerchantId);

            if (posMerchant != null)
            {
                response.PosMerchantFound = true;
                response.PosMerchant      = posMerchant.ConvertToPosMerchantView();
            }
            else
            {
                response.PosMerchantFound = false;
            }


            return(response);
        }
        public JsonResult Update(PosReceiptOfTestingDetailView vm)
        {
            GetPosReceiptOfTestingRequest request = new GetPosReceiptOfTestingRequest();

            request.ReceiptOfTestingId = vm.ReceiptOfTestingId;

            ModifyPosReceiptOfTestingRequest updateRequest = _posReceiptOfTestingService.GetPosReceiptOfTesting(request).PosReceiptOfTesting.ConvertToModifyPosReceiptOfTestingRequest();

            updateRequest.ReceiptOfTestingId = vm.ReceiptOfTestingId;
            updateRequest.TestDate           = vm.TestDate;
            GetPosMerchantRequest posMerchantRequest = new GetPosMerchantRequest();

            posMerchantRequest.MerchantId = vm.PosMerchantMerchantId;
            updateRequest.PosMerchant     = _posMerchantService.GetPosMerchant(posMerchantRequest).PosMerchant;
            updateRequest.AgentAName      = vm.AgentAName;
            updateRequest.AgentBName      = vm.AgentBName;
            updateRequest.PosId           = vm.PosId;

            ModifyPosReceiptOfTestingResponse response = _posReceiptOfTestingService.ModifyPosReceiptOfTesting(updateRequest);

            return(Json(response));
        }
        public JsonResult Update(PosMerchantDetailView vm)
        {
            GetPosMerchantRequest request = new GetPosMerchantRequest();

            request.MerchantId = vm.MerchantId;

            ModifyPosMerchantRequest updateRequest = _posMerchantService.GetPosMerchant(request).PosMerchant.ConvertToModifyPosMerchantRequest();

            updateRequest.MerchantId   = vm.MerchantId;
            updateRequest.MerchantName = vm.MerchantName;
            GetPosAddressRequest posAddressRequest = new GetPosAddressRequest();

            posAddressRequest.AddressId          = vm.PosAddressAddressId;
            updateRequest.PosAddress             = _posAddressService.GetPosAddress(posAddressRequest).PosAddress;
            updateRequest.BusinessName           = vm.BusinessName;
            updateRequest.BannerName             = vm.BannerName;
            updateRequest.MerchantIdByHeadQuater = vm.MerchantIdByHeadQuater;

            ModifyPosMerchantResponse response = _posMerchantService.ModifyPosMerchant(updateRequest);

            return(Json(response));
        }