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 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); } }
private void RefreshHucre() { 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 = UIOperation.Getlabel(GridHucre, j, i); 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; 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.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; } counter++; } if (oranCounter > 0) { Or = (double)toplam / oranCounter; } else { Or = -1; } Label lblOran = UIOperation.Getlabel(GridOran, 0, i); 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; } } } catch (Exception ex) { MessageBox.Show("RefreshHucre\n" + ex.Message); } }