Exemplo n.º 1
0
        //Add Data From Linked Tables for Display
        public void EditItemForDisplay(ControlValueLanguage controlValueLanguage)
        {
            //Add LanguageName
            if (controlValueLanguage.LanguageCode != null)
            {
                LanguageRepository languageRepository = new LanguageRepository();
                Language           language           = new Language();
                language = languageRepository.GetLanguage(controlValueLanguage.LanguageCode);
                if (language != null)
                {
                    controlValueLanguage.LanguageName = language.LanguageName;
                }
            }

            //Add PolicyGroupName
            ControlValueRepository controlValueRepository = new ControlValueRepository();
            ControlValue           controlValue           = new ControlValue();

            controlValue = controlValueRepository.GetControlValue(controlValueLanguage.ControlValueId);

            if (controlValue != null)
            {
                controlValueRepository.EditForDisplay(controlValue);
                //controlValueLanguage.ControlValue = controlValue.ControlValue1;
            }
        }
        // GET: /Create
        public ActionResult Create()
        {
            //AccessRights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToReferenceInfo())
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            ControlPropertyRepository controlPropertyRepository = new ControlPropertyRepository();
            SelectList controlPropertyList = new SelectList(controlPropertyRepository.GetAllControlProperties().ToList(), "ControlPropertyId", "ControlPropertyDescription");

            ViewData["ControlProperties"] = controlPropertyList;

            ControlNameRepository controlNameRepository = new ControlNameRepository();
            SelectList            controlNameList       = new SelectList(controlNameRepository.GetAllControlNames().ToList(), "ControlNameId", "ControlName1");

            ViewData["ControlNames"] = controlNameList;

            ControlValue controlValue = new ControlValue();

            return(View(controlValue));
        }
        // GET: /Edit
        public ActionResult Edit(int id)
        {
            //Check Exists
            ControlValue controlValue = new ControlValue();

            controlValue = controlValueRepository.GetControlValue(id);
            if (controlValue == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }
            //AccessRights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToReferenceInfo())
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            ControlPropertyRepository controlPropertyRepository = new ControlPropertyRepository();
            SelectList controlPropertyList = new SelectList(controlPropertyRepository.GetAllControlProperties().ToList(), "ControlPropertyId", "ControlPropertyDescription");

            ViewData["ControlProperties"] = controlPropertyList;

            ControlNameRepository controlNameRepository = new ControlNameRepository();
            SelectList            controlNameList       = new SelectList(controlNameRepository.GetAllControlNames().ToList(), "ControlNameId", "ControlName1");

            ViewData["ControlNames"] = controlNameList;

            return(View(controlValue));
        }
        //Delete From DB
        public void Delete(ControlValue controlValue)
        {
            string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            db.spDesktopDataAdmin_DeleteControlValue_v1(
                controlValue.ControlValueId,
                adminUserGuid,
                controlValue.VersionNumber
                );
        }
Exemplo n.º 5
0
 /// <summary>
 /// Sets control value
 /// </summary>
 /// <param name="control"></param>
 /// <param name="message"></param>
 void SetControlValue(ControlValue cv)
 {
     if (!_controlValues.ContainsKey(cv.ValueControl.ClientID))
     {
         _controlValues.Add(cv.ValueControl.ClientID, cv);
     }
     else
     {
         _controlValues[cv.ValueControl.ClientID] = cv;
     }
 }
Exemplo n.º 6
0
        public static Func <T, IPromise <ControlValue <E> > > Canonical <T, E>(this PromiseFactory factory, Func <T, IPromise <NullableResult <E> > > fn)
        {
            return(factory.Canonical <T, E>(x => factory.SafeThen(fn(x), result =>
            {
                if (result == null || !result.HasResult)
                {
                    return ControlValue <E> .Next;
                }

                return ControlValue <E> .Return(result.Result);
            })));
        }
        //Add to DB
        public void Add(ControlValue controlValue)
        {
            string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            db.spDesktopDataAdmin_InsertControlValue_v1(
                controlValue.ControlValueId,
                controlValue.ControlPropertyId,
                controlValue.ControlNameId,
                controlValue.DefaultValueFlag,
                controlValue.ControlValue1,
                adminUserGuid
                );
        }
Exemplo n.º 8
0
        protected override bool OnSaveChanges()
        {
            var  info = Grid.Model[RowIndex, ColIndex];
            Type type = info.CellValue.GetType();

            if (type == ControlValue.GetType())
            {
                return(base.OnSaveChanges());
            }

            Grid.Model[RowIndex, ColIndex].CellValue = info.CellValue;

            return(true);
        }
        // GET: /View
        public ActionResult View(int id)
        {
            //Check Exists
            ControlValue controlValue = new ControlValue();

            controlValue = controlValueRepository.GetControlValue(id);
            if (controlValue == null)
            {
                ViewData["ActionMethod"] = "ViewGet";
                return(View("RecordDoesNotExistError"));
            }

            controlValueRepository.EditForDisplay(controlValue);
            return(View(controlValue));
        }
        //GET:List
        public ActionResult List(int id, int?page, string sortField, int?sortOrder)
        {
            //Get PolicyAirVendorGroupItem
            ControlValue controlValue = new ControlValue();

            controlValue = controlValueRepository.GetControlValue(id);

            //Check Exists
            if (controlValue == null)
            {
                ViewData["ActionMethod"] = "ListGet";
                return(View("RecordDoesNotExistError"));
            }

            //Set Access Rights
            ViewData["Access"] = "";
            RolesRepository rolesRepository = new RolesRepository();

            if (rolesRepository.HasWriteAccessToReferenceInfo())
            {
                ViewData["Access"] = "WriteAccess";
            }

            //SortField+SortOrder settings
            if (sortField != "ControlValueTranslation")
            {
                sortField = "LanguageName";
            }
            if (sortOrder == 1)
            {
                ViewData["NewSortOrder"]     = 0;
                ViewData["CurrentSortOrder"] = 1;
            }
            else
            {
                ViewData["NewSortOrder"]     = 1;
                ViewData["CurrentSortOrder"] = 0;
                sortOrder = 0;
            }

            ViewData["ControlValueId"] = controlValue.ControlValueId;

            //return items
            var cwtPaginatedList = controlValueLanguageRepository.PageControlValueLanguages(id, page ?? 1, sortField, sortOrder ?? 0);

            return(View(cwtPaginatedList));
        }
Exemplo n.º 11
0
        public If ElseIf(Func <IPromise <ControlValue <bool> > > newCondition)
        {
            return(new If(Factory, () => Factory.SafeThen(_condition, check =>
            {
                if (check == null || check.State != ControlState.Return || !check.HasValue)
                {
                    return Factory.Value(ControlValue <bool> .Break);
                }

                if (check.Value)
                {
                    return Factory.Value(ControlValue <bool> .Return(false));
                }

                return newCondition();
            })));
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            //Get Item From Database
            ControlValue controlValue = new ControlValue();

            controlValue = controlValueRepository.GetControlValue(id);

            //Check Exists
            if (controlValue == null)
            {
                ViewData["ActionMethod"] = "DeletePost";
                return(View("RecordDoesNotExistError"));
            }

            //AccessRights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToReferenceInfo())
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }
            //Delete Item
            try
            {
                controlValue.VersionNumber = Int32.Parse(collection["VersionNumber"]);
                controlValueRepository.Delete(controlValue);
            }
            catch (SqlException ex)
            {
                //Versioning Error - go to standard versionError page
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/ControlValue.mvc/Delete/" + controlValue.ControlValueId;
                    return(View("VersionError"));
                }
                LogRepository logRepository = new LogRepository();
                logRepository.LogError(ex.Message);

                ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details";
                return(View("Error"));
            }

            return(RedirectToAction("List"));
        }
Exemplo n.º 13
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var form = context.PeekNearest <IFormContext>();
            var tb   = context.CreateTagBuilder("div");

            tb.AddCssClass("form-group");
            if (ControlContextValue != null)
            {
                if (ControlContextValue.HasErrors)
                {
                    tb.AddCssClass("has-error");
                }
                else if (ControlContextValue.HasWarning)
                {
                    tb.AddCssClass("has-warning");
                }
            }

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            context.Push(this);

            if (LabelValue != null)
            {
                LabelValue.WriteTo(writer, context);
            }

            if (ControlValue != null)
            {
                using (context.CreateWriter <FormGroupControls, AnyContent>().WithoutLabel(LabelValue == null).BeginContent(writer))
                {
                    ControlValue.WriteTo(writer, context);
                }
            }

            if (form != null && form.TypeValue == FormType.Inline)
            {
                return("</div> "); // trailing space is important for inline forms! Bootstrap does not provide spacing between groups in css!
            }

            return("</div>");
        }
        public ActionResult Create(ControlValueLanguage controlValueLanguage)
        {
            ControlValue controlValue = new ControlValue();

            controlValue = controlValueRepository.GetControlValue(controlValueLanguage.ControlValueId);

            //Check Exists
            if (controlValue == null)
            {
                ViewData["ActionMethod"] = "CreatePost";
                return(View("RecordDoesNotExistError"));
            }

            //AccessRights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToReferenceInfo())
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            //Update  Model from Form
            try
            {
                UpdateModel(controlValueLanguage);
            }
            catch
            {
                string n = "";
                foreach (ModelState modelState in ViewData.ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        n += error.ErrorMessage;
                    }
                }
                ViewData["Message"] = "ValidationError : " + n;
                return(View("Error"));
            }

            controlValueLanguageRepository.Add(controlValueLanguage);

            return(RedirectToAction("List", new { id = controlValue.ControlValueId }));
        }
Exemplo n.º 15
0
        public override string ToString()
        {
            string result = "";

            try
            {
                result =
                    "Type=" + Type.ToString() + Environment.NewLine +
                    "ControlValue=" + ControlValue.ToString() + Environment.NewLine +
                    "MaxValue=" + MaxValue.ToString() + Environment.NewLine +
                    "MinValue=" + MinValue.ToString();
            }
            catch (Exception ex)
            {
                result = ex.ToString();
            }
            return(result);
        }
Exemplo n.º 16
0
        public DefaultControlPoint(ControlValue value, float delta, float maxWidth, float maxHeight)
        {
            ControlValue = value;

            Delta          = delta;
            ActualAreaSize = new Size(maxWidth, maxHeight);

            var transformGroup = new TransformGroup();

            transformGroup.Children.Add(Translate);

            RenderTransform       = transformGroup;
            RenderTransformOrigin = new Point(0.5, 0.5);

            RangeControlPoint = new RangeControlPoint(this);

            Placement();
        }
        //Add Data From Linked Tables for Display
        public void EditForDisplay(ControlValue controlValue)
        {
            ControlPropertyRepository controlPropertyRepository = new ControlPropertyRepository();
            ControlProperty           controlProperty           = new ControlProperty();

            controlProperty = controlPropertyRepository.GetControlProperty(controlValue.ControlPropertyId);
            if (controlProperty != null)
            {
                controlValue.ControlPropertyDescription = controlProperty.ControlPropertyDescription;
            }
            //ControlNameRepository controlNameRepository = new ControlNameRepository();
            //ControlName controlName = new ControlName();
            //controlName = controlNameRepository.GetControlName(controlValue.ControlNameId);
            //if (controlName != null)
            //{
            //    controlValue.ControlName = controlName.ControlName1;
            // }
        }
Exemplo n.º 18
0
 /// <summary>Подготовка значений полей параметров для сохранения</summary>
 public override List <ControlValue> PrepareUiParamsProperties(List <ControlValue> props)
 {
     foreach (var par in uiParams.SelectMany(x => x.Value))
     {
         var prop = new ControlValue()
         {
             TypeName = par.GetType().Name, Name = par.Name
         };
         object value = par.GetControlValue();
         prop.Value = (value is DateTime ? ((DateTime)value).ToString("dd.MM.yyyy HH:mm:ss") : value?.ToString());
         props.Add(prop);
     }
     PrepareUiParamsForSave?.Invoke(this, new UiParamsPropsEventArgs()
     {
         Props = props
     });
     return(props);
 }
        public ActionResult Create(ControlValue controlValue)
        {
            //AccessRights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToReferenceInfo())
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            //Update  Model from Form
            try
            {
                UpdateModel(controlValue);
            }
            catch
            {
                string n = "";
                foreach (ModelState modelState in ViewData.ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        n += error.ErrorMessage;
                    }
                }
                ViewData["Message"] = "ValidationError : " + n;
                return(View("Error"));
            }

            //Database Update
            try
            {
                controlValueRepository.Add(controlValue);
            }
            catch
            {
                //Could not insert to database
                return(View("Error"));
            }

            ViewData["NewSortOrder"] = 0;
            return(RedirectToAction("List"));
        }
Exemplo n.º 20
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (ControlAnnotation != null ? ControlAnnotation.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ControlValue != null ? ControlValue.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CaseValue != null ? CaseValue.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IdentityAnnotation != null ? IdentityAnnotation.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ AverageTechnicalReplicates.GetHashCode();
         hashCode = (hashCode * 397) ^ SumTransitions.GetHashCode();
         hashCode = (hashCode * 397) ^ NormalizationMethod.GetHashCode();
         hashCode = (hashCode * 397) ^ IncludeInteractionTransitions.GetHashCode();
         hashCode = (hashCode * 397) ^ SummarizationMethod.GetHashCode();
         hashCode = (hashCode * 397) ^ ConfidenceLevel.GetHashCode();
         hashCode = (hashCode * 397) ^ PerProtein.GetHashCode();
         return(hashCode);
     }
 }
Exemplo n.º 21
0
        public If <T> ElseIf(Action <Scope <bool> > condition)
        {
            return(new If <T>(_owner, block =>
            {
                block.Return(() => _owner.BeginImmediately(_condition).Finish().Then(result =>
                {
                    if (result == null || result.State != ControlState.Return || !result.HasValue)
                    {
                        return _owner.Factory.Value(result);
                    }

                    if (result.Value)
                    {
                        return _owner.Factory.Value(ControlValue <bool> .Return(false));
                    }

                    return _owner.BeginImmediately(condition).Finish();
                }));
            }));
        }
        // GET: /Create
        public ActionResult Create(int id)
        {
            //Get ControlValue
            ControlValue controlValue = new ControlValue();

            controlValue = controlValueRepository.GetControlValue(id);

            //Check Exists
            if (controlValue == null)
            {
                ViewData["ActionMethod"] = "CreateGet";
                return(View("RecordDoesNotExistError"));
            }

            //AccessRights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToReferenceInfo())
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            //Parent data
            ViewData["ControlValueId"] = id;
            ViewData["ControlValue"]   = controlValue.ControlValue1;

            //New ControlValueLanguage
            ControlValueLanguage controlValueLanguage = new ControlValueLanguage();

            controlValueLanguage.ControlValueId = id;
            controlValueLanguageRepository.EditItemForDisplay(controlValueLanguage);

            //Language SelectList
            SelectList languageList = new SelectList(controlValueLanguageRepository.GetUnUsedLanguages(id).ToList(), "LanguageCode", "LanguageName");

            ViewData["Languages"] = languageList;

            //Show Create Form
            return(View(controlValueLanguage));
        }
Exemplo n.º 23
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (ControlAnnotation != null ? ControlAnnotation.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ControlValue != null ? ControlValue.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CaseValue != null ? CaseValue.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IdentityAnnotation != null ? IdentityAnnotation.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ AverageTechnicalReplicates.GetHashCode();
         hashCode = (hashCode * 397) ^ (NormalizationMethod != null ? NormalizationMethod.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IncludeInteractionTransitions.GetHashCode();
         hashCode = (hashCode * 397) ^ (SummarizationMethod != null ? SummarizationMethod.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ConfidenceLevelTimes100.GetHashCode();
         hashCode = (hashCode * 397) ^ PerProtein.GetHashCode();
         hashCode = (hashCode * 397) ^ UseZeroForMissingPeaks.GetHashCode();
         hashCode = (hashCode * 397) ^ QValueCutoff.GetHashCode();
         hashCode = (hashCode * 397) ^ (ColorRows != null ? ColorRows.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemplo n.º 24
0
        private void AddRecord(object sender, RoutedEventArgs e)
        {
            RecordsManager manager = DataContext as RecordsManager;
            StackPanel     c       = FindName("Entries") as StackPanel;
            int            count   = manager.Description.Count;
            Record         rec     = new Record(count);

            for (int index = 0, i = 0; i < c.Children.Count; i++)
            {
                ControlValue val = c.Children[i] as ControlValue;
                if (val == null)
                {
                    continue;
                }
                rec.SetValue(val.ConvertToValue(), index);
                index++;
            }
            ParentContent.OnInfo("Added record");
            manager.AddRecord(rec);
            CreateNewForm();
        }
        public ActionResult Delete(int id)
        {
            //Check Exists
            ControlValue controlValue = new ControlValue();

            controlValue = controlValueRepository.GetControlValue(id);
            if (controlValue == null)
            {
                ViewData["ActionMethod"] = "DeleteGet";
                return(View("RecordDoesNotExistError"));
            }

            //AccessRights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToReferenceInfo())
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            controlValueRepository.EditForDisplay(controlValue);
            return(View(controlValue));
        }
Exemplo n.º 26
0
 public static Func <T, IPromise <ControlValue <E> > > Canonical <T, E>(this PromiseFactory factory, Func <T, IPromise <E> > fn)
 {
     return(factory.Canonical <T, E>(x => factory.SafeThen(fn(x), result => ControlValue <E> .Return(result))));
 }
Exemplo n.º 27
0
 /// <summary>
 /// Sets control value
 /// </summary>
 /// <param name="control"></param>
 /// <param name="message"></param>
 void SetControlValue(ControlValue cv)
 {
     if (!_controlValues.ContainsKey(cv.ValueControl.ClientID))
     {
         _controlValues.Add(cv.ValueControl.ClientID, cv);
     }
     else
     {
         _controlValues[cv.ValueControl.ClientID] = cv;
     }
 }
Exemplo n.º 28
0
 public static Func <IPromise <ControlValue <T> > > Canonical <T>(this PromiseFactory factory, Func <IPromise <T> > fn)
 {
     return(factory.Canonical(() => factory.SafeThen(fn, result => ControlValue <T> .Return(result))));
 }
Exemplo n.º 29
0
        private void FormatTextToPrint()
        {
            TextBox             txt  = null;
            CheckBox            chk  = null;
            ComboBox            cbo  = null;
            List <ControlValue> ctls = new List <ControlValue>();
            int maxlenDescription    = 0;

            foreach (Control ctl in this.Controls)
            {
                if (ctl is TextBox)
                {
                    txt = (TextBox)ctl;
                    ControlValue val = new ControlValue();
                    val.TabIndex    = txt.TabIndex;
                    val.Value       = txt.Text;
                    val.Description = "Field" + val.TabIndex.ToString();
                    Label lbl = this.Controls.Find("lbl" + txt.Name.Replace("txt", ""), true).FirstOrDefault() as Label;
                    if (lbl != null)
                    {
                        val.Description = lbl.Text;
                    }
                    else
                    {
                        val.Description = txt.Tag != null?txt.Tag.ToString() : val.Description;
                    }
                    ctls.Add(val);
                }
                if (ctl is ComboBox)
                {
                    cbo = (ComboBox)ctl;
                    ControlValue val = new ControlValue();
                    val.TabIndex    = cbo.TabIndex;
                    val.Value       = cbo.Text;
                    val.Description = "Field" + val.TabIndex.ToString();
                    Label lbl = this.Controls.Find("lbl" + cbo.Name.Replace("cbo", ""), true).FirstOrDefault() as Label;
                    if (lbl != null)
                    {
                        val.Description = lbl.Text;
                    }
                    else
                    {
                        val.Description = cbo.Tag != null?txt.Tag.ToString() : val.Description;
                    }
                    ctls.Add(val);
                }
                if (ctl is CheckBox)
                {
                    chk = (CheckBox)ctl;
                    ControlValue val = new ControlValue();
                    val.Value       = chk.Checked.ToString();
                    val.Description = chk.Text;
                    val.TabIndex    = chk.TabIndex;
                    ctls.Add(val);
                }
            }//end foreach

            foreach (ControlValue cv in ctls)
            {
                if (cv.Description.Length > maxlenDescription)
                {
                    maxlenDescription = cv.Description.Length;
                }
            }

            IntComparer ic = new IntComparer();

            ctls.Sort(ic);

            _textToPrint.Length = 0;
            foreach (ControlValue cv in ctls)
            {
                string desc = cv.Description + new String(' ', maxlenDescription);
                desc = desc.Substring(0, maxlenDescription) + " ";
                _textToPrint.Append(desc);
                _textToPrint.Append(cv.Value);
                _textToPrint.Append(Environment.NewLine);
            }
        }//end method
Exemplo n.º 30
0
 public If <T> If(ControlValue <bool> condition)
 {
     return(If(() => condition));
 }
Exemplo n.º 31
0
        protected void DropDownListEntityFields_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.EntityTypeId == Guid.Empty)
            {
                return;
            }
            EntityFieldCollection fields = EntityNodeProvider.GetEntityFields(this.EntityTypeId);

            if (fields == null)
            {
                return;
            }
            if (!string.IsNullOrEmpty(m_FieldName))
            {
                DropDownListEntityFields.SelectedValue = m_FieldName;
            }
            EntityField field = fields[DropDownListEntityFields.SelectedValue];

            if (field == null)
            {
                return;
            }
            LabelFieldType.Text          = field.DataType.Name;
            LabelFieldsTypeFullName.Text = field.DataType.FullName;
            DropDownListTerm.Items.Clear();
            DropDownListTerm.Items.Add(new ListItem("=="));
            DropDownListTerm.Items.Add(new ListItem("!="));

            ControlValue    FieldTypeConrol = ControlValue.TextBox;
            List <ListItem> lists           = new List <ListItem>();

            lists.Add(new ListItem(">"));
            lists.Add(new ListItem(">="));
            lists.Add(new ListItem("<"));
            lists.Add(new ListItem("<="));

            if (field.ListValues.Count > 0)
            {
                LabelFieldType.Text            = Resources.RuleParametersControl_LookupText;
                FieldTypeConrol                = ControlValue.ComboBox;
                ComboBoxEntityValue.DataSource = field.ListValuesOld;
                ComboBoxEntityValue.DataBind();
                if (m_EntityValue != null)
                {
                    ComboBoxEntityValue.SelectedValue = Convert.ToString(m_EntityValue, CultureInfo.CurrentCulture);
                }
            }
            else if (field.DataType == typeof(short))
            {
                FieldTypeConrol = ControlValue.TextBox;
                DropDownListTerm.Items.AddRange(lists.ToArray());
                if (field.MaxLength > 0)
                {
                    TextBoxEntityValue.MaxLength = 0;
                }
                TextBoxEntityValue.ValidationType = CustomValidationDataType.Integer;
                TextBoxEntityValue.MaximumValue   = (field.MaxValue != null) ? ((short)field.MaxValue).ToString(CultureInfo.CurrentCulture) : short.MaxValue.ToString(CultureInfo.CurrentCulture);
                TextBoxEntityValue.MinimumValue   = (field.MinValue != null) ? ((short)field.MinValue).ToString(CultureInfo.CurrentCulture) : short.MinValue.ToString(CultureInfo.CurrentCulture);
                TextBoxEntityValue.Text           = (field.DefaultValue != null) ? Convert.ToString(field.DefaultValue, CultureInfo.CurrentCulture) : "0";
            }
            else if (field.DataType == typeof(int))
            {
                FieldTypeConrol = ControlValue.TextBox;
                DropDownListTerm.Items.AddRange(lists.ToArray());
                if (field.MaxLength > 0)
                {
                    TextBoxEntityValue.MaxLength = 0;
                }
                TextBoxEntityValue.ValidationType = CustomValidationDataType.Integer;
                TextBoxEntityValue.MaximumValue   = (field.MaxValue != null) ? ((int)field.MaxValue).ToString(CultureInfo.CurrentCulture) : int.MaxValue.ToString(CultureInfo.CurrentCulture);
                TextBoxEntityValue.MinimumValue   = (field.MinValue != null) ? ((int)field.MinValue).ToString(CultureInfo.CurrentCulture) : int.MinValue.ToString(CultureInfo.CurrentCulture);
                if (m_EntityValue != null)
                {
                    TextBoxEntityValue.Text = Convert.ToString(m_EntityValue, CultureInfo.CurrentCulture);
                }
                else
                {
                    TextBoxEntityValue.Text = (field.DefaultValue != null) ? Convert.ToString(field.DefaultValue, CultureInfo.CurrentCulture) : "0";
                }
            }
            else if (field.DataType == typeof(long))
            {
                FieldTypeConrol = ControlValue.TextBox;
                DropDownListTerm.Items.AddRange(lists.ToArray());
                if (field.MaxLength > 0)
                {
                    TextBoxEntityValue.MaxLength = 0;
                }
                TextBoxEntityValue.ValidationType = CustomValidationDataType.Integer;
                TextBoxEntityValue.MaximumValue   = (field.MaxValue != null) ? ((long)field.MaxValue).ToString(CultureInfo.CurrentCulture) : long.MaxValue.ToString(CultureInfo.CurrentCulture);
                TextBoxEntityValue.MinimumValue   = (field.MinValue != null) ? ((long)field.MinValue).ToString(CultureInfo.CurrentCulture) : long.MinValue.ToString(CultureInfo.CurrentCulture);
                if (m_EntityValue != null)
                {
                    TextBoxEntityValue.Text = Convert.ToString(m_EntityValue, CultureInfo.CurrentCulture);
                }
                else
                {
                    TextBoxEntityValue.Text = (field.DefaultValue != null) ? Convert.ToString(field.DefaultValue, CultureInfo.CurrentCulture) : "0";
                }
            }
            else if (field.DataType == typeof(decimal))
            {
                FieldTypeConrol = ControlValue.TextBox;
                DropDownListTerm.Items.AddRange(lists.ToArray());
                if (field.MaxLength > 0)
                {
                    TextBoxEntityValue.MaxLength = 0;
                }
                TextBoxEntityValue.ValidationType = CustomValidationDataType.Double;
                TextBoxEntityValue.MaximumValue   = (field.MaxValue != null) ? ((decimal)field.MaxValue).ToString(CultureInfo.CurrentCulture) : decimal.MaxValue.ToString(CultureInfo.CurrentCulture);
                TextBoxEntityValue.MinimumValue   = (field.MinValue != null) ? ((decimal)field.MinValue).ToString(CultureInfo.CurrentCulture) : decimal.MinValue.ToString(CultureInfo.CurrentCulture);
                if (m_EntityValue != null)
                {
                    TextBoxEntityValue.Text = Convert.ToString(m_EntityValue, CultureInfo.CurrentCulture);
                }
                else
                {
                    TextBoxEntityValue.Text = (field.DefaultValue != null) ? Convert.ToString(field.DefaultValue, CultureInfo.CurrentCulture) : decimal.Zero.ToString(CultureInfo.CurrentCulture);
                }
            }
            else if (field.DataType == typeof(double))
            {
                FieldTypeConrol = ControlValue.TextBox;
                DropDownListTerm.Items.AddRange(lists.ToArray());
                if (field.MaxLength > 0)
                {
                    TextBoxEntityValue.MaxLength = 0;
                }
                TextBoxEntityValue.ValidationType = CustomValidationDataType.Double;
                TextBoxEntityValue.MaximumValue   = (field.MaxValue != null) ? ((double)field.MaxValue).ToString(CultureInfo.CurrentCulture) : double.MaxValue.ToString(CultureInfo.CurrentCulture);
                TextBoxEntityValue.MinimumValue   = (field.MinValue != null) ? ((double)field.MinValue).ToString(CultureInfo.CurrentCulture) : double.MinValue.ToString(CultureInfo.CurrentCulture);
                if (m_EntityValue != null)
                {
                    TextBoxEntityValue.Text = Convert.ToString(m_EntityValue, CultureInfo.CurrentCulture);
                }
                else
                {
                    TextBoxEntityValue.Text = (field.DefaultValue != null) ? Convert.ToString(field.DefaultValue, CultureInfo.CurrentCulture) : decimal.Zero.ToString(CultureInfo.CurrentCulture);
                }
            }
            else if (field.DataType == typeof(float))
            {
                FieldTypeConrol = ControlValue.TextBox;
                DropDownListTerm.Items.AddRange(lists.ToArray());
                if (field.MaxLength > 0)
                {
                    TextBoxEntityValue.MaxLength = 0;
                }
                TextBoxEntityValue.ValidationType = CustomValidationDataType.Double;
                TextBoxEntityValue.MaximumValue   = (field.MaxValue != null) ? ((float)field.MaxValue).ToString(CultureInfo.CurrentCulture) : float.MaxValue.ToString(CultureInfo.CurrentCulture);
                TextBoxEntityValue.MinimumValue   = (field.MinValue != null) ? ((float)field.MinValue).ToString(CultureInfo.CurrentCulture) : float.MinValue.ToString(CultureInfo.CurrentCulture);
                if (m_EntityValue != null)
                {
                    TextBoxEntityValue.Text = Convert.ToString(m_EntityValue, CultureInfo.CurrentCulture);
                }
                else
                {
                    TextBoxEntityValue.Text = (field.DefaultValue != null) ? Convert.ToString(field.DefaultValue, CultureInfo.CurrentCulture) : decimal.Zero.ToString(CultureInfo.CurrentCulture);
                }
            }
            else if (field.DataType == typeof(DateTime))
            {
                DropDownListTerm.Items.AddRange(lists.ToArray());
                FieldTypeConrol            = ControlValue.DatePicker;
                DatePickerEntityValue.Type = DatePickerType.DateTimePicker;

                if (field.MaxValue != null)
                {
                    DatePickerEntityValue.MaxDate = (DateTime)field.MaxValue;
                }
                if (field.MinValue != null)
                {
                    DatePickerEntityValue.MinDate = (DateTime)field.MinValue;
                }
                if (m_EntityValue != null)
                {
                    DatePickerEntityValue.SelectedDate = Convert.ToDateTime(m_EntityValue, CultureInfo.CurrentCulture);
                }
                else if (field.DefaultValue != null)
                {
                    DatePickerEntityValue.SelectedDate = (DateTime)field.DefaultValue;
                }
            }
            else if (field.DataType == typeof(bool))
            {
                FieldTypeConrol = ControlValue.CheckBox;
                if (m_EntityValue != null)
                {
                    CheckBoxEntityValue.Checked = Convert.ToBoolean(m_EntityValue, CultureInfo.CurrentCulture);
                }
                else
                {
                    CheckBoxEntityValue.Checked = (field.DefaultValue != null) ? Convert.ToBoolean(field.DefaultValue, CultureInfo.CurrentCulture) : false;
                }
            }
            else if (field.DataType == typeof(Guid))
            {
                FieldTypeConrol = ControlValue.TextBox;
                TextBoxEntityValue.MaxLength            = 25;
                TextBoxEntityValue.ValidationType       = CustomValidationDataType.RegularExpression;
                TextBoxEntityValue.ValidationExpression = @"[({]?(0x)?[0-9a-fA-F]{8}([-,]?(0x)?[0-9a-fA-F]{4}){2}((-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12})|(,\{0x[0-9a-fA-F]{2}(,0x[0-9a-fA-F]{2}){7}\}))[)}]?";
                if (m_EntityValue != null)
                {
                    TextBoxEntityValue.Text = Convert.ToString(m_EntityValue, CultureInfo.CurrentCulture);
                }
                else if (field.DefaultValue != null)
                {
                    TextBoxEntityValue.Text = ((Guid)field.DefaultValue).ToString();
                }
            }
            else if (field.DataType == typeof(Entity))
            {
                FieldTypeConrol = ControlValue.TreeView;
                EntityTreeViewValue.EntityId = field.Id;
                if (m_EntityValue != null)
                {
                    EntityTreeViewValue.EntityNodeId = (Guid)m_EntityValue;
                }
                EntityTreeViewValue.DataBind();
            }
            else
            {
                TextBoxEntityValue.ValidationType = CustomValidationDataType.String;
                if (field.MaxLength > 0)
                {
                    TextBoxEntityValue.MaxLength = 0;
                }
                if (m_EntityValue != null)
                {
                    TextBoxEntityValue.Text = Convert.ToString(m_EntityValue, CultureInfo.CurrentCulture);
                }
                else if (field.DefaultValue != null)
                {
                    TextBoxEntityValue.Text = HttpUtility.HtmlEncode(Convert.ToString(field.DefaultValue, CultureInfo.CurrentCulture));
                }
            }
            if (!string.IsNullOrEmpty(m_Term))
            {
                DropDownListTerm.SelectedValue = m_Term;
            }
            switch (FieldTypeConrol)
            {
            case ControlValue.TextBox:
                TextBoxEntityValue.Visible    = true;
                ComboBoxEntityValue.Visible   = false;
                DatePickerEntityValue.Visible = false;
                CheckBoxEntityValue.Visible   = false;
                EntityTreeViewValue.Visible   = false;
                break;

            case ControlValue.CheckBox:
                TextBoxEntityValue.Visible    = false;
                ComboBoxEntityValue.Visible   = false;
                DatePickerEntityValue.Visible = false;
                CheckBoxEntityValue.Visible   = true;
                EntityTreeViewValue.Visible   = false;
                break;

            case ControlValue.ComboBox:
                TextBoxEntityValue.Visible    = false;
                ComboBoxEntityValue.Visible   = true;
                DatePickerEntityValue.Visible = false;
                CheckBoxEntityValue.Visible   = false;
                EntityTreeViewValue.Visible   = false;
                break;

            case ControlValue.DatePicker:
                TextBoxEntityValue.Visible    = false;
                ComboBoxEntityValue.Visible   = false;
                DatePickerEntityValue.Visible = true;
                CheckBoxEntityValue.Visible   = false;
                EntityTreeViewValue.Visible   = false;
                break;

            case ControlValue.TreeView:
                TextBoxEntityValue.Visible    = false;
                ComboBoxEntityValue.Visible   = false;
                DatePickerEntityValue.Visible = false;
                CheckBoxEntityValue.Visible   = false;
                EntityTreeViewValue.Visible   = true;
                break;
            }
        }