Ejemplo n.º 1
0
        protected void OnConditionDeleteClick(object sender, EventArgs e)
        {
            var button = (LinkButton)sender;
            var campaignConditionID = int.Parse(button.CommandArgument);

            _campaignCondition.TSP_CampaignConditions(2, campaignConditionID);
            CampaignConditionRepeater.DataBind();
            ScrollTargetHidden.Value = "ConditionListHeader";
        }
Ejemplo n.º 2
0
        protected void ApproveConditionLink_OnClick(object sender, EventArgs e)
        {
            int?    operatorID   = null;
            Guid?   valueGuid    = null;
            int?    valueInt     = null;
            string  valueString  = null;
            decimal?valueDecimal = null;

            int?     additionalOperatorID = null;
            Guid?    additionalValueGuid = null;
            int?     additionalValueInt = null;
            string   additionalValueString = null;
            decimal? additionalValueDecimal = null;
            int?     advancedCalculationMethodID = null;
            int?     advancedTimePeriodTypeID = null;
            DateTime?advancedFromDate = null, advancedToDate = null;
            TimeSpan?movieSeasonsFilterFromDate = null, movieSeasonsFilterToDate = null;

            var isValueValid = true;
            var isAdditionalValueValid = true;

            if (ConditionTemplateSectionPlaceHolder.Visible)
            {
                operatorID   = Convert.ToInt32(OperatorComboBox.Value);
                isValueValid = IsConditionValueValid(ValueListHidden, ValueTextBox, out valueInt, out valueGuid, out valueString, out valueDecimal);
            }

            if (ConditionTemplateAdditionalSectionPlaceHolder.Visible)
            {
                additionalOperatorID   = Convert.ToInt32(AdditionalOperatorComboBox.Value);
                isAdditionalValueValid = IsConditionValueValid(AdditionalValueListHidden, AdditionalValueTextBox, out additionalValueInt, out additionalValueGuid, out additionalValueString, out additionalValueDecimal);
            }

            if (ConditionTemplateAdvancedTimePeriodPlaceHolder.Visible)
            {
                advancedCalculationMethodID = GetDictionaryIDCodeValStringCodePart(AdvancedCalculationMethodComboBox.Value.ToString(), 0);
                advancedTimePeriodTypeID    = GetDictionaryIDCodeValStringCodePart(AdvancedTimePeriodTypeComboBox.Value.ToString(), 0);
                var advancedTimePeriodTypeCodeVal = GetDictionaryIDCodeValStringCodePart(AdvancedTimePeriodTypeComboBox.Value.ToString(), 1);

                if (advancedTimePeriodTypeCodeVal == 1)
                {
                    DateTime d;
                    if (AdvancedFromDate.Value != null && DateTime.TryParse(AdvancedFromDate.Value.ToString(), out d))
                    {
                        advancedFromDate = d;
                    }

                    if (AdvancedToDate.Value != null && DateTime.TryParse(AdvancedToDate.Value.ToString(), out d))
                    {
                        advancedToDate = d;
                    }
                }
            }

            if (MovieSessionsPlaceHolder.Visible)
            {
                var fromTime = MovieSessionFilterFromTime.Value as DateTime?;
                var toTime   = MovieSessionFilterToTime.Value as DateTime?;

                if (fromTime != null && toTime != null)
                {
                    movieSeasonsFilterFromDate = new TimeSpan(fromTime.Value.Hour, fromTime.Value.Minute, fromTime.Value.Second);
                    movieSeasonsFilterToDate   = new TimeSpan(toTime.Value.Hour, toTime.Value.Minute, toTime.Value.Second);
                }
                else
                {
                    isValueValid = false;
                }
            }


            if (isValueValid && isAdditionalValueValid && ConditionComboBox.Value != null)
            {
                _campaignCondition.TSP_CampaignConditions(0, null, _campaignID, SelectedConditionID.Value, operatorID, additionalOperatorID, valueString, additionalValueString, valueInt, additionalValueInt, valueGuid, additionalValueGuid, advancedTimePeriodTypeID, advancedCalculationMethodID, advancedFromDate, advancedToDate, valueDecimal, movieSeasonsFilterFromDate, movieSeasonsFilterToDate);
                ResetConditionTemplate();
                CampaignConditionRepeater.DataBind();
            }

            ScrollTargetHidden.Value = "ConditionListHeader";
        }