当前位置: 首页>>代码示例>>C#>>正文


C# Registration.GetAvailability方法代码示例

本文整理汇总了C#中Registration.GetAvailability方法的典型用法代码示例。如果您正苦于以下问题:C# Registration.GetAvailability方法的具体用法?C# Registration.GetAvailability怎么用?C# Registration.GetAvailability使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Registration的用法示例。


在下文中一共展示了Registration.GetAvailability方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnFindTimeSlot_Click

        protected void btnFindTimeSlot_Click(object sender, EventArgs e)
        {
            cvFindTimeSlotUnavailable.IsValid = true;
            cvFindTimeSlotError.IsValid = true;

            try
            {
                    //check if we have a valid club selected
                    Boolean blnClubSuccessfullySelected = clubFindSelect.SelectedIndex != 0;

                    if (blnClubSuccessfullySelected == true)
                    {
                        //Populate Transaction object
                        transaction = new Transaction();

                        int locationId = 0;
                        int.TryParse(clubFindSelect.SelectedValue, out locationId);

                        transaction.QueryLocationId = locationId;
                        transaction.QueryAM = radAMRaceTime.Checked;
                        transaction.QueryDate = Convert.ToDateTime(drpRaceDate.SelectedValue, System.Globalization.CultureInfo.CreateSpecificCulture("en-GB"));

                        if (radRace1.Checked)
                        {
                            transaction.QueryRaceId = 1;
                        }
                        else if (radRace2.Checked)
                        {
                            transaction.QueryRaceId = 2;
                        }
                        else if (radRace3.Checked)
                        {
                            transaction.QueryRaceId = 3;
                        }

                        Registration vs = new Registration();

                        //Add Authentication
                        //vs.PreAuthenticate = true;
                        //NetworkCredential myCred = new NetworkCredential("VARegistration", "cr34m t34");
                        //CredentialCache myCache = new CredentialCache();
                        //myCache.Add(new Uri(vs.Url), "Basic", myCred);
                        //vs.Credentials = myCache;

                        //New code added - alternate way of passing user credentials
                        vs.UserCredentialsValue = getCredentails();

                        transaction = vs.GetAvailability(transaction);

                        if (transaction.Waves != null && transaction.Waves.Count() > 0 && transaction.Status == TransactionStatus.OK)
                        {
                            drpTimeSlot.Items.Clear();

                            //Populate drop down
                            drpTimeSlot.Items.Add(new ListItem(Translate.Text("Select a time slot"), ""));

                            foreach (Wave wave in transaction.Waves)
                            {
                                drpTimeSlot.Items.Add(new ListItem(wave.GunTime.ToString("HH:mm"), wave.GunTime.ToString("HH:mm")));
                            }

                            //save results to session
                            Session["sess_Transaction"] = transaction;

                            //Update Page

                            string classNames;
                            classNames = pnlStep2.Attributes["class"];
                            pnlStep2.Attributes.Add("class", classNames.Replace(" hidden", ""));

                            pnlForm.Update();
                            return;
                        }
                        else if (transaction.Status == TransactionStatus.Unavailable)
                        {
                            //Display message
                            cvFindTimeSlotUnavailable.IsValid = false;

                            //Update Page
                            pnlForm.Update();
                            return;
                        }
                        else
                        {
                            Log.Error(String.Format("Error retrieving Indoor Triathlon time slots: {0}", transaction.Err_msg), this);
                        }
                    }
            }
            catch (Exception ex)
            {
                Log.Error(String.Format("Error retrieving Indoor Triathlon time slots: {0}", ex.Message), null);
            }

            //Error -Display message
            cvFindTimeSlotError.IsValid = false;

            //Update Page
            pnlForm.Update();
        }
开发者ID:jon-mcmr,项目名称:Virgin-Tds,代码行数:99,代码来源:IndoorRegistration.ascx.cs

示例2: btnSelectTimeSlot_Click

        protected void btnSelectTimeSlot_Click(object sender, EventArgs e)
        {
            cvSelectTimeSlotUnavailable.IsValid = true;
            cvSelectTimeSlotError.IsValid = true;

            try
            {

                    //check if we have a valid club selected
                    Boolean blnTimeSuccessfullySelected = clubFindSelect.SelectedIndex != 0;

                    if (blnTimeSuccessfullySelected == true && Session["sess_Transaction"] != null)
                    {
                        //load transaction
                        transaction = (Transaction)Session["sess_Transaction"];
                        //selected wave
                        DateTime selectedWaveDateTime = Convert.ToDateTime(drpRaceDate.SelectedValue.Trim() + " " + drpTimeSlot.SelectedValue.Trim() + ":00", System.Globalization.CultureInfo.CreateSpecificCulture("en-GB"));

                        //set transaction
                        foreach (Wave wave in transaction.Waves)
                        {
                            if (wave.GunTime == selectedWaveDateTime)
                            {
                                //assign wave to subscriber
                                transaction.Subscriber = new Athlete();
                                transaction.Subscriber.Wave = wave;

                                //assign race
                                transaction.Subscriber.Race = wave.Race;
                                Registration vs = new Registration();

                                //Add Authentication
                                //vs.PreAuthenticate = true;
                                //NetworkCredential myCred = new NetworkCredential("VARegistration", "cr34m t34");
                                //CredentialCache myCache = new CredentialCache();
                                //myCache.Add(new Uri(vs.Url), "Basic", myCred);
                                //vs.Credentials = myCache;

                                //New code added - alternate way of passing user credentials
                                vs.UserCredentialsValue = getCredentails();

                                transaction = vs.GetAvailability(transaction);

                                if (transaction.Status == TransactionStatus.OK)
                                {
                                    transaction = vs.Reserve(transaction);

                                    if (transaction.Status == TransactionStatus.OK)
                                    {

                                        Session["sess_Transaction"] = transaction;

                                        //Update Page
                                        string classNames;

                                        classNames = pnlStep3.Attributes["class"];
                                        pnlStep3.Attributes.Add("class", classNames.Replace(" hidden", ""));

                                        classNames = pnlStep4.Attributes["class"];
                                        pnlStep4.Attributes.Add("class", classNames.Replace(" hidden", ""));

                                        classNames = pnlStep5.Attributes["class"];
                                        pnlStep5.Attributes.Add("class", classNames.Replace(" hidden", ""));

                                        classNames = pnlStep6.Attributes["class"];
                                        pnlStep6.Attributes.Add("class", classNames.Replace(" hidden", ""));

                                        classNames = timeWarning.Attributes["class"];
                                        timeWarning.Attributes.Add("class", classNames.Replace(" hidden", ""));

                                        ////Test
                                        //Athlete subscriber = transaction.Subscriber;

                                        //subscriber.IsTeam = true;
                                        //subscriber.Type = AthleteType.Member;

                                        //subscriber.Firstname = "MyName";
                                        //subscriber.Lastname = "MySurname";
                                        //subscriber.Dob = Convert.ToDateTime("12/12/1980", System.Globalization.CultureInfo.CreateSpecificCulture("en-GB"));
                                        //subscriber.Gender = AthleteGender.Male;

                                        //subscriber.Address1 = "MyAddress1";
                                        //subscriber.Address2 = "MyAddress2";
                                        //subscriber.City = "MyAddress3";
                                        //subscriber.Postcode = "sw11 1hh";

                                        //subscriber.Phone = "0123412341234";
                                        //subscriber.Email = "[email protected]";

                                        ////Add Team Details

                                        ////Team name
                                        //subscriber.Team = "My Team";
                                        ////Add user 1
                                        //subscriber.Firstname2 = "MyTeamMateName";
                                        //subscriber.Lastname2 = "MyTeamMateSurname";
                                        //subscriber.Dob2 = Convert.ToDateTime("12/12/1978", System.Globalization.CultureInfo.CreateSpecificCulture("en-GB"));
                                        //subscriber.Gender2 = AthleteGender.Male;

                                        ////Add Next Of Kin
//.........这里部分代码省略.........
开发者ID:jon-mcmr,项目名称:Virgin-Tds,代码行数:101,代码来源:IndoorRegistration.ascx.cs


注:本文中的Registration.GetAvailability方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。