public Pliromi get_Last_Pliromi_By_Opid(Oplitis myOplitis) { Dal myDal = new Dal(); Pliromi myPliromi = new Pliromi(); DataTable dt = new DataTable(); SqlDataReader dr = myDal.getLastPliromiByOpid(myOplitis); if (dr.HasRows) { dt.Load(dr); } foreach (DataRow row in dt.Rows) { myPliromi.Pliromi_opid = Convert.ToInt32(row["op_id"].ToString()); myPliromi.PliromiId = Convert.ToInt32(row["p_id"].ToString()); myPliromi.PayDay = Convert.ToDateTime(row["p_date"].ToString()); myPliromi.p_opasm = Convert.ToInt32(row["op_asm"].ToString()); myPliromi.bathmos = row["r_perigrafi"].ToString(); myPliromi.onoma = row["op_onoma"].ToString(); myPliromi.eponymo = row["op_eponymo"].ToString(); myPliromi.loxos = row["op_loxos"].ToString(); myPliromi.katName = row["kat_name"].ToString(); myPliromi.katalogisteo = Convert.ToDecimal(row["kat_katalogisteo"].ToString()); myPliromi.kratiseis = Convert.ToDecimal(row["kat_kratiseis"].ToString()); myPliromi.pliroteo = Convert.ToDecimal(row["kat_pliroteo"].ToString()); myPliromi.mPerigrafi = row["m_perigrafi"].ToString(); if (string.IsNullOrEmpty(row["p_posoPliromis"].ToString())) { myPliromi.Poso = Convert.ToDecimal("0,00"); } else { myPliromi.Poso = Convert.ToDecimal(row["p_posoPliromis"].ToString()); } } return(myPliromi); }