Beispiel #1
0
 /// <summary>
 ///     Help customer for joining campaign
 /// </summary>
 /// <param name="subscriptionJson"></param>
 /// <returns></returns>
 public JsonRespone JoinCampaign(SubscriptionJson subscriptionJson)
 {
     var subscription = ConvertSubscriptionJsonToSubScription(subscriptionJson);
     var srvDaoSubcription = NinjectKernelFactory.Kernel.Get<ISubscriptionDataAccess>();
     using (var tr = TransactionsFactory.CreateTransactionScope())
     {
         try
         {
             srvDaoSubcription.Save(subscription);
             m_authenticationJsonRespone.Message = Dictionary.MSG_SUCCESS;
             tr.Complete();
             return m_authenticationJsonRespone;
         }
         catch (Exception)
         {
             m_authenticationJsonRespone.Message = Dictionary.MSG_FAILED;
             return m_authenticationJsonRespone;
         }
     }
 }
Beispiel #2
0
 private Subscription ConvertSubscriptionJsonToSubScription(SubscriptionJson subscriptionJson)
 {
     var srvDaoCampaign = NinjectKernelFactory.Kernel.Get<ICampaignDataAccess>();
     var srvDaoCustomer = NinjectKernelFactory.Kernel.Get<ICustomerDataAccess>();
     return new Subscription
     {
         Customer = srvDaoCustomer.GetById(int.Parse(subscriptionJson.CustomerId)),
         Campaign = srvDaoCampaign.GetById(int.Parse(subscriptionJson.CampaignId)),
         IsComplete = ReturnIsCompleteSubscriptionValue(subscriptionJson.IsComplete),
         CompletedMission = subscriptionJson.CompletedMission,
         NumOfCompletedMission = int.Parse(subscriptionJson.NumOfCompletedMission),
         Comment = subscriptionJson.Comment,
         Rating = int.Parse(subscriptionJson.Rating)
     };
 }