Ejemplo n.º 1
0
        void SaveChoice()
        {
            Int64 pollId = Convert.ToInt64(_id.Text);
            Int64 id     = 0;

            AWAPI_Data.Data.awPollChoice pc = new AWAPI_Data.Data.awPollChoice();


            if (_choiceTitle.Text.Trim() == "")
            {
                AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, "Choice title is required.");
                return;
            }


            try
            {
                pc.title       = _choiceTitle.Text;
                pc.description = _choiceDescription.Text;
                pc.sortOrder   = Convert.ToInt32(_choiceSortOrder.Text);

                if (_choiceId.Text.Trim() != "" && !String.IsNullOrEmpty(_culture.SelectedValue) &&
                    !String.IsNullOrEmpty(App_Code.SessionInfo.CurrentSite.cultureCode) && App_Code.SessionInfo.CurrentSite.cultureCode != _culture.SelectedValue)
                {
                    _pollLibrary.UpdatePollChoiceForCulture(Convert.ToInt64(_choiceId.Text), _culture.SelectedValue, pc.title, pc.description);
                }
                else
                {
                    if (_choiceId.Text.Trim() == "")
                    {
                        id = _pollLibrary.AddPollChoice(pollId, pc.title, pc.description, pc.sortOrder);
                    }
                    else
                    {
                        id = Convert.ToInt64(_choiceId.Text);
                        _pollLibrary.UpdatePollChoice(id, pc.title, pc.description, pc.sortOrder);
                    }
                    _choiceId.Text = id.ToString();
                }
                ShowHideChoiceControls(true);
                PopulateChoiceList();

                AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "Poll choice has been saved.");
            }
            catch (Exception ex)
            {
                AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, ex.Message);
            }
        }
Ejemplo n.º 2
0
        void PopulateChoice(Int64 choiceId)
        {
            string cultureCode = _culture.SelectedValue.ToLower();

            //set the default culture code if it is emmpty
            if (String.IsNullOrEmpty(cultureCode) &&                                              //culture code is null
                _culture.Items.FindByValue(App_Code.SessionInfo.CurrentSite.cultureCode) != null) //session culture code exists in the list
            {
                _culture.SelectedValue = App_Code.SessionInfo.CurrentSite.cultureCode;
            }

            AWAPI_Data.Data.awPollChoice pc = _pollLibrary.GetPollChoice(choiceId, cultureCode);

            _choiceId.Text          = pc.pollChoiceId.ToString();
            _choiceTitle.Text       = pc.title;
            _choiceDescription.Text = pc.description;
            _choiceSortOrder.Text   = pc.sortOrder.ToString();

            ShowHideChoiceControls(true);
        }
Ejemplo n.º 3
0
 partial void DeleteawPollChoice(awPollChoice instance);
Ejemplo n.º 4
0
 partial void UpdateawPollChoice(awPollChoice instance);
Ejemplo n.º 5
0
 partial void InsertawPollChoice(awPollChoice instance);
Ejemplo n.º 6
0
 private void detach_awPollChoices(awPollChoice entity)
 {
     this.SendPropertyChanging();
     entity.awPoll = null;
 }
Ejemplo n.º 7
0
 private void attach_awPollChoices(awPollChoice entity)
 {
     this.SendPropertyChanging();
     entity.awPoll = this;
 }