Beispiel #1
0
        /// <summary>
        /// ændre på knap farve
        /// </summary>
        private void ChangeDayButtonColor(Button senderButton)
        {
            var funcClass = new Class.Functions.others();

            DateTime Date = DateTime.Parse(senderButton.ToolTip.ToString());

            //valgte knap
            if (this.SelecteDate.Year == Date.Year && this.SelecteDate.Month == Date.Month && this.SelecteDate.Day == Date.Day)
            {
                senderButton.Background = funcClass.ColorBrushHex("#FF3A8CDE");
                senderButton.Foreground = Brushes.White;
                senderButton.FontWeight = FontWeights.Bold;
            }

            //idag knap
            else if (DateTime.Now.Year == Date.Year && DateTime.Now.Month == Date.Month && DateTime.Now.Day == Date.Day)
            {
                senderButton.Background = Brushes.LightBlue;
            }

            //i denne måned
            else if (this.SelecteDate.Year == Date.Year && this.SelecteDate.Month == Date.Month)
            {
                senderButton.Background = Brushes.White;
            }

            //ikke i denne måned
            else
            {
                senderButton.Background = Brushes.LightGray;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Hent by navn ud fra hvad der
        /// er skrevet i Textbox_ZipCode
        /// </summary>
        private void SetCityName()
        {
            //post nummeret skal være på 4 tal
            if (Textbox_ZipCode.Text.Length != 4)
            {
                TextBlock_City.Text = "";
                return;
            }

            var funcClass = new Class.Functions.others();

            //hent by navn
            string cityName = funcClass.GetCityFormZip(Textbox_ZipCode.Text);

            TextBlock_City.Text = cityName;
        }
Beispiel #3
0
        /// <summary>
        /// Gør så når man låser tekstboksen
        /// og der er ikke skrevet i boksen
        /// så vil man stadig kunne se header
        /// tekst
        /// </summary>
        private void _Grid_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            var funcClass = new Class.Functions.others();

            if ((sender as Grid).IsEnabled)
            {
                placeholder.Foreground = funcClass.ColorBrushHex("#FF5489BD");
                placeholder.Background = funcClass.ColorBrushHex("#FFE2E0E0");
                Canvas.SetZIndex(placeholder, 0);
            }
            else
            {
                placeholder.Foreground = funcClass.ColorBrushHex("#FF88AED4");
                placeholder.Background = funcClass.ColorBrushHex("#FFEEEBEB");
                Canvas.SetZIndex(placeholder, 100);
            }
        }
Beispiel #4
0
        /// <summary>
        /// sæt teksten på datetimepicker knappen
        /// </summary>
        public void SetDatetimeTextboxText()
        {
            if (!this.IsLoaded)
            {
                return;
            }
            var funcClass = new Class.Functions.others();

            if (this.HasBeenSet)
            {
                //sæt tid hvis den er fremme
                if (this.TimeVisibility == Visibility.Visible)
                {
                    int hour   = 0;
                    int minute = 0;
                    int.TryParse(_slider_Hour.Value.ToString(), out hour);
                    int.TryParse(_slider_Minute.Value.ToString(), out minute);

                    DateTime newDate = this.SelecteDate.Date;
                    TimeSpan time    = new TimeSpan(hour, minute, 0);
                    newDate = newDate.Date + time;

                    this.SelecteDate = newDate;
                }

                this._selectedDate            = this.SelecteDate;
                this._selectedText.Text       = this._selectedDate.ToString(this.Format);
                this._button.Background       = Brushes.White;
                this._selectedText.Foreground = Brushes.Black;
            }
            else
            {
                string selectDefaultText = this.ShowAlwaysPlaceholderOnTop ? "Vælg Dato" : this.Placeholder;
                this._selectedDate            = DateTime.Now;
                this._selectedText.Text       = selectDefaultText;
                this._selectedText.Foreground = funcClass.ColorBrushHex("#FF5489BD");
            }


            if (this.Changed != null)
            {
                this.Changed(this, null);
            }
        }
Beispiel #5
0
        /// <summary>
        /// viser hvad for en pakke man ændre på
        /// </summary>
        private void HighLightSelected()
        {
            var        funcClass = new Class.Functions.others();
            List <int> pakkeId   = GetPacketIndexs(_hiddenId.Text);

            //find pakke grid index i listen
            int index = GetPacketOneIndex(pakkeId[0], pakkeId[1]);

            //sæt bagground farve på valgte
            for (int i = 0; i < _ItemsContains.Children.Count; i++)
            {
                Grid item = (_ItemsContains.Children[i] as Border).Child as Grid;

                if (i == index)
                {
                    item.Background = funcClass.ColorBrushHex("#FF36A3FD");
                }
                else
                {
                    item.Background = Brushes.Transparent;
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// opdatere/loader pakker
        /// </summary>
        public void Update()
        {
            var funcClass = new Class.Functions.others();

            _ItemsContains.Children.Clear();
            _ItemsContains.RowDefinitions.Clear();

            grid_faktura.Visibility = Visibility.Hidden;

            LockFragtbrevStatus(IsFaktura);

            int  itemCount    = 0;
            int  loopRun1     = this.Items.Count;
            bool styleChanger = false;
            int  itemMax      = GetPacketMaxIndex();


            //opret pakker i listview
            for (int i = 0; i < loopRun1; i++)
            {
                //så den kan visse alle pakker hvis faktura er valgt
                int loopRun2 = 1;

                if (IsFaktura)
                {
                    loopRun2 = this.Items[i].countI;
                }


                for (int a = 0; a < loopRun2; a++)
                {
                    //baground farve "converter" på row
                    styleChanger = !styleChanger;

                    //opret rækker
                    _ItemsContains.RowDefinitions.Add(new RowDefinition());
                    int rowDefId = _ItemsContains.RowDefinitions.Count - 1;
                    _ItemsContains.RowDefinitions[rowDefId].Height = GridLength.Auto;

                    //lav elementer
                    Grid      _newGrid     = new Grid();
                    TextBlock _newHeader   = new TextBlock();
                    TextBlock _newIndex    = new TextBlock();
                    Button    _newEdit     = new Button();
                    Button    _newDelete   = new Button();
                    Border    _border      = new Border();
                    Border    _borderIndex = new Border();

                    //lav kolonner
                    _newGrid.ColumnDefinitions.Add(new ColumnDefinition());
                    _newGrid.ColumnDefinitions.Add(new ColumnDefinition());
                    _newGrid.ColumnDefinitions.Add(new ColumnDefinition());
                    _newGrid.ColumnDefinitions.Add(new ColumnDefinition());
                    _newGrid.ColumnDefinitions[0].Width = GridLength.Auto;
                    _newGrid.ColumnDefinitions[1].Width = new GridLength(1, GridUnitType.Star);
                    _newGrid.ColumnDefinitions[2].Width = GridLength.Auto;
                    _newGrid.ColumnDefinitions[3].Width = GridLength.Auto;

                    //tilføj klik event
                    _newEdit.Click   += _EditButton_click;
                    _newDelete.Click += _DeleteButton_click;

                    //skjul slet knap
                    if (this.IsFaktura)
                    {
                        //giv edit knap delete plads
                        Grid.SetColumnSpan(_newEdit, 2);
                        Panel.SetZIndex(_newEdit, 5);
                        _newEdit.HorizontalAlignment = HorizontalAlignment.Right;
                        _newDelete.Visibility        = Visibility.Collapsed;
                    }


                    if (IsFaktura && this.Items[i].IsDoneFaktura == null)
                    {
                        ResetFakturaPackets();
                    }

                    //lav rammer
                    _border.BorderBrush          = Brushes.Black;
                    _borderIndex.BorderBrush     = Brushes.Black;
                    _border.BorderThickness      = new Thickness(2, 1, 2, 1);
                    _borderIndex.BorderThickness = new Thickness(0, 0, 2, 0);

                    //update status
                    this.Items[i].IsDoneFragt = PacketIsDoneFragt(this.Items[i]);

                    //skift farve på teskt hvis ikke færdig
                    if (!this.Items[i].IsDoneFragt || (IsFaktura && !this.Items[i].IsDoneFaktura[a]))
                    {
                        // _border.BorderBrush = funcClass.ColorBrushHex("#FF0000");
                        //_borderIndex.BorderBrush = funcClass.ColorBrushHex("#FF0000");
                        _newIndex.Foreground  = funcClass.ColorBrushHex("#FF0000");
                        _newHeader.Foreground = funcClass.ColorBrushHex("#FF0000");
                    }

                    _newEdit.IsEnabled = true;

                    //dette vil blive brugt som Id for pakkerne
                    _newEdit.Name   = "Button_PakkeGrid_Edit_" + i + "_" + a;
                    _newDelete.Name = "Button_PakkeGrid_Delete_" + i + "_" + a;;

                    //sæt størrelse
                    _newEdit.Width    = 35;
                    _newEdit.Height   = 35;
                    _newDelete.Width  = 35;
                    _newDelete.Height = 35;

                    //giv billede bagrund
                    _newEdit.Background   = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/TecCargo Faktura System;component/Images/Icons/editpen.png")));
                    _newDelete.Background = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/TecCargo Faktura System;component/Images/Icons/deletecan.png")));

                    _newIndex.FontSize      = 20;
                    _newIndex.FontWeight    = FontWeights.Bold;
                    _newIndex.Width         = itemMax.ToString().Length * 15;
                    _newIndex.TextAlignment = TextAlignment.Center;
                    _newIndex.Text          = (itemCount + 1).ToString();
                    _borderIndex.Child      = _newIndex;

                    //header indstilinger
                    _newHeader.FontSize = 20;
                    _newHeader.Width    = 250;
                    _newHeader.Text     = this.Items[i].mrkNumb;

                    //lav padding
                    _newIndex.Padding  = new Thickness(2, 5, 2, 5);
                    _newHeader.Padding = new Thickness(5);
                    _newEdit.Padding   = new Thickness(5);
                    _newDelete.Padding = new Thickness(5);

                    //fjern default style
                    _newEdit.Style   = (Style)this.FindResource(ToolBar.ButtonStyleKey);
                    _newDelete.Style = (Style)this.FindResource(ToolBar.ButtonStyleKey);

                    //giv bagrund farve
                    if (styleChanger)
                    {
                        _newGrid.Background = (Brush)this.FindResource("Row_1");
                    }
                    else
                    {
                        _newGrid.Background = (Brush)this.FindResource("Row_2");
                    }


                    if (!this.IsUnLock)
                    {
                        _borderIndex.IsEnabled = false;
                        _newHeader.IsEnabled   = false;
                        _newDelete.IsEnabled   = false;

                        //disable color
                        if (styleChanger)
                        {
                            _newGrid.Background = (Brush)this.FindResource("Row_1_Disable");
                        }
                        else
                        {
                            _newGrid.Background = (Brush)this.FindResource("Row_2_Disable");
                        }

                        _newIndex.Foreground  = funcClass.ColorBrushHex("#FF858585");
                        _newHeader.Foreground = funcClass.ColorBrushHex("#FF858585");
                    }


                    //lav row og column
                    Grid.SetRow(_border, rowDefId);

                    Grid.SetColumn(_borderIndex, 0);
                    Grid.SetColumn(_newHeader, 1);
                    Grid.SetColumn(_newEdit, 2);
                    Grid.SetColumn(_newDelete, 3);

                    //tilføj pakke til listview
                    _newGrid.Children.Add(_borderIndex);
                    _newGrid.Children.Add(_newHeader);
                    _newGrid.Children.Add(_newEdit);
                    _newGrid.Children.Add(_newDelete);

                    _border.Child = _newGrid;

                    _ItemsContains.Children.Add(_border);

                    itemCount++;
                }
            }

            _packCount.Content = "Antal: " + itemCount;

            //tjek om det er faktura delen og
            //om den er blivet sat en gang
            if (IsFaktura && !FirstFakturaItemIsSet)
            {
                FirstFakturaItemIsSet = true;
                SetElementPacketData(0, 0);
            }
            else if (!IsFaktura)
            {
                FirstFakturaItemIsSet = false;
            }

            HighLightSelected();
            ValueHasChanges();
        }
Beispiel #7
0
        /// <summary>
        /// opret en knap til måned og år
        /// </summary>
        private void AddGridCell(string text, int row, int column, int value, string selectedValue, bool isNowDate)
        {
            var funcClass = new Class.Functions.others();

            //hvis rækken ikke findes opret den
            while (row >= Grid_DateSelectButtons.RowDefinitions.Count)
            {
                Grid_DateSelectButtons.RowDefinitions.Add(new RowDefinition());
            }

            //hvis kolonnen ikke findes opret den
            while (column >= Grid_DateSelectButtons.ColumnDefinitions.Count)
            {
                Grid_DateSelectButtons.ColumnDefinitions.Add(new ColumnDefinition());
            }

            //hvis det er måned skal value gøre en gang større
            if (this.monthButtonClick)
            {
                value++;
            }

            //opret knap
            Button cellButton = new Button();

            cellButton.Style           = (Style)this.FindResource(ToolBar.ButtonStyleKey); //fjern default button layout
            cellButton.Content         = text;
            cellButton.Click          += Button_SelectSmall_YM_Click;
            cellButton.ToolTip         = value;
            cellButton.BorderThickness = new Thickness(0);
            cellButton.Padding         = new Thickness(5);

            //sæt bredde
            if (this.monthButtonClick)
            {
                cellButton.Width = 100;
            }
            else
            {
                cellButton.Width = 100;
            }


            if (text == selectedValue) //valgte måned
            {
                cellButton.Background = funcClass.ColorBrushHex("#FF3A8CDE");
                cellButton.Foreground = Brushes.White;
                cellButton.FontWeight = FontWeights.Bold;
            }
            else if (isNowDate) //denne måned
            {
                cellButton.Background = Brushes.LightBlue;
            }
            else //andet
            {
                cellButton.Background = Brushes.White;
            }


            Grid.SetColumn(cellButton, column);
            Grid.SetRow(cellButton, row);
            Grid_DateSelectButtons.Children.Add(cellButton);
        }