コード例 #1
0
ファイル: CustomerModel.cs プロジェクト: sv-dev1/ULDCustomer
 public int AddCustomer(SiteSubscriber customer)
 {
     int id = 0;
     string connectionString = ConfigurationManager.ConnectionStrings["con"].ToString();
     try
     {
         using (SqlConnection con = new SqlConnection(connectionString))
         {
             using (SqlCommand cmd = new SqlCommand("sp_CustomerInsert", con))
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@ULDSurveyID", SqlDbType.VarChar).Value = customer.ULDSurveyID;
                 cmd.Parameters.Add("@firstName", SqlDbType.VarChar).Value = customer.FirstName;
                 cmd.Parameters.Add("@lastName", SqlDbType.VarChar).Value = customer.LastName;
                 cmd.Parameters.Add("@email", SqlDbType.VarChar).Value = customer.Email;
                 cmd.Parameters.Add("@ProductIDPurchased", SqlDbType.VarChar).Value = customer.SubscriptionId;
                 con.Open();
                 //var dd = cmd.ExecuteNonQuery();
                 //var idd = cmd.Parameters["@newCustomerID"].Value;
                 var d = cmd.ExecuteScalar();
                 id = Convert.ToInt32(d);
             }
         }
     }
     catch { }
     return id;
 }
コード例 #2
0
        public ActionResult CreateSubscriber(SiteSubscriber obj)
        {
            if (ModelState.IsValid)
            {
                Guid guid = new Guid();
                Random rnmd = new Random();
                ULDEntities db = new ULDEntities();
                if (ModelState.IsValid)
                {
                    ULDCustomer.Models.ULDCustomer obtbl = new ULDCustomer.Models.ULDCustomer();
                    CustomerModel model = new CustomerModel();
                    int cutomerid = model.AddCustomer(obj);
                    xml = "<subscriber><customer-id>" + cutomerid + "</customer-id><screen-name>" + obj.FirstName + obj.LastName + "</screen-name></subscriber>";
                    site = ConfigurationManager.AppSettings["apiUrl"].ToString();
                    url = string.Format("https://subs.pinpayments.com/api/v4/{0}/subscribers.xml", site);
                    CreateSubscriberApi(url, xml, "Post");
                    CardDetail obj1 = new CardDetail();

                    obj1.token = GenrateInvoice(obj.SubscriptionId, cutomerid.ToString(), obj.FirstName, obj.Email);
                    obj1.firstName = obj.FirstName;
                    obj1.lastName = obj.LastName;
                    obj1.fullName = obj.FirstName + " " + obj.LastName;
                    var planDetail = DBCommon.GetPlanDetailByProductID(obj.SubscriptionId);
                    obj1.title = planDetail.Rows[0]["title"].ToString();
                    obj1.CustomerId = cutomerid;
                    obj1.description = planDetail.Rows[0]["description"].ToString();
                    obj1.price = planDetail.Rows[0]["price"].ToString();
                    ViewBag.year = DBCommon.BindYear();
                    ViewBag.month = DBCommon.BindMonth();
                    TempData["CardDetail"] = obj1;
                    TempData["email"] = obj.Email;
                    TempData["PrimaryEmail"] = obj.Email;
                    //   return RedirectToAction("AddCardDetail", new { id = cutomerid });
                    return RedirectToAction("AddCardDetail");
                }
                return View("CreateSubscriber");
            }
            else
            {
                return View(obj);
            }
        }
コード例 #3
0
        //[Route("{id}")]
        public ActionResult CreateSubscriber(string id, int SurveyID)
        {
            try
            {

                List<Plans> plans = DBCommon.GetPlans();
                var f = plans.FirstOrDefault(x => x.Name == id);
                SiteSubscriber obj = new SiteSubscriber();
                obj.SubscriptionId = f.Id.ToString();
                obj.ULDSurveyID = SurveyID;
                //obj.ServiceLevel = f.ServiceLevel.ToString();
                return View("CreateSubscriber", obj);
            }
             catch
            {
                return null;
            }
        }