Пример #1
0
 public static void InsertEvent(EventMaster eventMaster)
 {
     if (eventMaster.ZoomToken != null)
     {
         UpdateZoomTokenEvent(eventMaster.ZoomToken, eventMaster.CustomerId);
     }
     db.EventMasters.Add(eventMaster);
     db.SaveChanges();
 }
Пример #2
0
 public static void InsertCustomer(Customer customer)
 {
     db.Customers.Add(customer);
     db.SaveChanges();
 }
Пример #3
0
 public static void InsertOrder(Order order)
 {
     db.Orders.Add(order);
     db.SaveChanges();
 }
Пример #4
0
 public static void InsertPackage(Package package)
 {
     db.Packages.Add(package);
     db.SaveChanges();
 }
Пример #5
0
        public ActionResult Authenticate(string accesstoken, string eventkey, int referralid = 0)
        {
            var eventid = EventService.GetEventByKey(eventkey).EventId;
            var client  = new RestClient("https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,profilePicture(displayImage~digitalmediaAsset:playableStreams))");
            var request = new RestRequest(Method.GET);

            request.AddHeader("cache-control", "no-cache");
            request.AddHeader("Connection", "keep-alive");
            request.AddHeader("Accept-Encoding", "gzip, deflate");
            request.AddHeader("Host", "api.linkedin.com");
            request.AddHeader("Postman-Token", "0b77a8dc-8ae0-4dc4-97f2-48d965518224,d4177a7d-8d60-4145-bee8-b63f4987d2d9");
            request.AddHeader("Cache-Control", "no-cache");
            request.AddHeader("Accept", "*/*");
            request.AddHeader("User-Agent", "PostmanRuntime/7.15.2");
            request.AddHeader("Authorization", "Bearer " + accesstoken);
            request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
            IRestResponse response = client.Execute(request);


            var client1  = new RestClient("https://api.linkedin.com/v2/emailAddress?q=members&projection=%28elements%2A%28handle~%29%29");
            var request1 = new RestRequest(Method.GET);

            request1.AddHeader("cache-control", "no-cache");
            request1.AddHeader("Connection", "keep-alive");
            request1.AddHeader("Accept-Encoding", "gzip, deflate");
            request1.AddHeader("Host", "api.linkedin.com");
            request1.AddHeader("Postman-Token", "ee43f094-9f10-419f-b99b-fd77245a0702,b68b518c-60fd-4ebf-8b61-f8f2b97ea23f");
            request1.AddHeader("Cache-Control", "no-cache");
            request1.AddHeader("Accept", "*/*");
            request1.AddHeader("User-Agent", "PostmanRuntime/7.15.2");
            request1.AddHeader("Authorization", "Bearer " + accesstoken);
            request1.AddHeader("Content-Type", "application/x-www-form-urlencoded");
            IRestResponse response1 = client1.Execute(request1);

            var exists = false;

            //IRestResponse response = client.Execute(request);
            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                var profile       = JsonConvert.DeserializeObject <ProfileNew.RootObject>(response.Content);
                var emailresponse = JsonConvert.DeserializeObject <EmailResponse.RootObject>(response1.Content);
                //ShareOnWall(profile.Id, accesstoken);
                int            userid         = 0;
                string         email          = "";
                RegisteredUser registeredUser = new RegisteredUser();
                try
                {
                    email = emailresponse.elements[0].handle.emailAddress;
                }
                catch
                {
                }
                if (email != "")
                {
                    var matchuser = db.RegisteredUsers.Where(x => x.Email == email && x.EventId == eventid).ToList();
                    if (matchuser.Count > 0)
                    {
                        exists = true;
                        userid = matchuser.FirstOrDefault().UserId;
                    }
                    else
                    {
                        registeredUser.EventId            = eventid;
                        registeredUser.FirstName          = profile.firstName.localized.en_US;
                        registeredUser.LastName           = profile.lastName.localized.en_US;
                        registeredUser.Email              = email;
                        registeredUser.Country            = "";
                        registeredUser.DateOfRegistration = DateTime.Now;
                        registeredUser.IsDeleted          = false;
                        registeredUser.IsRegistered       = false;
                        registeredUser.ProfileImage       = profile.profilePicture.displayImage.elements.FirstOrDefault().identifiers.FirstOrDefault().identifier;
                        registeredUser.ProfileLink        = profile.id;
                        registeredUser.ProfileId          = profile.id;
                        registeredUser.AuthToken          = accesstoken;
                        registeredUser.ReferalId          = referralid;
                        registeredUser.Source             = "linkedin";
                        var allowuser = db.Packages.Select(x => x.No_of_Registration).FirstOrDefault();
                        var reguser   = db.RegisteredUsers.Where(x => x.EventId == eventid && x.Ispaid == true).Count();

                        //if (allowuser > reguser)
                        //{
                        //    registeredUser.Ispaid = true;
                        //}
                        //else
                        //{
                        registeredUser.Ispaid = false;
                        //}
                        db.RegisteredUsers.Add(registeredUser);
                        db.SaveChanges();

                        userid = registeredUser.UserId;
                    }
                    var eventurl     = db.EventMasters.Find(eventid);
                    var adminsetting = AdminService.GetAdminSetting();
                    var utmsource    = adminsetting.Utm_Source;
                    var utmmedium    = adminsetting.Utm_Medium;
                    var utmcampaign  = eventid;
                    var utmcontent   = referralid;
                    var utmterm      = adminsetting.Utm_Term;
                    return(Json(new { eventurl = eventurl.ResponseURL + "?&eid=" + eventkey + "&r=" + referralid + "&userid=" + userid + "&exists=" + exists + "&accesstoken=" + accesstoken + "&profileid=" + profile.id + "&utm_source=" + utmsource + "&utm_medium=" + utmmedium + "&utm_campaign=" + utmcampaign + "&utm_content=" + utmcontent + "&utm_term=" + utmterm }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { eventurl = "", data = response.Content, error = response.ErrorMessage, ex = response.ErrorException }, JsonRequestBehavior.AllowGet));
                }
            }
            return(Json(new { eventurl = "", data = response.Content, error = response.ErrorMessage, ex = response.ErrorException }, JsonRequestBehavior.AllowGet));
        }
Пример #6
0
 public static void InsertRegisteredUser(RegisteredUser registeredUser)
 {
     db.RegisteredUsers.Add(registeredUser);
     db.SaveChanges();
 }
Пример #7
0
 public static void UpdateAdminsetting(Adminsetting adminsetting)
 {
     db.Entry(adminsetting).State = EntityState.Modified;
     db.SaveChanges();
 }
Пример #8
0
 public static void InsertTransaction(Transaction transaction)
 {
     db.Transactions.Add(transaction);
     db.SaveChanges();
 }