public class BayiListe
{
public Boolean Durum { get; set; }
public string BayiAdi { get; set; }
}
//////////////// MODEL
public class Kullanici_Profili
{
public string KullaniciAdi { get; set; }
public string Bölge { get; set; }
public string TelNo { get; set; }
public string Resim { get; set; }
public List<BayiListe> BayiListe = new List<BayiListe>();
}
////////////////MODEL
SqlDataReader reader = null;
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.CommandType = System.Data.CommandType.StoredProcedure;
sqlCmd.CommandText = "sp_BayiListesi";
sqlCmd.Parameters.Add("@UserID", SqlDbType.Int);
sqlCmd.Parameters["@UserID"].Value = UserId;
sqlCmd.Connection = myConnection;
myConnection.Open();
reader = sqlCmd.ExecuteReader();
Kullanici_Profili model = new Kullanici_Profili();
while (reader.Read())
{
BayiListe model2 = new BayiListe();
model2.Durum = Convert.ToBoolean(reader.GetValue(0));
model2.BayiAdi = reader.GetValue(1).ToString();
model.BayiListe.Add(model2);
}
myConnection.Close();
////////////////////////
SqlDataReader reader2 = null;
SqlCommand sqlCmd2 = new SqlCommand();
sqlCmd2.CommandType = System.Data.CommandType.StoredProcedure;
sqlCmd2.CommandText = "sp_Kullanici_Profili";
sqlCmd2.Parameters.Add("@Userid", SqlDbType.Int);
sqlCmd2.Parameters["@Userid"].Value = UserId;
sqlCmd2.Connection = myConnection;
myConnection.Open();
reader2 = sqlCmd2.ExecuteReader();
while (reader2.Read())
{
model.KullaniciAdi = reader2.GetValue(0).ToString();
model.Bölge = reader2.GetValue(1).ToString();
model.TelNo = reader2.GetValue(2).ToString();
model.Resim = reader2.GetValue(3).ToString();
break;
}
myConnection.Close();
return model;
Hiç yorum yok:
Yorum Gönder