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); }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }