Ejemplo n.º 1
0
        public virtual void Delete()
        {
            if (this.IsNewRecord)
            {
                return;
            }

            KeyValue pkValue = KeyValue.XmlToKey(this.RecordUniqueId);

            RegistrationTypesTable.DeleteRecord(pkValue);
        }
Ejemplo n.º 2
0
        public virtual RegistrationTypesRecord GetRecord()

        {
            if (this.DataSource != null)
            {
                return(this.DataSource);
            }

            if (this.RecordUniqueId != null)
            {
                return(RegistrationTypesTable.GetRecord(this.RecordUniqueId, true));
            }

            // Localization.

            throw new Exception(Page.GetResourceValue("Err:RetrieveRec", "OLR"));
        }
        public virtual void SetEventId()
        {
            // Set the EventId Literal on the webpage with value from the
            // DatabaseOLR_db%dbo.RegistrationTypes database record.

            // this.DataSource is the DatabaseOLR_db%dbo.RegistrationTypes record retrieved from the database.
            // this.EventId is the ASP:Literal on the webpage.

            if (this.DataSource != null && this.DataSource.EventIdSpecified)
            {
                // If the EventId is non-NULL, then format the value.
                // The Format method will return the Display Foreign Key As (DFKA) value
                string  formattedValue = "";
                Boolean _isExpandableNonCompositeForeignKey = RegistrationTypesTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(RegistrationTypesTable.EventId);
                if (_isExpandableNonCompositeForeignKey && RegistrationTypesTable.EventId.IsApplyDisplayAs)
                {
                    formattedValue = RegistrationTypesTable.GetDFKA(this.DataSource.EventId.ToString(), RegistrationTypesTable.EventId, null);
                }

                if ((!_isExpandableNonCompositeForeignKey) || (String.IsNullOrEmpty(formattedValue)))
                {
                    formattedValue = this.DataSource.Format(RegistrationTypesTable.EventId);
                }


                formattedValue    = HttpUtility.HtmlEncode(formattedValue);
                this.EventId.Text = formattedValue;
            }

            else
            {
                // EventId is NULL in the database, so use the Default Value.
                // Default Value could also be NULL.

                this.EventId.Text = RegistrationTypesTable.EventId.Format(RegistrationTypesTable.EventId.DefaultValue);
            }

            // If the EventId is NULL or blank, then use the value specified
            // on Properties.
            if (this.EventId.Text == null ||
                this.EventId.Text.Trim().Length == 0)
            {
                // Set the value specified on the Properties.
                this.EventId.Text = " ";
            }
        }
Ejemplo n.º 4
0
        public virtual void LoadData()
        {
            // Load the data from the database into the DataSource DatabaseOLR_db%dbo.RegistrationTypes record.
            // It is better to make changes to functions called by LoadData such as
            // CreateWhereClause, rather than making changes here.


            // The RecordUniqueId is set the first time a record is loaded, and is
            // used during a PostBack to load the record.
            if (this.RecordUniqueId != null && this.RecordUniqueId.Length > 0)
            {
                this.DataSource = RegistrationTypesTable.GetRecord(this.RecordUniqueId, true);

                return;
            }

            // This is the first time a record is being retrieved from the database.
            // So create a Where Clause based on the staic Where clause specified
            // on the Query wizard and the dynamic part specified by the end user
            // on the search and filter controls (if any).

            WhereClause wc = this.CreateWhereClause();

            // If there is no Where clause, then simply create a new, blank record.

            if (wc == null || !(wc.RunQuery))
            {
                this.DataSource = new RegistrationTypesRecord();

                return;
            }

            // Retrieve the record from the database.  It is possible
            RegistrationTypesRecord[] recList = RegistrationTypesTable.GetRecords(wc, null, 0, 2);
            if (recList.Length == 0)
            {
                // There is no data for this Where clause.
                wc.RunQuery = false;

                return;
            }

            // Set DataSource based on record retrieved from the database.
            this.DataSource = (RegistrationTypesRecord)RegistrationTypesRecord.Copy(recList[0], false);
        }
Ejemplo n.º 5
0
        public virtual void SetEventId()
        {
            // Set the EventId LinkButton on the webpage with value from the
            // DatabaseOLR_db%dbo.RegistrationTypes database record.

            // this.DataSource is the DatabaseOLR_db%dbo.RegistrationTypes record retrieved from the database.
            // this.EventId is the ASP:LinkButton on the webpage.

            if (this.DataSource != null && this.DataSource.EventIdSpecified)
            {
                // If the EventId is non-NULL, then format the value.
                // The Format method will return the Display Foreign Key As (DFKA) value
                string  formattedValue = "";
                Boolean _isExpandableNonCompositeForeignKey = RegistrationTypesTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(RegistrationTypesTable.EventId);
                if (_isExpandableNonCompositeForeignKey && RegistrationTypesTable.EventId.IsApplyDisplayAs)
                {
                    formattedValue = RegistrationTypesTable.GetDFKA(this.DataSource.EventId.ToString(), RegistrationTypesTable.EventId, null);
                }

                if ((!_isExpandableNonCompositeForeignKey) || (String.IsNullOrEmpty(formattedValue)))
                {
                    formattedValue = this.DataSource.Format(RegistrationTypesTable.EventId);
                }


                this.EventId.Text = formattedValue;

                this.EventId.ToolTip = "Go to " + this.EventId.Text.Replace("<wbr/>", "");
            }

            else
            {
                // EventId is NULL in the database, so use the Default Value.
                // Default Value could also be NULL.

                this.EventId.Text = RegistrationTypesTable.EventId.Format(RegistrationTypesTable.EventId.DefaultValue);
            }
        }
Ejemplo n.º 6
0
        public virtual void SetEventId()
        {
            string selectedValue = null;

            // figure out the selectedValue



            // Set the EventId QuickSelector on the webpage with value from the
            // DatabaseOLR_db%dbo.RegistrationTypes database record.

            // this.DataSource is the DatabaseOLR_db%dbo.RegistrationTypes record retrieved from the database.
            // this.EventId is the ASP:QuickSelector on the webpage.

            // You can modify this method directly, or replace it with a call to
            //     base.SetEventId();
            // and add your own custom code before or after the call to the base function.


            if (this.DataSource != null && this.DataSource.EventIdSpecified)
            {
                // If the EventId is non-NULL, then format the value.
                // The Format method will return the Display Foreign Key As (DFKA) value
                selectedValue = this.DataSource.EventId.ToString();
            }
            else
            {
                // EventId is NULL in the database, so use the Default Value.
                // Default Value could also be NULL.
                if (this.DataSource != null && this.DataSource.IsCreated)
                {
                    selectedValue = null;
                }
                else
                {
                    selectedValue = RegistrationTypesTable.EventId.DefaultValue;
                }
            }

            // Add the Please Select item.
            if (selectedValue == null || selectedValue == "")
            {
                MiscUtils.ResetSelectedItem(this.EventId, new ListItem(this.Page.GetResourceValue("Txt:PleaseSelect", "OLR"), "--PLEASE_SELECT--"));
            }


            // Populate the item(s) to the control

            this.EventId.SetFieldMaxLength(50);

            System.Collections.Generic.IDictionary <string, object> variables = new System.Collections.Generic.Dictionary <string, object>();
            FormulaEvaluator evaluator = new FormulaEvaluator();

            if (selectedValue != null &&
                selectedValue.Trim() != "" &&
                !MiscUtils.SetSelectedValue(this.EventId, selectedValue) &&
                !MiscUtils.SetSelectedDisplayText(this.EventId, selectedValue))
            {
                // construct a whereclause to query a record with DatabaseOLR_db%dbo.Events.EventId = selectedValue

                CompoundFilter filter2      = new CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, null);
                WhereClause    whereClause2 = new WhereClause();
                filter2.AddFilter(new BaseClasses.Data.ColumnValueFilter(EventsTable.EventId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, false));
                whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator);

                // Execute the query
                try
                {
                    EventsRecord[] rc = EventsTable.GetRecords(whereClause2, new OrderBy(false, false), 0, 1);
                    System.Collections.Generic.IDictionary <string, object> vars = new System.Collections.Generic.Dictionary <string, object> ();
                    // if find a record, add it to the dropdown and set it as selected item
                    if (rc != null && rc.Length == 1)
                    {
                        EventsRecord itemValue = rc[0];
                        string       cvalue    = null;
                        string       fvalue    = null;
                        if (itemValue.EventIdSpecified)
                        {
                            cvalue = itemValue.EventId.ToString();
                        }
                        Boolean _isExpandableNonCompositeForeignKey = RegistrationTypesTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(RegistrationTypesTable.EventId);
                        if (_isExpandableNonCompositeForeignKey && RegistrationTypesTable.EventId.IsApplyDisplayAs)
                        {
                            fvalue = RegistrationTypesTable.GetDFKA(itemValue, RegistrationTypesTable.EventId);
                        }
                        if ((!_isExpandableNonCompositeForeignKey) || (String.IsNullOrEmpty(fvalue)))
                        {
                            fvalue = itemValue.Format(EventsTable.EventId);
                        }

                        if (fvalue == null || fvalue.Trim() == "")
                        {
                            fvalue = cvalue;
                        }
                        MiscUtils.ResetSelectedItem(this.EventId, new ListItem(fvalue, cvalue));
                    }
                }
                catch
                {
                }
            }

            string url = this.ModifyRedirectUrl("../Events/Events-QuickSelector.aspx", "", true);

            url = this.Page.ModifyRedirectUrl(url, "", true);

            url += "?Target=" + this.EventId.ClientID + "&Formula=" + (this.Page as BaseApplicationPage).Encrypt("=Events.EventName") + "&IndexField=" + (this.Page as BaseApplicationPage).Encrypt("EventId") + "&EmptyValue=" + (this.Page as BaseApplicationPage).Encrypt("--PLEASE_SELECT--") + "&EmptyDisplayText=" + (this.Page as BaseApplicationPage).Encrypt(this.Page.GetResourceValue("Txt:PleaseSelect")) + "&Mode=" + (this.Page as BaseApplicationPage).Encrypt("FieldValueSingleSelection") + "&RedirectStyle=" + (this.Page as BaseApplicationPage).Encrypt("Popup");

            this.EventId.Attributes["onClick"] = "initializePopupPage(this, '" + url + "', " + Convert.ToString(EventId.AutoPostBack).ToLower() + ", event); return false;";
        }