public Verification(int id) { try { VerificationProvider pr = new VerificationProvider(); DataSet ds = pr.getById(id); if (ds.Tables[0].Rows.Count > 0) { this.id = int.Parse(ds.Tables[0].Rows[0]["id_verification"].ToString()); this.del = bool.Parse(ds.Tables[0].Rows[0]["del"].ToString()); this.guid = ds.Tables[0].Rows[0]["guid"].ToString(); if(ds.Tables[0].Rows[0]["verification_date"].ToString() != "") this.date = DateTime.Parse(ds.Tables[0].Rows[0]["verification_date"].ToString()); this.usr = new Photoland.Security.User.UserInfo(); this.usr.Id_user = int.Parse(ds.Tables[0].Rows[0]["verification_user"].ToString()); this.body = VerificationBody.getVerificationBodyByVerificationId(id); } } catch (Exception ex) { } }
public static List<Verification> getList() { List<Verification> lst = new List<Verification>(); try { VerificationProvider pr = new VerificationProvider(); DataSet ds = pr.GetList(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Verification o = new Verification(); o.id = int.Parse(ds.Tables[0].Rows[i]["id_verification"].ToString()); o.del = bool.Parse(ds.Tables[0].Rows[i]["del"].ToString()); o.guid = ds.Tables[0].Rows[i]["guid"].ToString(); if (ds.Tables[0].Rows[i]["verification_date"].ToString() != "") o.date = DateTime.Parse(ds.Tables[0].Rows[i]["verification_date"].ToString()); o.usr = new Photoland.Security.User.UserInfo(); o.usr.Id_user = int.Parse(ds.Tables[0].Rows[i]["verification_user"].ToString()); // не правильно, но старые объекты не стал переписывать :) пятница! UserProvider upr = new UserProvider(); o.usr.Name = upr.getNameById(o.usr.Id_user); lst.Add(o); } } catch (Exception ex) { } return lst; }