public ActionResult insertPlan(/*[FromQuery] TokenSignature token*/)
        {
            PlansModel model = new PlansModel()
            {
                address        = "test",
                planName       = "test",
                regionID       = 1,
                serializedPlan = Encoding.Unicode.GetBytes("TestTEST")
            };

            try
            {
                DBCommands.PlansInsertValues("Plans", new object[]
                {
                    "test",
                    1,
                    "test",
                    false,
                    Encoding.Unicode.GetBytes("TestTest")
                });
                return(Ok("ok"));
            }
            catch (Exception e)
            {
                return(Ok(e.Message));
            }
        }
示例#2
0
        public ResultModel Update(PlansModel obj)
        {
            ResultModel oOutput = new ResultModel();

            try
            {
                Plans oPlans = dbSet.Where(m => m.ID == obj.ID).FirstOrDefault();
                if (oPlans == null)
                {
                    oOutput.Status = 0;
                    oOutput.Msg    = "Record not exist";
                }
                else
                {
                    // Removing Already Added

                    Mapper.Map(obj, oPlans);
                    oDB.SaveChanges();
                    oOutput.Data = Mapper.Map <PlansModel>(oPlans);
                }
            }
            catch (Exception ex)
            {
                oOutput.Status = 0;
                oOutput.Msg    = "Data access error";
                Services.Utitilty.Error(ex);
            }
            return(oOutput);
        }
示例#3
0
        /// <summary>
        /// Gets the plan detail by plan gu identifier.
        /// </summary>
        /// <param name="planGuId">The plan gu identifier.</param>
        /// <returns> Plans.</returns>
        public PlansModel GetPlanDetailByPlanGuId(Guid planGuId)
        {
            var existingPlan   = this.plansRepository.GetByInternalReference(planGuId);
            var planAttributes = this.plansRepository.GetPlanAttributes(planGuId, existingPlan.OfferId);
            var planEvents     = this.plansRepository.GetEventsByPlan(planGuId, existingPlan.OfferId);
            var offerDetails   = this.offerRepository.GetOfferById(existingPlan.OfferId);

            PlansModel plan = new PlansModel
            {
                Id     = existingPlan.Id,
                PlanId = existingPlan.PlanId,
                IsmeteringSupported = existingPlan.IsmeteringSupported,
                OfferID             = existingPlan.OfferId,
                DisplayName         = existingPlan.DisplayName,
                Description         = existingPlan.Description,
                PlanGUID            = existingPlan.PlanGuid,
                OfferName           = offerDetails.OfferName,
            };

            plan.PlanAttributes = new List <PlanAttributesModel>();

            foreach (var attribute in planAttributes)
            {
                PlanAttributesModel planAttributesmodel = new PlanAttributesModel()
                {
                    OfferAttributeId = attribute.OfferAttributeId,
                    PlanAttributeId  = attribute.PlanAttributeId,
                    PlanId           = existingPlan.PlanGuid,
                    DisplayName      = attribute.DisplayName,
                    IsEnabled        = attribute.IsEnabled,
                    Type             = attribute.Type,
                };
                plan.PlanAttributes.Add(planAttributesmodel);
            }

            plan.PlanEvents = new List <PlanEventsModel>();

            foreach (var events in planEvents)
            {
                PlanEventsModel planEventsModel = new PlanEventsModel()
                {
                    Id                 = events.Id,
                    PlanId             = events.PlanId,
                    Isactive           = events.Isactive,
                    SuccessStateEmails = events.SuccessStateEmails,
                    FailureStateEmails = events.FailureStateEmails,
                    EventName          = events.EventsName,
                    EventId            = events.EventId,
                    CopyToCustomer     = events.CopyToCustomer,
                };
                plan.PlanEvents.Add(planEventsModel);
            }

            return(plan);
        }
示例#4
0
 /// <summary>
 /// Indexes this instance.
 /// </summary>
 /// <param name="planGuId">The plan gu identifier.</param>
 /// <returns>
 /// return All subscription.
 /// </returns>
 public IActionResult PlanDetails(Guid planGuId)
 {
     this.logger.LogInformation("Plans Controller / PlanDetails:  planGuId {0}", planGuId);
     try
     {
         PlansModel plans = new PlansModel();
         this.TempData["ShowWelcomeScreen"] = "True";
         var currentUserDetail = this.usersRepository.GetPartnerDetailFromEmail(this.CurrentUserEmailAddress);
         plans = this.plansService.GetPlanDetailByPlanGuId(planGuId);
         return(this.PartialView(plans));
     }
     catch (Exception ex)
     {
         this.logger.LogError(ex, ex.Message);
         return(this.View("Error", ex));
     }
 }
示例#5
0
        public ResultModel Insert(PlansModel obj, ApplicationUser appUser)
        {
            ResultModel oOutput = new ResultModel();

            try
            {
                // obj.CompanyID = appUser.CompanyId;
                Plans oPlans = Mapper.Map <Plans>(obj);
                dbSet.Add(oPlans);
                oDB.SaveChanges();
                oOutput.Data = Mapper.Map <PlansModel>(oPlans);
            }
            catch (Exception ex)
            {
                oOutput.Data   = obj;
                oOutput.Status = 0;
                oOutput.Msg    = "Data access error";
                Services.Utitilty.Error(ex);
            }
            return(oOutput);
        }
示例#6
0
        /// <summary>
        /// Gets the plans.
        /// </summary>
        /// <returns>List of plans.</returns>
        public List <PlansModel> GetPlans()
        {
            List <PlansModel> plansList = new List <PlansModel>();
            var allPlansData            = this.plansRepository.GetPlansByUser();

            foreach (var item in allPlansData)
            {
                PlansModel plans = new PlansModel();
                plans.PlanId              = item.PlanId;
                plans.DisplayName         = item.DisplayName;
                plans.Description         = item.Description;
                plans.IsmeteringSupported = item.IsmeteringSupported;
                plans.OfferID             = item.OfferId;
                plans.PlanGUID            = item.PlanGuid;
                plansList.Add(plans);
            }

            var offerDetails = this.offerRepository.GetAll();

            plansList.ForEach(x => x.OfferName = offerDetails.Where(s => s.OfferGuid == x.OfferID).FirstOrDefault().OfferName);

            return(plansList);
        }
示例#7
0
        public IActionResult PlanDetails(PlansModel plans)
        {
            this.logger.LogInformation("Plans Controller / PlanDetails:  plans {0}", JsonSerializer.Serialize(plans));
            try
            {
                var currentUserDetail = this.usersRepository.GetPartnerDetailFromEmail(this.CurrentUserEmailAddress);
                if (plans != null)
                {
                    if (plans.PlanAttributes != null)
                    {
                        var inputAtttributes = plans.PlanAttributes.Where(s => s.Type.ToLower() == "input").ToList();
                        foreach (var attributes in inputAtttributes)
                        {
                            attributes.UserId = currentUserDetail.UserId;
                            this.plansService.SavePlanAttributes(attributes);
                        }
                    }

                    if (plans.PlanEvents != null)
                    {
                        foreach (var events in plans.PlanEvents)
                        {
                            events.UserId = currentUserDetail.UserId;
                            this.plansService.SavePlanEvents(events);
                        }
                    }
                }

                this.ModelState.Clear();
                return(this.RedirectToAction(nameof(this.PlanDetails), new { @planGuId = plans.PlanGUID }));
            }
            catch (Exception ex)
            {
                this.logger.LogError(ex, ex.Message);
                return(this.PartialView("Error", ex));
            }
        }
        public ActionResult VianetBillInquiry(VianetBillInquiryModel wpm)
        {
            VianetBillInquiryCommon wpc = wpm.MapObject <VianetBillInquiryCommon>();
            var productdetails          = GetVianetproductDetails();

            wpm.ProductLogo     = productdetails.ProductLogo;
            wpm.CommissionType  = productdetails.CommissionType;
            wpm.CommissionValue = productdetails.CommissionValue;

            wpc.IpAddress = ApplicationUtilities.GetIP();
            wpc.UserId    = ApplicationUtilities.GetSessionValue("userid").ToString();
            var inquiry = _vianet.CheckVianetAccount(wpc);
            VianetBillInquiryResponseModel vnet = new VianetBillInquiryResponseModel();

            vnet.ProductLogo     = productdetails.ProductLogo;
            vnet.CommissionType  = productdetails.CommissionType;
            vnet.CommissionValue = productdetails.CommissionValue;
            vnet.ProductId       = productdetails.ProductId.EncryptParameter();
            if (inquiry.GatewayName.ToUpper() == "PRABHUPAY")
            {
                if (inquiry.Code == shared.Models.ResponseCode.Success)
                {
                    var obj = Newtonsoft.Json.JsonConvert.SerializeObject(inquiry.Data);
                    var prabhupayinqresp = Newtonsoft.Json.JsonConvert.DeserializeObject <PrabhuPayVianetBillInquiryResponseModel>(obj);
                    vnet.CustomerName     = prabhupayinqresp.CustomerName;
                    vnet.VianetCustomerId = prabhupayinqresp.VianetCustomerId;
                    vnet.PaymentMessage   = prabhupayinqresp.PaymentMessage;
                    List <PlansModel> lst = new List <PlansModel>();
                    foreach (var item in prabhupayinqresp.RenewalPlans)
                    {
                        PlansModel plan = new PlansModel()
                        {
                            PlanId          = item.PlanId,
                            PlanAmount      = item.PlanAmount,
                            PlanName        = item.PlanName,
                            PlanDescription = item.PlanDescription
                        };
                        lst.Add(plan);
                    }
                    //wlink.RenewalPlans = lst;
                    //var planlst = DropdownPlan(lst);
                    //if (planlst == null)
                    //{
                    //    ViewBag.Planlist = null;
                    //}
                    ViewBag.Planlist       = ApplicationUtilities.SetDDLValue(DropdownPlan(lst), "", "--Select--");
                    vnet.Encryptioncontent = (prabhupayinqresp.VianetCustomerId + prabhupayinqresp.BillAmount).EncryptParameter();

                    string AgentId  = Session["AgentId"].ToString();
                    var    TxnLimit = _transactionLimit.GetTransactionLimitForUser(AgentId);
                    var    trangrid = ProjectGrid.TransactionLimit(TxnLimit);
                    ViewData["trangrid"] = trangrid;

                    return(View("VianetBillPayment", vnet));
                }
                else
                {
                    string AgentId  = Session["AgentId"].ToString();
                    var    TxnLimit = _transactionLimit.GetTransactionLimitForUser(AgentId);
                    var    trangrid = ProjectGrid.TransactionLimit(TxnLimit);
                    ViewData["trangrid"] = trangrid;

                    this.ShowPopup(1, inquiry.Message);
                    return(View(wpm));
                }
            }
            this.ShowPopup(1, "Service Unavaliable");
            return(View(wpm));
        }
示例#9
0
 public ResultModel Put([FromBody] PlansModel obj)
 {
     return(_svr.Update(obj));
 }
示例#10
0
 public ResultModel Post([FromBody] PlansModel obj)
 {
     return(_svr.Insert(obj, AppUser));
 }