Exemplo n.º 1
0
        public TextBoxHelper(ColumnDTO correspondingTypeProperty, ColumnUISettingDTO columnSetting, List <SimpleSearchOperator> operators = null)
        {
            theGrid = new Grid();
            theGrid.ColumnDefinitions.Add(new ColumnDefinition());
            theGrid.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            textBox                     = new TextBox();
            textBox.Name                = "txtControl";
            textBox.GotFocus           += TextBox_GotFocus;
            textBox.TextChanged        += (sender, e) => textBox_TextChanged(sender, e);
            textBox.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            theGrid.Children.Add(textBox);

            if (columnSetting != null && columnSetting.UIRowsCount > 1)
            {
                textBox.AcceptsReturn = true;
                textBox.TextWrapping  = TextWrapping.Wrap;
            }
            if (operators != null && operators.Count > 0)
            {
                theGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(70)
                });
                cmbOperators                   = new ComboBox();
                cmbOperators.Name              = "cmbOperators";
                cmbOperators.ItemsSource       = operators;
                cmbOperators.DisplayMemberPath = "Title";
                cmbOperators.SelectedValuePath = "Operator";
                Grid.SetColumn(cmbOperators, 1);
                theGrid.Children.Add(cmbOperators);
            }
        }
 public static I_ControlHelper GetControlHelper(ColumnDTO column, ColumnUISettingDTO columnSetting, List <SimpleSearchOperator> operators = null)
 {
     if (column.ColumnType == Enum_ColumnType.String)
     {
         return(new TextBoxHelper(column, columnSetting, operators));
     }
     else if (column.ColumnType == Enum_ColumnType.Numeric)
     {
         return(new NumericTextBoxHelper(column, columnSetting, operators));
     }
     else if (column.ColumnType == Enum_ColumnType.Date ||
              column.ColumnType == Enum_ColumnType.Time ||
              column.ColumnType == Enum_ColumnType.DateTime)
     {
         return(new DateTimePickerHelper(column, columnSetting, operators));
     }
     else if (column.ColumnType == Enum_ColumnType.Boolean)
     {
         return(new CheckBoxHelper(column, columnSetting, operators));
     }
     else
     {
         return(new TextBoxHelper(column, columnSetting, operators));
     }
 }
 private ColumnUISettingDTO GetColumnUISetting(ColumnDTO column)
 {
     if (_ColumnUISetting == null)
     {
         _ColumnUISetting = new ColumnUISettingDTO();
         _ColumnUISetting.UIColumnsType = Enum_UIColumnsType.Normal;
         _ColumnUISetting.UIRowsCount   = 1;
     }
     return(_ColumnUISetting);
 }
 public SimpleControlManagerForOneDataForm(ColumnDTO column, ColumnUISettingDTO columnSetting, bool hasRangeOfValues, List <SimpleSearchOperator> operators = null) : base()
 {
     Column             = column;
     ColumnUISettingDTO = columnSetting;
     //  RelatedControl = new List<FrameworkElement>();
     if (hasRangeOfValues)
     {
         MyControlHelper = ControlHelper.KeyValueControlHelper(column);
     }
     else
     {
         MyControlHelper = ControlHelper.GetControlHelper(column, columnSetting, operators);
     }
 }
 private ColumnUISettingDTO GetColumnUISetting(ColumnDTO column)
 {
     if (UICompositions != null && UICompositions.ColumnItems != null &&
         UICompositions.ColumnItems.Any(x => x.ColumnID == column.ID))
     {
         var setting = UICompositions.ColumnItems.First(x => x.ColumnID == column.ID);
         if (setting == null)
         {
             setting = new ColumnUISettingDTO();
             setting.UIColumnsType = Enum_UIColumnsType.Normal;
             setting.UIRowsCount   = 1;
             setting.ColumnID      = column.ID;
             UICompositions.ColumnItems.Add(setting);
         }
         return(setting);
     }
     return(null);
 }
Exemplo n.º 6
0
        public DatePickerHelper(ColumnDTO correspondingTypeProperty, ColumnUISettingDTO columnSetting, List <SimpleSearchOperator> operators = null)
        {
            theGrid = new Grid();
            theGrid.ColumnDefinitions.Add(new ColumnDefinition());
            theGrid.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            stringDateIsMiladi        = correspondingTypeProperty.DateColumnType.StringDateIsMiladi;
            valueIsString             = correspondingTypeProperty.OriginalColumnType == Enum_ColumnType.String;

            if (!correspondingTypeProperty.DateColumnType.ShowMiladiDateInUI)
            {
                textBox = new PDatePicker();
                (textBox as PDatePicker).SelectedDateChanged += DatePickerHelper_SelectedDateChanged;
            }
            else
            {
                textBox = new DatePicker();
                (textBox as DatePicker).SelectedDateChanged += (sender, e) => textBox_SelectedDateChanged(sender, e);
            }
            textBox.Name = "txtControl";
            //
            textBox.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            //   textBox.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            theGrid.Children.Add(textBox);

            if (operators != null && operators.Count > 0)
            {
                theGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(70)
                });
                cmbOperators                   = new ComboBox();
                cmbOperators.Name              = "cmbOperators";
                cmbOperators.ItemsSource       = operators;
                cmbOperators.DisplayMemberPath = "Title";
                cmbOperators.SelectedValuePath = "Operator";
                Grid.SetColumn(cmbOperators, 1);
                theGrid.Children.Add(cmbOperators);
            }


            //}
            //}
            //return package;
        }
Exemplo n.º 7
0
        public DataGridTextColumn(ColumnDTO column, ColumnUISettingDTO columnSetting, bool hasRangeOfValues)
        {
            ColumnSetting = columnSetting;

            Column           = column;
            HasRangeOfValues = hasRangeOfValues;
            //     ValueIsTitleOrValue = valueIsTitleOrValue;
            if (columnSetting != null)
            {
                if (columnSetting.UIColumnsType == Enum_UIColumnsType.Full)
                {
                    Width = 200;
                }
                else if (columnSetting.UIColumnsType == Enum_UIColumnsType.Half)
                {
                    Width = 140;
                }
                else
                {
                    Width = 80;
                }
            }
        }
        public CheckBoxHelper(ColumnDTO correspondingTypeProperty, ColumnUISettingDTO columnSetting, List <SimpleSearchOperator> operators = null)
        {
            //UIControlPackage package = new UIControlPackage();
            //  package.UIControls = new List<FrameworkElement>();
            //UIControlSetting controlUISetting = new UIControlSetting();
            //controlUISetting.DesieredColumns = 1;
            //controlUISetting.DesieredRows = 1;
            theGrid = new Grid();
            theGrid.VerticalAlignment = System.Windows.VerticalAlignment.Center;

            theGrid.ColumnDefinitions.Add(new ColumnDefinition());
            checkbox          = new CheckBox();
            checkbox.Name     = "txtControl";
            checkbox.Checked += (sender, e) => control_Checked(sender, e);
            if (correspondingTypeProperty.IsNull)
            {
                checkbox.IsThreeState = true;
            }
            theGrid.Children.Add(checkbox);
            //textBox.Mask = "###";

            //  textBox.FormatString = "";
            //  textBox.EmptyContent = "";
            //textBox.TextMode = Telerik.Windows.Controls.MaskedInput.TextMode.PlainText;
            //textBox.sho
            //   textBox.InputBehavior = Telerik.Windows.Controls.MaskedInput.InputBehavior.Replace;

            //            if(correspondingTypeProperty.ColumnType.NumericColumnType.Precision)
            //textBox.ty
            //control.IsEnabled = !columnSetting.IsReadOnly;
            //control.Margin = new System.Windows.Thickness(5);
            checkbox.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            //     checkbox.VerticalAlignment = System.Windows.VerticalAlignment.Center;

            //return package;
        }
Exemplo n.º 9
0
        public NumericTextBoxHelper(ColumnDTO correspondingTypeProperty, ColumnUISettingDTO columnSetting, List <SimpleSearchOperator> operators = null)
        {
            theGrid = new Grid();
            theGrid.ColumnDefinitions.Add(new ColumnDefinition());
            theGrid.VerticalAlignment = System.Windows.VerticalAlignment.Center;

            textBox                            = new RadMaskedNumericInput();
            textBox.Name                       = "txtControl";
            textBox.ValueChanged              += (sender, e) => textBox_ValueChanged(sender, e);
            textBox.HorizontalAlignment        = System.Windows.HorizontalAlignment.Stretch;
            textBox.IsLastPositionEditable     = false;
            textBox.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left;
            textBox.IsClearButtonVisible       = false;
            textBox.TextMode                   = Telerik.Windows.Controls.MaskedInput.TextMode.PlainText;
            textBox.SelectionOnFocus           = SelectionOnFocus.SelectAll;


            //if (correspondingTypeProperty.DataType.Contains("float")
            //    || correspondingTypeProperty.DataType.Contains("decimal")
            //    || correspondingTypeProperty.DataType.Contains("double"))
            //{
            if (correspondingTypeProperty.NumericColumnType != null && correspondingTypeProperty.NumericColumnType.Precision != 0 &&
                correspondingTypeProperty.NumericColumnType.Scale != 0)
            {
                textBox.Mask         = "#" + (correspondingTypeProperty.NumericColumnType.Precision - correspondingTypeProperty.NumericColumnType.Scale);
                textBox.Mask        += "." + correspondingTypeProperty.NumericColumnType.Scale;
                textBox.FormatString = "";
            }
            else
            {
                textBox.Mask = "";
                if (correspondingTypeProperty.DataType.Contains("float") ||
                    correspondingTypeProperty.DataType.Contains("decimal") ||
                    correspondingTypeProperty.DataType.Contains("double"))
                {
                    //بطور پیش فرض دو رقم اعشار میگذارد و سه رقم سه رقم جدا میکند
                    //textBox.FormatString = "n";

                    //اگر اعشار خواست از پرسیجن و اسکیل استفاده شود
                    textBox.FormatString = "n0";
                }
                else
                {
                    //رقم اعشار نمیگذارد و سه رقم سه رقم جدا میکند
                    textBox.FormatString = "n0";
                }
                //بیشتر تست شود از نوع خود مقدار بایند شده به این کنترل
                //بعدا یک خصوصیت اضافه شود که جدا نکند مثل شماره شناسنامه

                // سه رقم سه رقم جدا نمیکند
                // textBox.FormatString = "";
            }
            //}



            theGrid.Children.Add(textBox);

            if (operators != null && operators.Count > 0)
            {
                theGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(70)
                });
                cmbOperators                   = new ComboBox();
                cmbOperators.Name              = "cmbOperators";
                cmbOperators.ItemsSource       = operators;
                cmbOperators.DisplayMemberPath = "Title";
                cmbOperators.SelectedValuePath = "Operator";
                Grid.SetColumn(cmbOperators, 1);
                theGrid.Children.Add(cmbOperators);
            }
        }
        public DateTimePickerHelper(ColumnDTO correspondingTypeProperty, ColumnUISettingDTO columnSetting, List <SimpleSearchOperator> operators = null)
        {
            theGrid = new Grid();
            theGrid.ColumnDefinitions.Add(new ColumnDefinition());
            theGrid.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            if (correspondingTypeProperty.ColumnType == Enum_ColumnType.DateTime)
            {
                showMiladiTime         = correspondingTypeProperty.DateTimeColumnType.ShowMiladiDateInUI;
                showMiladiDate         = correspondingTypeProperty.DateTimeColumnType.ShowMiladiDateInUI;
                showAMPMFormat         = correspondingTypeProperty.DateTimeColumnType.ShowAMPMFormat;
                stringDateIsMiladi     = correspondingTypeProperty.DateTimeColumnType.StringDateIsMiladi;
                stringTimeISAMPMFormat = correspondingTypeProperty.DateTimeColumnType.StringTimeISAMPMFormat;
                stringTimeIsMiladi     = correspondingTypeProperty.DateTimeColumnType.StringTimeIsMiladi;
                hideTimePicker         = correspondingTypeProperty.DateTimeColumnType.HideTimePicker;
            }
            else if (correspondingTypeProperty.ColumnType == Enum_ColumnType.Date)
            {
                //??نباید DateColumnType نال باشد. فعلا ایف گذاشته شد
                if (correspondingTypeProperty.DateColumnType != null)
                {
                    showMiladiDate     = correspondingTypeProperty.DateColumnType.ShowMiladiDateInUI;
                    stringDateIsMiladi = correspondingTypeProperty.DateColumnType.StringDateIsMiladi;
                }
                hasnotTimePicker = true;
            }
            else if (correspondingTypeProperty.ColumnType == Enum_ColumnType.Time)
            {
                showMiladiTime         = correspondingTypeProperty.TimeColumnType.ShowMiladiTime;
                showAMPMFormat         = correspondingTypeProperty.TimeColumnType.ShowAMPMFormat;
                stringTimeIsMiladi     = correspondingTypeProperty.TimeColumnType.StringTimeIsMiladi;
                stringTimeISAMPMFormat = correspondingTypeProperty.TimeColumnType.StringTimeISAMPMFormat;
                hasnotDatePicker       = true;
                hasnotTimePicker       = false;
            }
            if (hasnotDatePicker)
            {
                hideShamsiDatePicker = true;
                hideMiladiDatePicker = true;
            }
            else
            {
                if (showMiladiDate)
                {
                    hideShamsiDatePicker = true;
                }
                else
                {
                    hideMiladiDatePicker = true;
                }
            }
            valueIsString = correspondingTypeProperty.OriginalColumnType == Enum_ColumnType.String;
            textBox       = new MyDateTimePicker();


            (textBox as MyDateTimePicker).TimePickerVisiblity       = !hasnotTimePicker && !hideTimePicker;
            (textBox as MyDateTimePicker).ShamsiDatePickerVisiblity = !hideShamsiDatePicker;
            (textBox as MyDateTimePicker).MiladiDatePickerVisiblity = !hideMiladiDatePicker;

            if ((textBox as MyDateTimePicker).TimePickerVisiblity)
            {
                if (showAMPMFormat)
                {
                    CultureInfo cultureInfo = null;
                    if (showMiladiTime)
                    {
                        cultureInfo = new CultureInfo("en-US");
                    }
                    else
                    {
                        cultureInfo = new CultureInfo("fa-IR");
                    }
                    (textBox as MyDateTimePicker).TimePickeCulture = cultureInfo;
                }
                else
                {
                    //(textBox as RadTimePicker).DisplayFormat = DateTimePickerFormat.Long;
                    CultureInfo cultureInfo = new CultureInfo("en-US");
                    cultureInfo.DateTimeFormat.ShortTimePattern = "H:mm";
                    cultureInfo.DateTimeFormat.LongTimePattern  = "H:mm";
                    //cultureInfo.DateTimeFormat.PMDesignator = " za";
                    //cultureInfo.DateTimeFormat.AMDesignator = " az";
                    (textBox as MyDateTimePicker).TimePickeCulture = cultureInfo;
                }
            }
            textBox.Name = "txtControl";
            //
            textBox.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            theGrid.Children.Add(textBox);

            if (operators != null && operators.Count > 0)
            {
                theGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(70)
                });
                cmbOperators                   = new ComboBox();
                cmbOperators.Name              = "cmbOperators";
                cmbOperators.ItemsSource       = operators;
                cmbOperators.DisplayMemberPath = "Title";
                cmbOperators.SelectedValuePath = "Operator";
                Grid.SetColumn(cmbOperators, 1);
                theGrid.Children.Add(cmbOperators);
            }


            //}
            //}
            //return package;
        }
Exemplo n.º 11
0
 public SimpleControlManagerForMultipleDataForm(ColumnDTO column, ColumnUISettingDTO columnUISettingDTO, bool hasRangeOfValues) : base()
 {
     //  RelatedControl = new List<FrameworkElement>();
     DataGridColumn = new DataGridTextColumn(column, columnUISettingDTO, hasRangeOfValues);
 }
Exemplo n.º 12
0
        public I_SimpleControlManager GenerateSimpleControlManagerForMultipleDataForm(ColumnDTO column, ColumnUISettingDTO columnUISettingDTO, bool hasRangeOfValues, bool labelControlManager, string labelText)
        {
            var controlManager = new SimpleControlManagerForMultipleDataForm(column, columnUISettingDTO, hasRangeOfValues);

            if (labelControlManager)
            {
                controlManager.LabelControlManager = new LabelControlManager(labelText, false);
            }
            return(controlManager);
        }
Exemplo n.º 13
0
        //public void GenerateViewOfEditPackageArea(EditPackageAreaInitializer initializer)
        //{


        //    //////initializer.Mode = Enum_AG_EntityRequestGranularity.OneByOne;
        //    //////initializer.DataPackageTemplate = packages[0];
        //    initializer.View = new frmEditPackageArea();

        //    //container.CommandRequested += container_CommandRequested;

        //    //return container;
        //}

        //public I_View_SearchViewArea GenerateSearchViewArea()
        //{

        //    // SearchViewPackageAreaInitializer initParam = new SearchViewPackageAreaInitializer();

        //    return new UC_SearchViewArea();

        //    //container.CommandRequested += container_CommandRequested;

        //    //return container;
        //}
        //void container_CommandRequested(object sender, Arg_CommandRequest e)
        //{
        //    var request = new AG_CommandExecutionRequest();
        //    request.Command = new AG_PackageAreaCommand();
        //    //request.SourcePackageArea = sender;
        //    request.Command.Packages = e.Packages;
        //    request.Command.CommandGoal = Enum_AG_PackageAreaCommand.Add;
        //    AgentUIMediator.ExecuteCommand(request);
        //}



        public I_SimpleControlManager GenerateSimpleControlManagerForOneDataForm(ColumnDTO column, ColumnUISettingDTO columnSetting, bool hasRangeOfValues, List <SimpleSearchOperator> operators, bool labelControlManager, string labelText)
        {
            var controlManager = new SimpleControlManagerForOneDataForm(column, columnSetting, hasRangeOfValues, operators);

            if (labelControlManager)
            {
                controlManager.LabelControlManager = new LabelControlManager(labelText, true);
            }
            return(controlManager);
        }
        public TimePickerHelper(ColumnDTO correspondingTypeProperty, ColumnUISettingDTO columnSetting, List <SimpleSearchOperator> operators = null)
        {
            theGrid = new Grid();
            theGrid.ColumnDefinitions.Add(new ColumnDefinition());
            theGrid.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            stringTimeIsMiladi        = correspondingTypeProperty.TimeColumnType.StringTimeIsMiladi == true;
            stringTimeISAMPMFormat    = correspondingTypeProperty.TimeColumnType.StringTimeISAMPMFormat == true;
            valueIsString             = correspondingTypeProperty.OriginalColumnType == Enum_ColumnType.String;
            textBox = new RadTimePicker();
            if (correspondingTypeProperty.TimeColumnType.ShowAMPMFormat)
            {
                CultureInfo cultureInfo = null;
                if (correspondingTypeProperty.TimeColumnType.ShowMiladiTime)
                {
                    cultureInfo = new CultureInfo("en-US");
                }
                else
                {
                    cultureInfo = new CultureInfo("fa-IR");
                }

                //cultureInfo.DateTimeFormat.ShortTimePattern = "H:mm";
                //cultureInfo.DateTimeFormat.LongTimePattern = "H:mm";
                //cultureInfo.DateTimeFormat.PMDesignator = " za";
                //cultureInfo.DateTimeFormat.AMDesignator = " az";
                (textBox as RadTimePicker).Culture = cultureInfo;
            }
            else
            {
                //(textBox as RadTimePicker).DisplayFormat = DateTimePickerFormat.Long;
                CultureInfo cultureInfo = new CultureInfo("en-US");
                cultureInfo.DateTimeFormat.ShortTimePattern = "H:mm";
                cultureInfo.DateTimeFormat.LongTimePattern  = "H:mm";
                //cultureInfo.DateTimeFormat.PMDesignator = " za";
                //cultureInfo.DateTimeFormat.AMDesignator = " az";
                (textBox as RadTimePicker).Culture = cultureInfo;
            }

            //////if (!correspondingTypeProperty.TimeColumnType.ShowMiladiDateInUI)
            //////{
            //////    textBox = new PDatePicker();
            //////    (textBox as PDatePicker).SelectedDateChanged += TimePickerHelper_SelectedDateChanged;
            //////}
            //////else
            //////{
            //////    textBox = new DatePicker();
            //////    (textBox as DatePicker).SelectedDateChanged += (sender, e) => textBox_SelectedDateChanged(sender, e);
            //////}

            textBox.Name = "txtControl";
            //
            textBox.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            //   textBox.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            theGrid.Children.Add(textBox);

            if (operators != null && operators.Count > 0)
            {
                theGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(70)
                });
                cmbOperators                   = new ComboBox();
                cmbOperators.Name              = "cmbOperators";
                cmbOperators.ItemsSource       = operators;
                cmbOperators.DisplayMemberPath = "Title";
                cmbOperators.SelectedValuePath = "Operator";
                Grid.SetColumn(cmbOperators, 1);
                theGrid.Children.Add(cmbOperators);
            }


            //}
            //}
            //return package;
        }