public Oplitis get_Last_Inserted_Oplitis() { Dal myDal = new Dal(); Oplitis myOplitis = new Oplitis(); DataTable dt = new DataTable(); SqlDataReader dr = myDal.getLastInsertedOplitis(); if (dr.HasRows) { dt.Load(dr); } foreach (DataRow row in dt.Rows) { myOplitis.id = Convert.ToInt32(row["op_id"].ToString()); myOplitis.katigoria = row["kat_name"].ToString(); myOplitis.bathmos = row["r_perigrafi"].ToString(); myOplitis.eponymo = row["op_eponymo"].ToString(); myOplitis.onoma = row["op_onoma"].ToString(); myOplitis.eggrafi = Convert.ToDateTime(row["op_eggrafi"].ToString()); myOplitis.asm = Convert.ToInt32(row["op_asm"].ToString()); myOplitis.loxos = row["op_loxos"].ToString(); myOplitis.paratiriseis = row["op_paratiriseis"].ToString(); myOplitis.katalogisteo = Convert.ToDecimal(row["kat_katalogisteo"].ToString()); myOplitis.kratiseis = Convert.ToDecimal(row["kat_kratiseis"].ToString()); myOplitis.pliroteo = Convert.ToDecimal(row["kat_pliroteo"].ToString()); myOplitis.dXmas = Convert.ToDecimal(row["kat_dx"].ToString()); myOplitis.dPasxa = Convert.ToDecimal(row["kat_dp"].ToString()); myOplitis.fdmDate = Convert.ToDateTime(row["fdmDate"].ToString()); } return(myOplitis); }