private APIResponse ValidatePromo(UpdatePromoInfo updatePromoInfo)
        {
            AddComboPromoInfo comboPrice = new AddComboPromoInfo();

            comboPrice.CountryCode = new List <string>();
            comboPrice.CountryCode.Add(updatePromoInfo.CountryCode);
            comboPrice.MainProductCode = updatePromoInfo.ProductCode;
            comboPrice.BV                = updatePromoInfo.CUV;
            comboPrice.StartDate         = updatePromoInfo.StartDate;
            comboPrice.EndDate           = updatePromoInfo.EndDate;
            comboPrice.PriceSchemeIds    = updatePromoInfo.PriceSchemeId;
            comboPrice.ComboPriceDetails = new List <ComboPriceDetails>();
            comboPrice.ComboPriceDetails.Add(new ComboPriceDetails
            {
                ProductCode      = updatePromoInfo.ProductCode,
                IRPrice          = updatePromoInfo.IRRegularPrice,
                IRPromoPrice     = updatePromoInfo.IRPromoPrice,
                RetailPrice      = updatePromoInfo.RetailRegularPrice,
                RetailPromoPrice = updatePromoInfo.RetailPromoPrice,
                PricePlanId      = updatePromoInfo.PricePlanId
            });

            APIResponse aPIResponse = this.ValidatePromoForCombo(comboPrice);

            return(aPIResponse);
        }
        public APIResponse UpdatePromoInfo(UpdatePromoInfo updatePromoInfo)
        {
            APIResponse aPIResponse = new APIResponse();

            try
            {
                aPIResponse = this.ValidatePromo(updatePromoInfo);
                if (aPIResponse.IsSuccess)
                {
                    string query = "dbo.usp_UpdateLaunchPromotion";
                    using (SqlConnection con = new SqlConnection(this.settings.Value.GQNet))
                    {
                        con.Open();
                        using (SqlCommand command = new SqlCommand(query, con))
                        {
                            command.CommandType = CommandType.StoredProcedure;
                            command.Parameters.AddWithValue("@PriceSchemeIds", updatePromoInfo.PriceSchemeId);
                            command.Parameters.AddWithValue("@ProdCode", updatePromoInfo.ProductCode);
                            command.Parameters.AddWithValue("@PricePlanID", updatePromoInfo.PricePlanId);
                            command.Parameters.AddWithValue("@PricePlanType", updatePromoInfo.PricePlanType);
                            command.Parameters.AddWithValue("@StartDate", updatePromoInfo.StartDate);
                            command.Parameters.AddWithValue("@EndDate", updatePromoInfo.EndDate);
                            command.Parameters.AddWithValue("@OldEndDate", updatePromoInfo.OldPromoDate);
                            command.Parameters.AddWithValue("@Currency", updatePromoInfo.Currency);
                            command.Parameters.AddWithValue("@IRPrice", updatePromoInfo.IRPromoPrice);
                            command.Parameters.AddWithValue("@ReIRPrice", updatePromoInfo.IRRegularPrice);
                            command.Parameters.AddWithValue("@RetailPrice", updatePromoInfo.RetailPromoPrice);
                            command.Parameters.AddWithValue("@ReRetailPrice", updatePromoInfo.RetailRegularPrice);
                            command.Parameters.AddWithValue("@CUV", updatePromoInfo.CUV);
                            command.Parameters.AddWithValue("@CountryCode", updatePromoInfo.CountryCode);
                            command.Parameters.AddWithValue("@ShipFeeSH", updatePromoInfo.ShipFee);
                            command.Parameters.AddWithValue("@DSP", updatePromoInfo.RSP);

                            command.ExecuteNonQuery();
                        }
                    }
                    aPIResponse.IsSuccess = true;
                }
            }
            catch (Exception ex)
            {
                aPIResponse.IsSuccess    = false;
                aPIResponse.ErrorMessage = ex.Message;
            }

            return(aPIResponse);
        }
 public APIResponse UpdatePromoInfo(UpdatePromoInfo updatePromoInfo)
 {
     return(iPromoLaunchRepository.UpdatePromoInfo(updatePromoInfo));
 }
 public ActionResult PromoUpdate([FromBody] UpdatePromoInfo updatePromo)
 {
     return(Json(iPromoLaunchService.UpdatePromoInfo(updatePromo)));
 }