public static KetQua Update(KetQua item) { var Item = new KetQua(); var obj = new SqlParameter[15]; obj[0] = new SqlParameter("KQ_ID", item.ID); obj[1] = new SqlParameter("KQ_DV_ID", item.DV_ID); obj[2] = new SqlParameter("KQ_TT_ID", item.TT_ID); obj[3] = new SqlParameter("KQ_DM_ID", item.DM_ID); obj[4] = new SqlParameter("KQ_KH_ID", item.KH_ID); obj[5] = new SqlParameter("KQ_Ten", item.Ten); obj[6] = new SqlParameter("KQ_MoTa", item.MoTa); obj[7] = new SqlParameter("KQ_Anh", item.Anh); obj[8] = new SqlParameter("KQ_NoiDung", item.NoiDung); if (item.NgayTao > DateTime.MinValue) { obj[9] = new SqlParameter("KQ_NgayTao", item.NgayTao); } else { obj[9] = new SqlParameter("KQ_NgayTao", DBNull.Value); } if (item.NgayCapNhat > DateTime.MinValue) { obj[10] = new SqlParameter("KQ_NgayCapNhat", item.NgayCapNhat); } else { obj[10] = new SqlParameter("KQ_NgayCapNhat", DBNull.Value); } obj[11] = new SqlParameter("KQ_NguoiTao", item.NguoiTao); obj[12] = new SqlParameter("KQ_NguoiCapNhat", item.NguoiCapNhat); obj[13] = new SqlParameter("KQ_ThuTu", item.ThuTu); obj[14] = new SqlParameter("KQ_Active", item.Active); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblSpaMgr_KetQua_Update_UpdateNormal_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
public static KetQua getFromReader(IDataReader rd) { var Item = new KetQua(); if (rd.FieldExists("KQ_ID")) { Item.ID = (Guid)(rd["KQ_ID"]); } if (rd.FieldExists("KQ_DV_ID")) { Item.DV_ID = (Guid)(rd["KQ_DV_ID"]); } if (rd.FieldExists("KQ_TT_ID")) { Item.TT_ID = (Guid)(rd["KQ_TT_ID"]); } if (rd.FieldExists("KQ_DM_ID")) { Item.DM_ID = (Guid)(rd["KQ_DM_ID"]); } if (rd.FieldExists("KQ_KH_ID")) { Item.KH_ID = (Guid)(rd["KQ_KH_ID"]); } if (rd.FieldExists("KQ_Ten")) { Item.Ten = (String)(rd["KQ_Ten"]); } if (rd.FieldExists("KQ_MoTa")) { Item.MoTa = (String)(rd["KQ_MoTa"]); } if (rd.FieldExists("KQ_Anh")) { Item.Anh = (String)(rd["KQ_Anh"]); } if (rd.FieldExists("KQ_NoiDung")) { Item.NoiDung = (String)(rd["KQ_NoiDung"]); } if (rd.FieldExists("KQ_NgayTao")) { Item.NgayTao = (DateTime)(rd["KQ_NgayTao"]); } if (rd.FieldExists("KQ_NgayCapNhat")) { Item.NgayCapNhat = (DateTime)(rd["KQ_NgayCapNhat"]); } if (rd.FieldExists("KQ_NguoiTao")) { Item.NguoiTao = (String)(rd["KQ_NguoiTao"]); } if (rd.FieldExists("KQ_NguoiCapNhat")) { Item.NguoiCapNhat = (String)(rd["KQ_NguoiCapNhat"]); } if (rd.FieldExists("KQ_ThuTu")) { Item.ThuTu = (Int32)(rd["KQ_ThuTu"]); } if (rd.FieldExists("KQ_Active")) { Item.Active = (Boolean)(rd["KQ_Active"]); } if (rd.FieldExists("TT_Ten")) { Item.TT_Ten = (String)(rd["TT_Ten"]); } if (rd.FieldExists("KH_Ten")) { Item.KH_Ten = (String)(rd["KH_Ten"]); } return(Item); }