Example #1
0
        private void RemoveControls()
        {
            CbKat.SelectionChanged -= CbKat_SelectionChanged;
            CbKat.ItemsSource       = null;
            MyGrid.Children.Remove(_canvas);
            MyGrid.Children.Remove(_rafOranGrid);
            _rafOranGrid.Visibility = Visibility.Hidden;

            string ttString        = "0";
            string ttStringKatoran = "0";

            ToolTip tt = new ToolTip()
            {
                Placement = System.Windows.Controls.Primitives.PlacementMode.Mouse,
            };

            lblDepoDolulukOran.Content = "% 0";
            tt.Content = ttString;
            lblDepoDolulukOran.ToolTip = tt;
            tt.Content = ttStringKatoran;
            lblKatDolulukOran.ToolTip = tt;
            lblKatDolulukOran.Content = "% 0";

            lblKatBosDolu.Content  = "0 / 0";
            lblDepoBosDolu.Content = "0 / 0";

            lblDepoDolulukOran.Background = UIOperation.GetScaleColor(0);
            lblKatDolulukOran.Background  = UIOperation.GetScaleColor(0);
        }
Example #2
0
 private void RefreshRafOranGrid()
 {
     try
     {
         List <RafOran> newRafOranlist = GetRafOran(_CurrentKatModel.KatData, _CurrentDataList);
         int            i = 0;
         foreach (Object item in _rafOranGrid.Children)
         {
             if (item is Label)
             {
                 string lblName = newRafOranlist[i].RafName + " = % " + newRafOranlist[i].Oran;
                 ((Label)item).Content = lblName;
                 if (newRafOranlist[i].Oran >= 75)
                 {
                     ((Label)item).Foreground = Brushes.White;
                 }
                 else
                 {
                     ((Label)item).Foreground = Brushes.Black;
                 }
                 ((Label)item).Background = UIOperation.GetScaleColor(newRafOranlist[i].Oran);
                 i++;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("RefreshRafOranGrid\n" + ex.Message);
     }
 }
Example #3
0
        private void SetDepoLblValues(Guid depoID, Guid katID)
        {
            try
            {
                double toplam = 0;
                _DepoOrtalama      = 0;
                _DtDepoToplamPalet = _data.DepoDoluBosBilgiGetir(depoID);
                int depoDoluPalet = 0;
                if (_DtDepoToplamPalet.Rows.Count > 0)
                {
                    foreach (DataRow row in _DtDepoToplamPalet.Rows)
                    {
                        double oran = row["oran"].To <double>();
                        if (oran > 0)
                        {
                            depoDoluPalet++;
                        }
                    }
                    lblDepoBosDolu.Content = ("" + depoDoluPalet + " / " + _DtDepoToplamPalet.Rows.Count).ToString();
                }

                DataTable katDt = _data.KatDetayGetir(katID, depoID);

                double katOran = katDt.AsEnumerable()
                                 .Sum(r => r["oran"].ToString().To <double>());

                if (katOran > 0)
                {
                    toplam += (katOran) / katDt.Rows.Count;
                }

                ToolTip tt = new ToolTip()
                {
                    Placement = System.Windows.Controls.Primitives.PlacementMode.Mouse,
                };
                _DepoOrtalama = (toplam) / _DtKat.Rows.Count;
                string ttString = Math.Round(_DepoOrtalama, 3).ToString();
                _DepoOrtalama = Math.Round(_DepoOrtalama, 0);
                lblDepoDolulukOran.Content = "% " + _DepoOrtalama.ToString();

                tt.Content = ttString;
                lblDepoDolulukOran.ToolTip    = tt;
                lblDepoDolulukOran.Background = UIOperation.GetScaleColor(_DepoOrtalama);
                KatModel newKm = new KatModel(depoID, _CurrentKatModel.Name, katID, katOran / katDt.Rows.Count, katDt);
                _CurrentKatModel = newKm;
            }
            catch (Exception ex)
            {
                MessageBox.Show("SetDepoLblValues\n" + ex.Message);
            }
        }
Example #4
0
 public void Init(HucreModel hm, int paletMiktar, double oran, int toplamMiktar)
 {
     _hm                   = hm;
     this.KeyDown         += Windows_KeyDown;
     WindowStartupLocation = WindowStartupLocation.CenterScreen;
     LblAdres.Content      = hm.Name;
     // oran =(Double)toplamMiktar / paletMiktar*100;
     LblOran.Content = "% " + Math.Round(oran, 1).ToString();
     if (oran >= 75)
     {
         LblOran.Foreground = Brushes.White;
     }
     else
     {
         LblOran.Foreground = Brushes.Black;
     }
     LblOran.Background = UIOperation.GetScaleColor(oran);
     LblTipIsim.Content = hm.TipIsim;
     LblMiktar.Content  = toplamMiktar.ToString() + " / " + paletMiktar.ToString();
 }
        public void Init(KatDetayModel kdm, double oran)
        {
            try
            {
                _oran                       = oran;
                _kdm                        = kdm;
                _rafIsim                    = kdm.Name;
                _rafGenelBilgi              = new DataTable();
                _data                       = new Data();
                this.Title                  = "RAF -" + kdm.Name;
                LblRafGenelDurum.Content    = "RAF - " + kdm.Name + " = % " + Math.Round(oran, 1) + "";
                LblRafGenelDurum.Background = UIOperation.GetScaleColor(oran);

                _rafGenelBilgi = _data.RafGenelBilgiGetir(kdm);
                SetOranLabelsValues(_rafGenelBilgi);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Init\n" + ex.Message);
            }
        }
Example #6
0
        private void CreateColorScale()
        {
            try
            {
                GridColor = UIOperation.CreateColorsGrid(MainGrid, 2, 0, 1, 1);
                Grid.SetColumn(GridColor, 0);
                Grid.SetRow(GridColor, 2);
                MainGrid.Children.Add(GridColor);

                if (_hucreColCount * _width < this.Width)
                {
                    GrBox.Width = this.Width;
                    GridHucre.HorizontalAlignment = HorizontalAlignment.Center;
                    GridOran.HorizontalAlignment  = HorizontalAlignment.Center;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("CreateColorScale\n" + ex.Message);
            }
        }
Example #7
0
        private void SetKatLblValues(KatModel km)
        {
            try
            {
                int    KatToplamPalet     = 0;
                int    katToplamDoluPalet = 0;
                double katOrtalama        = Math.Round(km.KatOran, 0);
                foreach (DataRow row in _DtDepoToplamPalet.Rows)
                {
                    Guid KatId = new Guid(row["DepoKatID"].ToString());
                    if (KatId.Equals(km.Id))
                    {
                        double oran = row["oran"].To <double>();
                        if (oran > 0)
                        {
                            katToplamDoluPalet++;
                        }
                        KatToplamPalet++;
                    }
                }
                lblKatBosDolu.Content = ("" + katToplamDoluPalet + " / " + KatToplamPalet).ToString();
                ToolTip tt = new ToolTip()
                {
                    Placement = System.Windows.Controls.Primitives.PlacementMode.Mouse,
                };
                string ttStringKatoran = Math.Round(km.KatOran, 3).ToString();
                tt.Content = ttStringKatoran;
                lblKatDolulukOran.ToolTip = tt;
                lblKatDolulukOran.Content = "% " + katOrtalama.ToString();


                lblKatDolulukOran.Background = UIOperation.GetScaleColor(katOrtalama);
            }
            catch (Exception ex)
            {
                MessageBox.Show("SetKatLblValues\n" + ex.Message);
            }
        }
Example #8
0
        private void RefreshGenelToplamLabels(int rowCount)
        {
            try
            {
                Label lblToplam = UIOperation.Getlabel(GridTip, rowCount + 1, 7);
                lblToplam.Content = _counter.ToString();

                _genelOrtalama = Math.Round(_genelToplam / _counter, 0);
                Label lblGenelOrtalama = UIOperation.Getlabel(GridTip, rowCount + 1, 8);
                lblGenelOrtalama.Content    = "% " + _genelOrtalama;
                lblGenelOrtalama.Background = UIOperation.GetScaleColor(_genelOrtalama);


                Label lbl_bos = UIOperation.Getlabel(GridTip, rowCount + 1, 1);
                lbl_bos.Content = _bos.ToString();

                Label lbl_asiriYuklu = UIOperation.Getlabel(GridTip, rowCount + 1, 6);
                lbl_asiriYuklu.Content = _asiriYuklu.ToString();

                Label lbl_0_25 = UIOperation.Getlabel(GridTip, rowCount + 1, 2);
                lbl_0_25.Content = _c0_25.ToString();

                Label lbl_25_50 = UIOperation.Getlabel(GridTip, rowCount + 1, 3);
                lbl_25_50.Content = _c25_50.ToString();

                Label lbl_50_75 = UIOperation.Getlabel(GridTip, rowCount + 1, 4);
                lbl_50_75.Content = _c50_75.ToString();

                Label lbl_75_100 = UIOperation.Getlabel(GridTip, rowCount + 1, 5);
                lbl_75_100.Content = _c75_100.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show("RefreshGelenToplamLabels\n" + ex.Message);
            }
        }
Example #9
0
        private GroupBox CreateUrunControls(int index)
        {
            try
            {
                Grid g = new Grid
                {
                    Background = Brushes.MediumPurple
                };
                GroupBox grb = new GroupBox()
                {
                    VerticalAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Width      = _width,
                    Height     = _height,
                    Background = Brushes.MediumVioletRed
                };
                Grid.SetColumn(grb, 0);
                Grid.SetRow(grb, index);
                g.Margin = new Thickness(10);
                for (int i = 0; i < 4; i++)
                {
                    RowDefinition row = new RowDefinition()
                    {
                        Height = new GridLength(_height / 5)
                    };
                    g.RowDefinitions.Add(row);
                }
                int length = 1;
                for (int i = 0; i < 3; i++)
                {
                    if (i == 2)
                    {
                        length = 2;
                    }

                    ColumnDefinition col = new ColumnDefinition()
                    {
                        Width = new GridLength(_width / 4 * length - 10)
                    };
                    g.ColumnDefinitions.Add(col);
                }

                Image img = new Image
                {
                    Source = UIOperation.StrToImage(_imgPath)
                };
                img.ResizeImage(new Size(_width / 4, _height));

                Grid.SetRow(img, 0);
                Grid.SetRowSpan(img, 4);
                Grid.SetColumn(img, 0);

                g.Children.Add(img);

                Label lblKod = new Label
                {
                    FontSize   = 15,
                    FontWeight = FontWeights.Bold,
                    Background = Brushes.Wheat
                };
                lblKod.SetLabelIntoGrid(_hm.Urun[index].Kod, 0, 2, _width / 2 - 10, _height / 5);
                g.Children.Add(lblKod);
                Label lblIsim = new Label
                {
                    FontSize   = 15,
                    FontWeight = FontWeights.Bold,
                    Background = Brushes.Wheat
                };
                lblIsim.SetLabelIntoGrid(_hm.Urun[index].Name, 1, 2, _width / 2 - 10, _height / 5);
                g.Children.Add(lblIsim);
                Label lblMiktar = new Label
                {
                    FontSize   = 15,
                    FontWeight = FontWeights.Bold,
                    Background = Brushes.Wheat
                };
                lblMiktar.SetLabelIntoGrid(_hm.Urun[index].Miktar.ToString(), 2, 2, _width / 2 - 10, _height / 5);
                g.Children.Add(lblMiktar);
                Label lblKodText = new Label
                {
                    FontSize   = 15,
                    FontWeight = FontWeights.Bold,
                    Background = Brushes.LightGreen
                };
                lblKodText.SetLabelIntoGrid("ÜRÜN KODU :", 0, 1, _width / 4 - 10, _height / 5);
                g.Children.Add(lblKodText);
                Label lblIsimText = new Label
                {
                    FontSize   = 15,
                    FontWeight = FontWeights.Bold,
                    Background = Brushes.LightGreen
                };
                lblIsimText.SetLabelIntoGrid("ÜRÜN İSMİ", 1, 1, _width / 4 - 10, _height / 5);
                g.Children.Add(lblIsimText);
                Label lblMiktarText = new Label
                {
                    FontSize   = 15,
                    FontWeight = FontWeights.Bold,
                    Background = Brushes.LightGreen
                };
                lblMiktarText.SetLabelIntoGrid("MİKTAR", 2, 1, _width / 4 - 10, _height / 5);
                g.Children.Add(lblMiktarText);

                Button btn = new Button()
                {
                    Content             = "DETAY",
                    Width               = _width / 4,
                    Height              = _height / 4,
                    FontSize            = 15,
                    FontWeight          = FontWeights.Bold,
                    VerticalAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Background          = Brushes.WhiteSmoke
                };
                btn.Click += delegate(object sender, RoutedEventArgs e) { GetPic(); };
                Grid.SetRow(btn, 3);
                Grid.SetColumn(btn, 2);
                Grid.SetColumnSpan(btn, 2);
                g.Children.Add(btn);
                grb.Content = g;

                return(grb);
            }
            catch (Exception ex)
            {
                MessageBox.Show("CreateUrunControls\n" + ex.Message);
                return(null);
            }
        }
Example #10
0
        private void CreateGenelToplamLabels(int rowCount)
        {
            try
            {
                Label lblGenelToplam = new Label
                {
                    Background = Brushes.DarkGray,
                    FontWeight = FontWeights.Bold,
                    FontSize   = 20
                };
                lblGenelToplam.SetLabelIntoGrid("Genel Toplam", rowCount + 1, 0, _tipLabelWidth, _tipLabelHeight);
                GridTip.Children.Add(lblGenelToplam);

                Label lblToplam = new Label
                {
                    Background = Brushes.DarkGray,
                    FontWeight = FontWeights.Bold,
                    FontSize   = 20
                };
                lblToplam.SetLabelIntoGrid(_counter.ToString(), rowCount + 1, 7, _tipLabelWidth, _tipLabelHeight);
                GridTip.Children.Add(lblToplam);

                Label lblGenelOrtalama = new Label {
                    Background = UIOperation.GetScaleColor(_genelOrtalama),
                    FontWeight = FontWeights.Bold,
                    FontSize   = 20
                };
                lblGenelOrtalama.SetLabelIntoGrid("% " + _genelOrtalama.ToString(), rowCount + 1, 8, _tipLabelWidth, _tipLabelHeight);
                GridTip.Children.Add(lblGenelOrtalama);

                Label lbl_bos = new Label {
                    Background = UIOperation.GetScaleColor(0),
                    FontWeight = FontWeights.Bold,
                    FontSize   = 20
                };
                lbl_bos.SetLabelIntoGrid(_bos.ToString(), rowCount + 1, 1, _tipLabelWidth, _tipLabelWidth);
                GridTip.Children.Add(lbl_bos);

                Label lbl_asiriYuklu = new Label()
                {
                    Background = UIOperation.GetScaleColor(110), Foreground = Brushes.White,
                    FontWeight = FontWeights.Bold,
                    FontSize   = 20
                };
                lbl_asiriYuklu.SetLabelIntoGrid(_asiriYuklu.ToString(), rowCount + 1, 6, _tipLabelWidth, _tipLabelHeight);
                GridTip.Children.Add(lbl_asiriYuklu);

                Label lbl_0_25 = new Label()
                {
                    Background = UIOperation.GetScaleColor(5),
                    FontWeight = FontWeights.Bold,
                    FontSize   = 20
                };
                lbl_0_25.SetLabelIntoGrid(_c0_25.ToString(), rowCount + 1, 2, _tipLabelWidth, _tipLabelHeight);
                GridTip.Children.Add(lbl_0_25);

                Label lbl_25_50 = new Label()
                {
                    Background = UIOperation.GetScaleColor(30),
                    FontWeight = FontWeights.Bold,
                    FontSize   = 20
                };
                lbl_25_50.SetLabelIntoGrid(_c25_50.ToString(), rowCount + 1, 3, _tipLabelWidth, _tipLabelHeight);
                GridTip.Children.Add(lbl_25_50);

                Label lbl_50_75 = new Label()
                {
                    Background = UIOperation.GetScaleColor(65),
                    FontWeight = FontWeights.Bold,
                    FontSize   = 20
                };
                lbl_50_75.SetLabelIntoGrid(_c50_75.ToString(), rowCount + 1, 4, _tipLabelWidth, _tipLabelHeight);
                GridTip.Children.Add(lbl_50_75);

                Label lbl_75_100 = new Label()
                {
                    Background = UIOperation.GetScaleColor(85),
                    FontWeight = FontWeights.Bold,
                    FontSize   = 20
                };
                lbl_75_100.SetLabelIntoGrid(_c75_100.ToString(), rowCount + 1, 5, _tipLabelWidth, _tipLabelHeight);
                lbl_75_100.Foreground = Brushes.White;
                GridTip.Children.Add(lbl_75_100);
            }
            catch (Exception ex)
            {
                MessageBox.Show("CreateGenelToplamLabels\n" + ex.Message);
            }
        }
Example #11
0
        private void CreateTipColorsLabels(DataRow[] rows, string tipIsim, int gridRowIndex)
        {
            try
            {
                Label lblTipIsim = new Label
                {
                    Background = Brushes.LightGray,
                    FontWeight = FontWeights.Bold,
                    FontSize   = 20
                };
                lblTipIsim.SetLabelIntoGrid(tipIsim, gridRowIndex + 1, 0, _tipLabelWidth, _tipLabelHeight);
                GridTip.Children.Add(lblTipIsim);

                Label lblOrtalamaSonuc = new Label();
                lblOrtalamaSonuc.SetLabelIntoGrid(gridRowIndex + 1, 8, _tipLabelWidth, _tipLabelHeight);
                GridTip.Children.Add(lblOrtalamaSonuc);

                Label lbl_bos = new Label {
                    Background = UIOperation.GetScaleColor(0)
                };
                Label lbl_asiriYuklu = new Label()
                {
                    Background = UIOperation.GetScaleColor(110), Foreground = Brushes.White
                };
                Label lbl_0_25 = new Label()
                {
                    Background = UIOperation.GetScaleColor(5)
                };
                Label lbl_25_50 = new Label()
                {
                    Background = UIOperation.GetScaleColor(35)
                };
                Label lbl_50_75 = new Label()
                {
                    Background = UIOperation.GetScaleColor(65)
                };
                Label lbl_75_100 = new Label()
                {
                    Background = UIOperation.GetScaleColor(85)
                };

                Label lbl_toplam = new Label()
                {
                    Background = Brushes.DarkGray,
                    FontWeight = FontWeights.Bold,
                    FontSize   = 20
                };
                int bos        = 0;
                int asiriYuklu = 0;
                int c0_25      = 0;
                int c25_50     = 0;
                int c50_75     = 0;
                int c75_100    = 0;


                int    counter  = 0;
                double toplam   = 0;
                double ortalama = 0;
                for (int i = 0; i < rows.Length; i++)
                {
                    double oran = rows[i]["oran"].To <double>();
                    if (oran == 0)
                    {
                        bos++;
                    }
                    else if (oran > 100)
                    {
                        asiriYuklu++;
                    }
                    else if (oran > 0 && oran <= 25)
                    {
                        c0_25++;
                    }
                    else if (oran > 25 && oran <= 50)
                    {
                        c25_50++;
                    }
                    else if (oran > 50 && oran <= 75)
                    {
                        c50_75++;
                    }
                    else if (oran > 75 && oran <= 100)
                    {
                        c75_100++;
                    }

                    else
                    {
                        throw new Exception("Geçersiz Oran Değeri");
                    }

                    counter++;
                    toplam += oran;
                }

                _bos        += bos;
                _asiriYuklu += asiriYuklu;
                _c0_25      += c0_25;
                _c25_50     += c25_50;
                _c50_75     += c50_75;
                _c75_100    += c75_100;


                ortalama  = toplam / counter;
                _counter += counter;



                lblOrtalamaSonuc.Background = UIOperation.GetScaleColor(ortalama);
                lblOrtalamaSonuc.Content    = "% " + Math.Round(ortalama, 0).ToString();
                lblOrtalamaSonuc.FontWeight = FontWeights.Bold;
                lblOrtalamaSonuc.FontSize   = 20;

                lbl_toplam.SetLabelIntoGrid(counter.ToString(), gridRowIndex + 1, 7, _tipLabelWidth, _tipLabelHeight);
                lbl_toplam.FontWeight = FontWeights.Bold;
                lbl_toplam.FontSize   = 20;
                GridTip.Children.Add(lbl_toplam);

                lbl_bos.SetLabelIntoGrid(bos.ToString(), gridRowIndex + 1, 1, _tipLabelWidth, _tipLabelHeight);
                lbl_bos.FontWeight = FontWeights.Bold;
                lbl_bos.FontSize   = 20;
                GridTip.Children.Add(lbl_bos);

                lbl_asiriYuklu.SetLabelIntoGrid(asiriYuklu.ToString(), gridRowIndex + 1, 6, _tipLabelWidth, _tipLabelHeight);
                lbl_asiriYuklu.FontWeight = FontWeights.Bold;
                lbl_asiriYuklu.FontSize   = 20;
                GridTip.Children.Add(lbl_asiriYuklu);

                lbl_0_25.SetLabelIntoGrid(c0_25.ToString(), gridRowIndex + 1, 2, _tipLabelWidth, _tipLabelHeight);
                lbl_0_25.FontWeight = FontWeights.Bold;
                lbl_0_25.FontSize   = 20;
                GridTip.Children.Add(lbl_0_25);

                lbl_25_50.SetLabelIntoGrid(c25_50.ToString(), gridRowIndex + 1, 3, _tipLabelWidth, _tipLabelHeight);
                lbl_25_50.FontWeight = FontWeights.Bold;
                lbl_25_50.FontSize   = 20;
                GridTip.Children.Add(lbl_25_50);

                lbl_50_75.SetLabelIntoGrid(c50_75.ToString(), gridRowIndex + 1, 4, _tipLabelWidth, _tipLabelHeight);
                lbl_50_75.FontWeight = FontWeights.Bold;
                lbl_50_75.FontSize   = 20;
                GridTip.Children.Add(lbl_50_75);

                lbl_75_100.SetLabelIntoGrid(c75_100.ToString(), gridRowIndex + 1, 5, _tipLabelWidth, _tipLabelHeight);
                lbl_75_100.FontWeight = FontWeights.Bold;
                lbl_75_100.FontSize   = 20;
                lbl_75_100.Foreground = Brushes.White;
                GridTip.Children.Add(lbl_75_100);
            }
            catch (Exception ex)
            {
                MessageBox.Show("CreateTipColorsLabels\n" + ex.Message);
            }
        }
Example #12
0
        private void CreateHucre()
        {
            try
            {
                int counter = 0;
                for (int i = 0; i < _hucreColCount; i++)
                {
                    int    oranCounter = 0;
                    double toplam      = 0;
                    double Or          = 0;

                    int yukseklikControl = _hucreRowCount;

                    for (int j = 0; j < _hucreRowCount; j++)
                    {
                        Label lblHucre = new Label();

                        DataRow row       = _dt.Rows[counter];
                        int     yukseklik = row["Yukseklik"].ToInt();

                        if (yukseklikControl != yukseklik)
                        {
                            yukseklikControl--;
                            continue;
                        }
                        yukseklikControl--;
                        string adres   = row["Adres"].ToString();
                        int    tip     = row["Tip"].ToInt();
                        string tipIsim = row["TipIsim"].ToString();
                        Guid   id      = new Guid(row["AdresId"].ToString());
                        Guid   ulId    = new Guid(row["RafId"].ToString());

                        string koy  = row["Koy"].ToString();
                        int    sira = row["Sira"].ToInt();
                        string raf  = row["Raf"].ToString();
                        double oran = Convert.ToDouble(row["Oran"].ToString());

                        HucreModel hm = new HucreModel(_Kdm.KatId, _Kdm.DepoId, id, ulId, adres, koy, sira, yukseklik, raf, oran, tip, tipIsim);


                        lblHucre.Tag = hm;

                        lblHucre.SetLabelIntoGrid(j, i, _width, _height);
                        lblHucre.FontSize = 12;
                        if (tip == 100)
                        {
                            lblHucre.Background = Brushes.Transparent;
                            lblHucre.Content    = "";
                        }
                        else if (tip == 255)
                        {
                            lblHucre.Background = Brushes.Black;
                            lblHucre.Content    = "K";
                            lblHucre.Foreground = Brushes.White;
                        }
                        else
                        {
                            lblHucre.MouseDoubleClick += delegate(object sender, MouseButtonEventArgs e) { UIOperation.HucreClick(sender, e, ((HucreModel)lblHucre.Tag)); };
                            lblHucre.Background        = UIOperation.GetScaleColor(oran);
                            lblHucre.Content           = "%" + Math.Round(oran, 0).ToString();
                            if (oran >= 75)
                            {
                                lblHucre.Foreground = Brushes.White;
                            }
                            else
                            {
                                lblHucre.Foreground = Brushes.Black;
                            }

                            oranCounter++;
                            toplam += oran;
                        }

                        GridHucre.Children.Add(lblHucre);

                        counter++;
                    }
                    if (oranCounter > 0)
                    {
                        Or = (double)toplam / oranCounter;
                    }
                    else
                    {
                        Or = -1;
                    }
                    Label lblOran = new Label();
                    lblOran.SetLabelIntoGrid(0, i, _width, _height);
                    lblOran.FontSize   = 13;
                    lblOran.FontWeight = FontWeights.Bold;

                    if (Or == -1)
                    {
                        lblOran.Content    = " ";
                        lblOran.Background = Brushes.DarkGray;
                    }

                    else
                    {
                        lblOran.Content    = "%" + Math.Round(Or, 0).ToString();
                        lblOran.Background = UIOperation.GetScaleColor(Or);
                    }
                    if (Or >= 75)
                    {
                        lblOran.Foreground = Brushes.White;
                    }
                    else
                    {
                        lblOran.Foreground = Brushes.Black;
                    }

                    Grid.SetRow(lblOran, 0);
                    Grid.SetColumn(lblOran, i);
                    GridOran.Children.Add(lblOran);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("CreateHucre\n" + ex.Message);
            }
        }
Example #13
0
        private void RefreshTipColorsLabels(DataRow[] rows, int gridRowIndex)
        {
            try
            {
                Label lblOrtalamaSonuc = UIOperation.Getlabel(GridTip, gridRowIndex + 1, 8);
                Label lbl_bos          = UIOperation.Getlabel(GridTip, gridRowIndex + 1, 1);
                Label lbl_asiriYuklu   = UIOperation.Getlabel(GridTip, gridRowIndex + 1, 6);
                Label lbl_0_25         = UIOperation.Getlabel(GridTip, gridRowIndex + 1, 2);
                Label lbl_25_50        = UIOperation.Getlabel(GridTip, gridRowIndex + 1, 3);
                Label lbl_50_75        = UIOperation.Getlabel(GridTip, gridRowIndex + 1, 4);
                Label lbl_75_100       = UIOperation.Getlabel(GridTip, gridRowIndex + 1, 5);
                Label lbl_toplam       = UIOperation.Getlabel(GridTip, gridRowIndex + 1, 7);

                int bos        = 0;
                int asiriYuklu = 0;
                int c0_25      = 0;
                int c25_50     = 0;
                int c50_75     = 0;
                int c75_100    = 0;

                int    counter  = 0;
                double toplam   = 0;
                double ortalama = 0;
                for (int i = 0; i < rows.Length; i++)
                {
                    double oran = rows[i]["oran"].To <double>();
                    if (oran == 0)
                    {
                        bos++;
                    }
                    else if (oran > 100)
                    {
                        asiriYuklu++;
                    }
                    else if (oran > 0 && oran <= 25)
                    {
                        c0_25++;
                    }
                    else if (oran > 25 && oran <= 50)
                    {
                        c25_50++;
                    }
                    else if (oran > 50 && oran <= 75)
                    {
                        c50_75++;
                    }
                    else if (oran > 75 && oran <= 100)
                    {
                        c75_100++;
                    }

                    else
                    {
                        throw new Exception("Geçersiz Oran Değeri");
                    }

                    counter++;
                    toplam += oran;
                }

                _bos         += bos;
                _asiriYuklu  += asiriYuklu;
                _c0_25       += c0_25;
                _c25_50      += c25_50;
                _c50_75      += c50_75;
                _c75_100     += c75_100;
                _genelToplam += toplam;
                ortalama      = toplam / counter;
                _counter     += counter;

                lblOrtalamaSonuc.Background = UIOperation.GetScaleColor(ortalama);
                lblOrtalamaSonuc.Content    = "% " + Math.Round(ortalama, 0).ToString();
                lbl_toplam.Content          = counter.ToString();

                lbl_bos.Content        = bos.ToString();
                lbl_asiriYuklu.Content = asiriYuklu.ToString();
                lbl_0_25.Content       = c0_25.ToString();
                lbl_25_50.Content      = c25_50.ToString();
                lbl_50_75.Content      = c50_75.ToString();
                lbl_75_100.Content     = c75_100.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show("RefreshTipColorsLabels\n" + ex.Message);
            }
        }
Example #14
0
        private void CreateKatDetay(KatModel km, double DepoOrtalama)
        {
            try
            {
                this.Dispatcher.Invoke((Action)(() => {
                    //int KatToplamPalet = 0;
                    //int katToplamDoluPalet = 0;
                    //foreach (DataRow row in _DtDepoToplamPalet.Rows)
                    //{
                    //    Guid KatId = new Guid(row["DepoKatID"].ToString());
                    //    if (KatId.Equals(km.Id))
                    //    {
                    //        double oran = row["oran"].To<double>();
                    //        if (oran > 0)
                    //        {
                    //            katToplamDoluPalet++;
                    //        }
                    //        KatToplamPalet++;
                    //    }
                    //}
                    //lblKatBosDolu.Content = ("" + katToplamDoluPalet + " / " + KatToplamPalet).ToString();
                    _gridColors = UIOperation.CreateColorsGrid(GridColor, 0, 1);
                    Grid.SetRow(_gridColors, 0);
                    Grid.SetColumn(_gridColors, 1);
                    GridColor.Children.Remove(_gridColors);
                    GridColor.Children.Add(_gridColors);

                    // DataTable dt = _data.KatDetayGetir(new Guid());

                    _CurrentDataList = new List <KatDetayModel>();
                    MyGrid.GetColAndRowSize(out int b, out int a, 0, 1);

                    DataTable dt = _data.KatBoyutGetir(km.Id);
                    int katx = 0, katy = 0;
                    if (dt.Rows.Count > 0)
                    {
                        DataRow row = dt.Rows[0];
                        katx = row["X"].ToString().ToInt();
                        katy = row["Y"].ToString().ToInt();
                    }


                    //  MessageBox.Show("height="+ a.ToString()+"\n width="+b.ToString());
                    KatDetayShape kds = new KatDetayShape(b, a, katx, katy);

                    foreach (DataRow row in km.KatData.Rows)
                    {
                        Guid id = new Guid(row["AdresId"].ToString());
                        Guid UlId = new Guid(row["RafID"].ToString());
                        string name = row["Raf"].ToString();
                        int x = row["KX"].ToInt();
                        int y = row["KY"].ToInt();
                        string koy = row["Koy"].ToString();
                        double oran = row["oran"].To <double>();
                        //if (oran > 0)
                        //{
                        //    toplam += (1 / oran) * 100;
                        //}

                        int sira = row["Sira"].ToInt();
                        _CurrentDataList.Add(new KatDetayModel(id, UlId, new Point(x, y), name, oran, sira, koy, km.Id, km.UlId));
                    }
                    SetKatLblValues(km);
                    CreateRafOranGrid(GetRafOran(km.KatData, _CurrentDataList));
                    //   ortalama = (100 * toplam) / dt.Rows.Count;
                    //  string ttString = Math.Round(DepoOrtalama, 3).ToString();
                    //   string ttStringKatoran = Math.Round(km.KatOran, 3).ToString();

                    //ToolTip tt = new ToolTip()
                    //{

                    //    Placement = System.Windows.Controls.Primitives.PlacementMode.Mouse,

                    //};

                    //DepoOrtalama = Math.Round(DepoOrtalama, 0);
                    //double katOrtalama = Math.Round(km.KatOran, 0);
                    //lblDepoDolulukOran.Content = "% " + DepoOrtalama.ToString();
                    //tt.Content = ttString;
                    //lblDepoDolulukOran.ToolTip = tt;
                    //tt.Content = ttStringKatoran;
                    //lblKatDolulukOran.ToolTip = tt;
                    //lblKatDolulukOran.Content = "% " + katOrtalama.ToString();

                    //lblDepoDolulukOran.Background = UIOperation.GetScaleColor(DepoOrtalama);
                    //lblKatDolulukOran.Background = UIOperation.GetScaleColor(katOrtalama);


                    _canvas.Tag = _CurrentDataList;
                    _canvas = kds.DrawCanvas((List <KatDetayModel>)_canvas.Tag);


                    _canvas.MouseLeftButtonDown += CanvasClick;
                    _canvas.MouseMove += CanvasOver;
                    _canvas.MouseRightButtonDown += CanvasRightClick;


                    Grid.SetRow(_canvas, 1);
                    Grid.SetColumn(_canvas, 0);
                    _canvas.Background = (SolidColorBrush) new BrushConverter().ConvertFrom("#ccccff");
                    MyGrid.Children.Add(_canvas);
                }));
            }
            catch (Exception ex)
            {
                MessageBox.Show("CreateKatDetay\n" + ex.Message);
            }
        }