예제 #1
0
        public async Task <CommonResponse> SaveCommercials([FromBody] CommercialsSetReq request)
        {
            var response = new CommonResponse();

            try
            {
                if (!string.IsNullOrEmpty(request.QRFPriceId))
                {
                    response = await _commercialsRepository.SaveCommercials(request);
                }
                else
                {
                    response.ResponseStatus.Status       = "Failure";
                    response.ResponseStatus.ErrorMessage = "QRFId can not be blank.";
                }
                if (!string.IsNullOrEmpty(response.ResponseStatus.Status) && response.ResponseStatus.Status == "Success" && !string.IsNullOrEmpty(request.QrfId) && !string.IsNullOrEmpty(request.VoyagerUserId))
                {
                    Task.Run(() => _mSDynamicsRepository.CreateUpdateOpportnity(request.QrfId, request.VoyagerUserId).Result);
                }
            }
            catch (Exception ex)
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "An Error Occurs :- " + ex.Message;
            }
            return(response);
        }
예제 #2
0
        public async Task <CommonResponse> SaveCommercials(CommercialsSetReq request)
        {
            CommonResponse response = new CommonResponse();

            try
            {
                var QRFPrice = _MongoContext.mQRFPrice.AsQueryable().Where(a => a.QRFPrice_Id == request.QRFPriceId).FirstOrDefault();

                QRFPrice.PercentSoldOptional = request.PercentSoldOptional;
                QRFPrice.EditUser            = request.EditUser;
                QRFPrice.EditDate            = DateTime.Now;

                ReplaceOneResult replaceResultNew = await _MongoContext.mQRFPrice.ReplaceOneAsync(Builders <mQRFPrice> .Filter.Eq("QRFPrice_Id", QRFPrice.QRFPrice_Id), QRFPrice);

                response.ResponseStatus.Status       = replaceResultNew.MatchedCount > 0 ? "Success" : "Failure";
                response.ResponseStatus.ErrorMessage = replaceResultNew.MatchedCount > 0 ? "Commercial data Successfully." : "Commercial data not updated.";
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = ex.Message;
            }
            return(response);
        }
예제 #3
0
        public async Task <CommonResponse> SaveCommercials(CommercialsSetReq commercialsSetReq, string ticket)
        {
            CommonResponse response = new CommonResponse();

            response = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceCommercials:SaveCommercials"), commercialsSetReq, typeof(CommonResponse), ticket);

            return(response);
        }
예제 #4
0
        public JsonResult SaveCommercials(string QRFPriceId, double PercentSoldOptional, string QRFID = null)
        {
            CommonResponse    response = new CommonResponse();
            CommercialsSetReq request  = new CommercialsSetReq();

            request.QRFPriceId          = QRFPriceId;
            request.PercentSoldOptional = PercentSoldOptional;
            request.EditUser            = ckUserEmailId;
            request.VoyagerUserId       = ckLoginUser_Id;
            request.QrfId = QRFID;
            response      = coProviders.SaveCommercials(request, token).Result;

            if (response != null)
            {
                return(Json(response.ResponseStatus));
            }
            return(Json("failure"));
        }