public static void SetSSOEndpointUrl(int customerId, string endpointUrl)
 {
     var db = new ClientDataContext();
     var config = db.XAuthConfigurations.Single(c => c.CustomerId == customerId);
     config.SSOServiceEndpointUrl = endpointUrl;
     db.SubmitChanges();
 }
        /// <summary>
        /// Change the transactions of specified registrant to one day ago to settle them
        /// </summary>
        /// <param name="registerId"></param>
        public void ChangeTransactionDateToSettle(int registerId)
        {
            ClientDataContext db = new ClientDataContext();

            List<Transaction> transactions = (from t in db.Transactions where t.RegisterId == registerId select t).ToList();

            foreach (Transaction t in transactions)
            {
                if (t.TransDate.HasValue)
                {
                    t.TransDate = t.TransDate.Value.AddDays(-1);
                }
            }

            db.SubmitChanges();
        }
        public void SetGroupDiscountPopUpMessage(int eventID, string message)
        {
            // If there is no custom pop up message use default message
            if (message == null)
            {
                UIUtil.DefaultProvider.WaitForDisplayAndClick("restore default", LocateBy.LinkText);
            }
            else
            {
                //S.DiscountRulesService discountRuleService = new S.DiscountRulesService();
                //E.TList<E.DiscountRules> discountRules = discountRuleService.GetByEventId(eventID);
                List<DiscountRule> discountRules = new List<DiscountRule>();

                ClientDataContext db = new ClientDataContext();
                discountRules = (from d in db.DiscountRules where d.EventId == eventID select d).ToList();

                if (discountRules.Count > 0)
                {
                    foreach (DiscountRule discountRule in discountRules)
                    {
                        if (discountRule.isCurrent)
                        {
                            discountRule.Reg_Description = Convert.ToString(message);
                            db.SubmitChanges();
                            //discountRuleService.Save(discountRule);
                            break;
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Call database to set message
        /// </summary>
        /// <param name="message"></param>
        public void SetMinimumRegistrantMessageInDatabase(int eventId, string regTypeName, string message)
        {
            //S.EventRegTypesService regTypeService = new S.EventRegTypesService();
            //E.TList<E.EventRegTypes> regTypes = regTypeService.GetByEventId(eventId);
            List<EventRegType> regTypes = new List<EventRegType>();

            ClientDataContext db = new ClientDataContext();
            regTypes = (from rt in db.EventRegTypes where rt.EventId == eventId select rt).ToList();

            if (regTypes.Count > 0)
            {
                foreach (EventRegType regType in regTypes)
                {
                    if (regType.Description == regTypeName)
                    {
                        regType.MinRegsMessage = Convert.ToString(message);
                        db.SubmitChanges();
                        //regTypeService.Save(regType);
                        break;
                    }
                }
            }
        }
 public void UndoCheckIn(string connectionString, int RegisterId)
 {
     //B.Data.DataProvider.ExecuteNonQuery(connectionString, System.Data.CommandType.Text, "checkOutRegistrant " + RegisterId.ToString());
     ClientDataContext db = new ClientDataContext();
     Registration reg = (from r in db.Registrations where r.Register_Id == RegisterId select r).Single();
     reg.StatusId = 2;
     db.SubmitChanges();
 }
 public void SetRegistrationStatus(int RegisterId, int StatusId, Event evt)
 {
     ClientDataContext db = new ClientDataContext();
     Registration reg = (from r in db.Registrations where r.Event == evt && r.Register_Id == RegisterId select r).Single();
     reg.StatusId = StatusId;
     db.SubmitChanges();
     //C.Registration reg = C.Registration.GetByRegistrationIDEventID(RegisterId, evt);
     //reg.UpdateStatus(RegisterId, (C.RegistrationStatusType)StatusId);
 }