Exemplo n.º 1
0
        public static void Run()
        {
            // Set up a navigator which looks at sites/pipes/Nozzles/Tee only
            TypeFilter filt = new TypeFilter();

            filt.Add(DbElementTypeInstance.SITE);
            filt.Add(DbElementTypeInstance.PIPE);
            filt.Add(DbElementTypeInstance.NOZZLE);
            filt.Add(DbElementTypeInstance.TEE);
            CompoundFilter filt2 = new CompoundFilter();

            filt2.AddShow(filt);
            ElementTreeNavigator navi = new ElementTreeNavigator(DbElement.GetElement("/*"), filt2);

            // Test FirstMember
            DbElement site = navi.FirstMemberInScan(Example.Instance.mWorld);
            DbElement nozz = navi.FirstMemberInScan(Example.Instance.mZone);

            nozz = navi.FirstMemberInScan(Example.Instance.mEqui);
            DbElement ele = navi.FirstMemberInScan(nozz);

            // Next
            DbElement zone = site.FirstMember();
            DbElement next = navi.NextInScan(zone);

            // parent
            DbElement parent = navi.Parent(Example.Instance.mEqui);

            parent = navi.Parent(nozz);
            parent = navi.Parent(parent);

            //All Members
            DbElement[] tees = navi.MembersInScan(Example.Instance.mPipe);
        }
Exemplo n.º 2
0
        private Boolean EvaluateFilter(Object key, Boolean filter)
        {
            if (KeyFilter == null && CompoundFilter == null)
            {
                return(true);
            }

            if (!filter)
            {
                return(true);
            }

            if (KeyFilter != null && CompoundFilter != null)
            {
                return(KeyFilter.Evaluate((String)key) && CompoundFilter.Evaluate((String)key));
            }

            if (KeyFilter != null)
            {
                return(KeyFilter.Evaluate((String)key));
            }

            if (CompoundFilter != null)
            {
                return(CompoundFilter.Evaluate((String)key));
            }

            return(false);
        }
        public static void Run()
        {
            // Set up a navigator which looks at sites/pipes/Nozzles/Tee only
            TypeFilter filt = new TypeFilter();
            filt.Add(DbElementTypeInstance.SITE);
            filt.Add(DbElementTypeInstance.PIPE);
            filt.Add(DbElementTypeInstance.NOZZLE);
            filt.Add(DbElementTypeInstance.TEE);
            CompoundFilter filt2 = new CompoundFilter();
            filt2.AddShow(filt);
            ElementTreeNavigator navi = new ElementTreeNavigator(DbElement.GetElement("/*"), filt2);

            // Test FirstMember
            DbElement site = navi.FirstMemberInScan(Example.Instance.mWorld);
            DbElement nozz = navi.FirstMemberInScan(Example.Instance.mZone);
            nozz = navi.FirstMemberInScan(Example.Instance.mEqui);
            DbElement ele = navi.FirstMemberInScan(nozz);

            // Next
            DbElement zone = site.FirstMember();
            DbElement next = navi.NextInScan(zone);

            // parent
            DbElement parent = navi.Parent(Example.Instance.mEqui);
            parent = navi.Parent(nozz);
            parent = navi.Parent(parent);

            //All Members
            DbElement[] tees = navi.MembersInScan(Example.Instance.mPipe);
        }
        public void Test2()
        {
            var fastCollection = new FastCollection <int>();
            var filter1        = new ComparisonFilter(OperationTargetBuilder.BuildForRoot(fastCollection), ComparisonFilterType.Less, 4);
            var filter2        = new ComparisonFilter(OperationTargetBuilder.BuildForRoot(fastCollection), ComparisonFilterType.Greater, 6);
            var filter3        = new CompoundFilter(
                CompoundFilter.CompoundFilterType.And,
                filter1, filter2);
            var filter4 = new ComparisonFilter(OperationTargetBuilder.BuildForRoot(fastCollection), ComparisonFilterType.Less, 2);
            var filter5 = new ComparisonFilter(OperationTargetBuilder.BuildForRoot(fastCollection), ComparisonFilterType.Less, 7);
            var filter7 = new CompoundFilter(
                CompoundFilter.CompoundFilterType.And,
                filter4, filter5);
            var filter6 = new ComparisonFilter(OperationTargetBuilder.BuildForRoot(fastCollection), ComparisonFilterType.Less, 8);
            var filter8 = new CompoundFilter(
                CompoundFilter.CompoundFilterType.And,
                filter3, filter7, filter6);

            var executionGroups = FiltersExecutionPipeline.Build(filter8).GetExecutionGroups();

            Assert.AreEqual(0, executionGroups.ElementAt(0).Level);
            CollectionAssert.AreEquivalent(new [] { filter1, filter2, filter4, filter5, filter6 }, executionGroups.ElementAt(0).Filters);
            Assert.AreEqual(1, executionGroups.ElementAt(1).Level);
            Assert.AreEqual(new [] { filter3, filter7 }, executionGroups.ElementAt(1).Filters);
            Assert.AreEqual(2, executionGroups.ElementAt(2).Level);
            Assert.AreEqual(new [] { filter8 }, executionGroups.ElementAt(2).Filters);
        }
Exemplo n.º 5
0
        public override WhereClause AddGlobalWhereClause()
        {
            CompoundFilter filter = new CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, null);
            WhereClause    wc     = new WhereClause();
            String         formula;

            if (BaseFormulaEvaluator.ShouldApplyGlobalWhereClause("Session(\"ActiveEventId\")"))
            {
                formula = EvaluateFormula("Session(\"ActiveEventId\")");
                filter.AddFilter(new BaseClasses.Data.ColumnValueFilter(FieldTripsTable.EventId, formula, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, false));
                wc.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator);
            }

            return(wc);
        }
        public override WhereClause AddGlobalWhereClause()
        {
            CompoundFilter filter = new CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, null);
            WhereClause    wc     = new WhereClause();
            String         formula;

            if (BaseFormulaEvaluator.ShouldApplyGlobalWhereClause("1"))
            {
                formula = EvaluateFormula("1");
                filter.AddFilter(new BaseClasses.Data.ColumnValueFilter(PhotoClubContactLinksTable.RecordDeleted, formula, BaseClasses.Data.BaseFilter.ComparisonOperator.Not_Equals, false));
                wc.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator);
            }

            return(wc);
        }
Exemplo n.º 7
0
        public override WhereClause AddGlobalWhereClause()
        {
            CompoundFilter filter = new CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, null);
            WhereClause    wc     = new WhereClause();
            String         formula;

            if (BaseFormulaEvaluator.ShouldApplyGlobalWhereClause("\"registration\""))
            {
                formula = EvaluateFormula("\"registration\"");
                filter.AddFilter(new BaseClasses.Data.ColumnValueFilter(UsersTable.UserName0, formula, BaseClasses.Data.BaseFilter.ComparisonOperator.Not_Equals, false));
                wc.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator);
            }

            return(wc);
        }
        public void Test1()
        {
            var fastCollection = new FastCollection <int>();
            var filter1        = new ComparisonFilter(OperationTargetBuilder.BuildForRoot(fastCollection), ComparisonFilterType.Less, 3);
            var filter2        = new ComparisonFilter(OperationTargetBuilder.BuildForRoot(fastCollection), ComparisonFilterType.Greater, 6);

            var filter3 = new CompoundFilter(
                CompoundFilter.CompoundFilterType.And,
                filter1,
                filter2);

            var executionGroups = FiltersExecutionPipeline.Build(filter3).GetExecutionGroups();

            Assert.AreEqual(0, executionGroups.ElementAt(0).Level);
            CollectionAssert.AreEquivalent(new [] { filter1, filter2 }, executionGroups.ElementAt(0).Filters);
            Assert.AreEqual(1, executionGroups.ElementAt(1).Level);
            CollectionAssert.AreEquivalent(new [] { filter3 }, executionGroups.ElementAt(1).Filters);
        }
Exemplo n.º 9
0
        public static bool UserInTheseRoles(string[] rollList, string[] roles)
        {
            // Create a where clause for the Static clause defined at design time.
            CompoundFilter filter      = new CompoundFilter(CompoundFilter.CompoundingOperators.Or_Operator, null);
            WhereClause    whereClause = new WhereClause();

            // Find RoleId(s) for defined roles
            foreach (string r in rollList)
            {
                filter.AddFilter(new BaseClasses.Data.ColumnValueFilter(BaseClasses.Data.BaseTable.CreateInstance(@"NOIC.Business.Roles1Table, App_Code").TableDefinition.ColumnList.GetByUniqueName(@"Roles_.RoleName"), r, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, false));
            }
            whereClause.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator);
            OLR.Business.Roles1Record[] roleDetails = OLR.Business.Roles1Table.GetRecords(whereClause, null, 0, 0);

            // Now test to see if current logging in user is assigned one of these roles.
            string[] matchedRoles = { };
            //string roles = "";
            foreach (var r in roleDetails)
            {
                matchedRoles = Array.FindAll(roles, s => s.Equals(r.RoleID.ToString()));
            }

            return(matchedRoles.Length > 0);
        }
        public virtual void SetFieldTripId()
        {
            string selectedValue = null;

            // figure out the selectedValue



            // Set the FieldTripId QuickSelector on the webpage with value from the
            // DatabaseOLR_db%dbo.FieldTripOptions database record.

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

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


            if (this.DataSource != null && this.DataSource.FieldTripIdSpecified)
            {
                // If the FieldTripId is non-NULL, then format the value.
                // The Format method will return the Display Foreign Key As (DFKA) value
                selectedValue = this.DataSource.FieldTripId.ToString();
            }
            else
            {
                // FieldTripId 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 = FieldTripOptionsTable.FieldTripId.DefaultValue;
                }
            }

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


            // Populate the item(s) to the control

            this.FieldTripId.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.FieldTripId, selectedValue) &&
                !MiscUtils.SetSelectedDisplayText(this.FieldTripId, selectedValue))
            {
                // construct a whereclause to query a record with DatabaseOLR_db%dbo.FieldTrips.FieldTripId = selectedValue

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

                // Execute the query
                try
                {
                    FieldTripsRecord[] rc = FieldTripsTable.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)
                    {
                        FieldTripsRecord itemValue = rc[0];
                        string           cvalue    = null;
                        string           fvalue    = null;
                        if (itemValue.FieldTripIdSpecified)
                        {
                            cvalue = itemValue.FieldTripId.ToString();
                        }
                        Boolean _isExpandableNonCompositeForeignKey = FieldTripOptionsTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(FieldTripOptionsTable.FieldTripId);
                        if (_isExpandableNonCompositeForeignKey && FieldTripOptionsTable.FieldTripId.IsApplyDisplayAs)
                        {
                            fvalue = FieldTripOptionsTable.GetDFKA(itemValue, FieldTripOptionsTable.FieldTripId);
                        }
                        if ((!_isExpandableNonCompositeForeignKey) || (String.IsNullOrEmpty(fvalue)))
                        {
                            fvalue = itemValue.Format(FieldTripsTable.Description);
                        }

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

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

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

            url += "?Target=" + this.FieldTripId.ClientID + "&DFKA=" + (this.Page as BaseApplicationPage).Encrypt("Description") + "&IndexField=" + (this.Page as BaseApplicationPage).Encrypt("FieldTripId") + "&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.FieldTripId.Attributes["onClick"] = "initializePopupPage(this, '" + url + "', " + Convert.ToString(FieldTripId.AutoPostBack).ToLower() + ", event); return false;";
        }
        public virtual CompoundFilter CreateCompoundJoinFilter()
        {
            CompoundFilter jFilter = new CompoundFilter();

            return jFilter;
        }
Exemplo n.º 12
0
        protected virtual void UOMID_SelectedIndexChanged(object sender, EventArgs args)
        {
            // If a large list selector or a Quick Add link is used, the dropdown list
            // will contain an item that was not in the original (smaller) list.  During postbacks,
            // this new item will not be in the list - since the list is based on the original values
            // read from the database. This function adds the value back if necessary.
            // In addition, This dropdown can be used on make/model/year style dropdowns.  Make filters the result of Model.
            // Mode filters the result of Year.  When users change the value of Make, Model and Year are repopulated.
            // When this function is fire for Make or Model, we don't want the following code executed.
            // Therefore, we check this situation using Items.Count > 1
            // Since both of these feature use javascript to fire this event, this can be skip if the event is fired by server side,
            // so we check if it is not postback
            if (!this.Page.IsPostBack && this.UOMID.Items.Count > 1)
            {
                string selectedValue = MiscUtils.GetValueSelectedPageRequest(this.UOMID);

            if (selectedValue != null &&
                selectedValue.Trim() != "" &&
                !MiscUtils.SetSelectedValue(this.UOMID, selectedValue) &&
                !MiscUtils.SetSelectedDisplayText(this.UOMID, selectedValue))
            {

                // construct a whereclause to query a record with UOM.UOMID = selectedValue

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

                // Execute the query
                try
                {
                UOMRecord[] rc = UOMTable.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)
                    {

                        string fvalue = ScopeTable.UOMID.Format(selectedValue);

                        ListItem item = new ListItem(fvalue, selectedValue);
                        item.Selected = true;
                        this.UOMID.Items.Add(item);
                    }
                }
                catch
                {
                }

            }

            }
        }
Exemplo n.º 13
0
        // Fill the UOMID list.
        protected virtual void PopulateUOMIDDropDownList(string selectedValue, int maxItems)
        {
            this.UOMID.Items.Clear();

            // 1. Setup the static list items

            // Add the Please Select item.
            this.UOMID.Items.Insert(0, new ListItem(this.Page.GetResourceValue("Txt:PleaseSelect", "FPCEstimate"), "--PLEASE_SELECT--"));

            // 2. Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_UOMIDDropDownList function.
            // It is better to customize the where clause there.

            WhereClause wc = CreateWhereClause_UOMIDDropDownList();

            // Create the ORDER BY clause to sort based on the displayed value.

            OrderBy orderBy = new OrderBy(false, false);
                          orderBy.Add(UOMTable.UOMName, OrderByItem.OrderDir.Asc);

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

            // 3. Read a total of maxItems from the database and insert them into the UOMIDDropDownList.
            UOMRecord[] itemValues  = null;
            if (wc.RunQuery)
            {
                int counter = 0;
                int pageNum = 0;
                FormulaEvaluator evaluator = new FormulaEvaluator();
                do
                {
                    itemValues = UOMTable.GetRecords(wc, orderBy, pageNum, maxItems);
                    foreach (UOMRecord itemValue in itemValues)
                    {
                        // Create the item and add to the list.
                        string cvalue = null;
                        string fvalue = null;
                        if (itemValue.UOMIDSpecified)
                        {
                            cvalue = itemValue.UOMID.ToString().ToString();
                            if (counter < maxItems && this.UOMID.Items.FindByValue(cvalue) == null)
                            {

                                Boolean _isExpandableNonCompositeForeignKey = ScopeTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(ScopeTable.UOMID);
                                if(_isExpandableNonCompositeForeignKey && ScopeTable.UOMID.IsApplyDisplayAs)
                                    fvalue = ScopeTable.GetDFKA(itemValue, ScopeTable.UOMID);
                                if ((!_isExpandableNonCompositeForeignKey) || (String.IsNullOrEmpty(fvalue)))
                                    fvalue = itemValue.Format(UOMTable.UOMName);

                                if (fvalue == null || fvalue.Trim() == "")
                                    fvalue = cvalue;
                                ListItem newItem = new ListItem(fvalue, cvalue);
                                this.UOMID.Items.Add(newItem);
                                counter += 1;
                            }
                        }
                    }
                    pageNum++;
                }
                while (itemValues.Length == maxItems && counter < maxItems);
            }

            // 4. Set the selected value (insert if not already present).

            if (selectedValue != null &&
                selectedValue.Trim() != "" &&
                !MiscUtils.SetSelectedValue(this.UOMID, selectedValue) &&
                !MiscUtils.SetSelectedDisplayText(this.UOMID, selectedValue))
            {

                // construct a whereclause to query a record with UOM.UOMID = selectedValue

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

                // Execute the query
                try
                {
                UOMRecord[] rc = UOMTable.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)
                    {

                        string fvalue = ScopeTable.UOMID.Format(selectedValue);

                        ListItem item = new ListItem(fvalue, selectedValue);
                        item.Selected = true;
                        this.UOMID.Items.Add(item);
                    }
                }
                catch
                {
                }

            }
        }
        public virtual void SetContactId()
        {
            string selectedValue = null;

            // figure out the selectedValue



            // Set the ContactId QuickSelector on the webpage with value from the
            // DatabaseOLR_db%dbo.HonourContactLinks database record.

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

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


            // Default Value could also be NULL.
            if (this.DataSource != null && this.DataSource.IsCreated)
            {
                selectedValue = this.DataSource.ContactId.ToString();
            }
            else
            {
                selectedValue = EvaluateFormula("URL(\"ContactId\")");
            }


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


            // Populate the item(s) to the control

            this.ContactId.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.ContactId, selectedValue) &&
                !MiscUtils.SetSelectedDisplayText(this.ContactId, selectedValue))
            {
                // construct a whereclause to query a record with DatabaseOLR_db%dbo.Contacts.ContactId = selectedValue

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

                // Execute the query
                try
                {
                    ContactsRecord[] rc = ContactsTable.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)
                    {
                        ContactsRecord itemValue = rc[0];
                        string         cvalue    = null;
                        string         fvalue    = null;
                        if (itemValue.ContactIdSpecified)
                        {
                            cvalue = itemValue.ContactId.ToString();
                        }
                        FormulaEvaluator evaluator2 = new FormulaEvaluator();
                        System.Collections.Generic.IDictionary <string, object> variables2 = new System.Collections.Generic.Dictionary <string, object>();


                        variables2.Add(itemValue.TableAccess.TableDefinition.TableCodeName, itemValue);

                        fvalue = EvaluateFormula("=ContactId", itemValue, variables2, evaluator2);

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

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

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

            url += "?Target=" + this.ContactId.ClientID + "&Formula=" + (this.Page as BaseApplicationPage).Encrypt("=ContactId") + "&IndexField=" + (this.Page as BaseApplicationPage).Encrypt("ContactId") + "&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.ContactId.Attributes["onClick"] = "initializePopupPage(this, '" + url + "', " + Convert.ToString(ContactId.AutoPostBack).ToLower() + ", event); return false;";
        }