Example #1
0
        private void BindLotteryDropDown()
        {
            using (ServiceLotteryLookup.LotteryLookupServiceClient lotteryLookupService = new ServiceLotteryLookup.LotteryLookupServiceClient())
            {
                ServiceLotteryLookup.LotteryGameDTOCollection lotteryCollection = lotteryLookupService.GetLotteryGameCollection();
                if (lotteryCollection != null && lotteryCollection.Count() > 0)
                {
                    GameList.DataSource = lotteryCollection;
                    GameList.DataBind();

                    GameList.Items.Insert(0, new ListItem { Text = "(Select Game Abbreviation)", Value = "0" });

                    //notes:    set default value if LotteryGameId exists in QueryString
                    GameList.SelectedValue = base.LotteryId.ToString();
                }

                else
                    GameList.Items.Add(new ListItem { Text = "Not Available", Value = "0" });
            }
        }
Example #2
0
        private void DeleteItem(int lotteryGameId)
        {
            using (ServiceLotteryLookup.LotteryLookupServiceClient lotteryLookupService = new ServiceLotteryLookup.LotteryLookupServiceClient())
            {
                try
                {
                    //notes:    call service method to delete item
                    lotteryLookupService.DeleteLotteryGame(lotteryGameId);

                    //notes:    redirect with LotterGameId in Querystring
                    this.ReloadPage(GameList.SelectedValue.ToInt());
                }
                catch (FaultException<ServiceLotteryLookup.LotteryLookupServiceFault> ex)
                {
                    this.DisplayLocalMessage(ex.Message + " " + ex.Detail.ErrorMessage);
                }
            }
        }
Example #3
0
        private void ProcessForm()
        {
            ServiceLotteryLookup.LotteryGameDTO itemToSave = new ServiceLotteryLookup.LotteryGameDTO();

            itemToSave.LotteryGameId = GameList.SelectedValue.ToInt();
            itemToSave.GameName = GameList.Text.Trim();

            //notes:    check hidden value to see if we need to update or insert
            if (HiddenLotteryGameId.Value.ToInt() > 0)
                itemToSave.LotteryGameId = HiddenLotteryGameId.Value.ToInt();

            //notes:    call service to save
            using (ServiceLotteryLookup.LotteryLookupServiceClient lotteryLookupService = new ServiceLotteryLookup.LotteryLookupServiceClient())
            {
                try
                {
                    lotteryLookupService.SaveLotteryGame(itemToSave);

                    //notes:    redirect with LotteryGameId in QueryString
                    this.ReloadPage(GameList.SelectedValue.ToInt());
                }
                catch (FaultException<ServiceLotteryLookup.LotteryLookupServiceFault> ex)
                {

                    this.DisplayLocalMessage(ex.Message + " " + ex.Detail.ErrorMessage);
                }
            }
        }
Example #4
0
        private void BindUpdateIntfo(int lotteryGameId)
        {
            using (ServiceLotteryLookup.LotteryLookupServiceClient lotteryLookupService = new ServiceLotteryLookup.LotteryLookupServiceClient())
            {
                try
                {
                    //notes:    call service to get item
                    ServiceLotteryLookup.LotteryGameDTO itemToUpdate = lotteryLookupService.GetLotteryGame(lotteryGameId);

                    if (itemToUpdate !=null)
                    {
                        //notes:    sert hidden value to Id of item so code knows to update instead of insert
                        HiddenLotteryGameId.Value = itemToUpdate.LotteryGameId.ToString();

                        //notes:    display text in textbox
                        if (!string.IsNullOrEmpty(itemToUpdate.GameName))
                            GameValueField.Text = itemToUpdate.GameName;

                        //notes:    change text on button to update
                        SaveButton.Text = "Update Lookup Value";

                       //notes:     display cancel button
                       CancelButton.Visible = true;
                    }
                    else
                        this.DisplayLocalMessage("Update failed. Couldn't find record.");
                }
                catch (FaultException<ServiceLotteryLookup.LotteryLookupServiceFault> ex)
                {

                    this.DisplayLocalMessage(ex.Message + " " + ex.Detail.ErrorMessage);
                }
            }
        }