private void ExecuteSearchCommand() { if (tempList.Count == 0) { foreach (TableSMItem item in DERS) { tempList.Add(item); } DERS.Clear(); foreach (TableSMItem item in tempList) { if (item.Der.Name.Contains(SearchName) || item.Der.Name.ToLower().Contains(SearchName)) { DERS.Add(item); } } SearchButton = "Cancel Search"; IsFilterEnabled = false; } else { DERS.Clear(); foreach (TableSMItem item in tempList) { DERS.Add(item); } tempList.Clear(); SearchButton = "Search"; IsFilterEnabled = true; } ShowGauges(); }
public void List() { int? numara = null; string name = null; string tc = null; string soyad = null; if (this.txtSearch.Text.Length > 0) { numara = Convert.ToInt32(this.txtSearch.Text); } if (this.txtSearch2.Text.Length > 0) { name = this.txtSearch2.Text; } if (this.txttc.Text.Length > 0) { tc = this.txttc.Text; } if (this.txtsoyad.Text.Length > 0) { soyad = this.txtsoyad.Text; } var bolum = SessionManager.Login.BOLUM; dgrList.DataSource = Db.SearchList(numara, name, tc, soyad, bolum); dgrList.DataBind(); DERS.DataSource = Db.DerslerListGet(); DERS.DataBind(); }
public static List <DERS> DERS_GETIR(DERS param) { Connect(); cmd = new SqlCommand("SP_DERS", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@PROCESS_TYPE", "GETIR"); cmd.Parameters.AddWithValue("@DERS_ID", dbnull); cmd.Parameters.AddWithValue("@DERS_AD", ToDBNull(param.DERS_AD)); cmd.Parameters.AddWithValue("@ACIKLAMA", ToDBNull(param.ACIKLAMA)); SqlDataReader dr = cmd.ExecuteReader(); List <DERS> list = new List <DERS>(); while (dr.Read()) { DERS ders = new DERS(); ders.DERS_ID = (int)dr["DERS_ID"]; ders.DERS_AD = dr["DERS_AD"].ToString(); ders.ACIKLAMA = dr["ACIKLAMA"].ToString(); list.Add(ders); } return(list); }
public void ShowGauges() { Thread.Sleep(1000); int counter = 0; while (true) { if (DERS.Count != 0) { break; } else { if (counter == 5) { break; } counter++; Thread.Sleep(1000); } } ActiveMinimum = Math.Round(DERS.Sum(o => o.PDecrease), 2); ActiveMaximum = Math.Round(DERS.Sum(o => o.PIncrease), 2); ActiveValue = Math.Round(DERS.Sum(o => o.CurrentP), 2); ReactiveMinimum = Math.Round(DERS.Sum(o => o.QDecrease), 2); ReactiveMaximum = Math.Round(DERS.Sum(o => o.QIncrease), 2); ReactiveValue = Math.Round(DERS.Sum(o => o.CurrentQ), 2); double SunPower = DERS.Where(o => o.Der.FuelType.Equals(FuelType.Sun)).ToList().Sum(o => o.CurrentP); if (ActiveValue != 0) { ActiveShareSun = Math.Round((SunPower / ActiveValue) * 100, 2); if (ActiveShareSun > 100) { ActiveShareSun = 100; } } else { ActiveShareSun = 0; } GaugesVisibility = Visibility.Visible; }
private void buttonekle_Click(object sender, EventArgs e) { d1 = new DERS(); d1.DERS_AD = textBoxders.Text; d1.ACIKLAMA = richTextBoxacıklama.Text; Veritabani.Connect(); bool deger = Veritabani.DERS_EKLE(d1); if (deger) { MessageBox.Show("Ders Eklendi"); } Veritabani.Disconnect(); }
private void ExecuteFilterCommand() { if (tempList.Count == 0) { foreach (TableSMItem item in DERS) { tempList.Add(item); } DERS.Clear(); foreach (TableSMItem item in tempList) { if (FilterType.Equals("Sun")) { if (item.Der.FuelType == FTN.Common.FuelType.Sun) { DERS.Add(item); } } else if (FilterType.Equals("Wind")) { if (item.Der.FuelType == FTN.Common.FuelType.Wind) { DERS.Add(item); } } else { } } FilterButton = "Cancel Filter"; IsSearchEnabled = false; } else { DERS.Clear(); foreach (TableSMItem item in tempList) { DERS.Add(item); } tempList.Clear(); FilterButton = "Filter"; IsSearchEnabled = true; } ShowGauges(); }
public static bool DERS_GUNCELLE(DERS param) { Connect(); cmd = new SqlCommand("SP_DERS", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@PROCESS_TYPE", "GUNCELLE"); cmd.Parameters.AddWithValue("@DERS_ID", param.DERS_ID); cmd.Parameters.AddWithValue("@DERS_AD", dbnull); cmd.Parameters.AddWithValue("@ACIKLAMA", dbnull); if (cmd.ExecuteNonQuery() >= 1) { return(true); } else { return(false); } }