public static List <DoctorActivity> getMockedActivity() { List <DoctorActivity> activityList = new List <DoctorActivity>(); DoctorActivity d1 = new DoctorActivity(); d1.DoctorId = 1; d1.DoctorName = "Dr. Newells"; d1.PackageCount = 11; d1.PackageTypeDescription = "blah blah blah"; d1.PackageTypeId = 1; d1.TotalPackageValue = 145; DoctorActivity d2 = new DoctorActivity(); d2.DoctorId = 2; d2.DoctorName = "Dr. Mad"; d2.PackageCount = 13; d2.PackageTypeDescription = "blah blah "; d2.PackageTypeId = 4; d2.TotalPackageValue = 35; DoctorActivity d3 = new DoctorActivity(); d3.DoctorId = 3; d3.DoctorName = "Dr. Hell"; d3.PackageCount = 23; d3.PackageTypeDescription = "blah blah ..."; d3.PackageTypeId = 5; d3.TotalPackageValue = 245; activityList.Add(d1); activityList.Add(d2); activityList.Add(d3); return(activityList); }
/// <summary> /// Query for Doctor Activity Report /// </summary> /// <param name="connection"></param> /// <returns></returns> public static List <DoctorActivity> GetDoctorActivity(SqlConnection connection) { string query = "select DoctorId, DoctorName, PackageTypeId, PackageTypeDescription, PackageCount, TotalPackageValue " + "from DoctorActivity " + "order by DoctorId"; List <DoctorActivity> doctors = new List <DoctorActivity>(); var cmd = new SqlCommand(query); cmd.Connection = connection; using (SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default)) { while (reader.Read()) { var doctor = new DoctorActivity(); if (reader["DoctorId"] != DBNull.Value) { doctor.DoctorId = Convert.ToInt32(reader["DoctorId"]); } if (reader["DoctorName"] != DBNull.Value) { doctor.DoctorName = (string)reader["DoctorName"]; } if (reader["PackageTypeId"] != DBNull.Value) { doctor.PackageTypeId = Convert.ToInt32(reader["PackageTypeId"]); } if (reader["PackageTypeDescription"] != DBNull.Value) { doctor.PackageTypeDescription = (string)reader["PackageTypeDescription"]; } if (reader["PackageCount"] != DBNull.Value) { doctor.PackageCount = Convert.ToInt32(reader["PackageCount"]); } if (reader["TotalPackageValue"] != DBNull.Value) { doctor.TotalPackageValue = Convert.ToDecimal(reader["TotalPackageValue"]); } doctors.Add(doctor); } } return(doctors); }
public string DoctorActivityToString(DoctorActivity a) { return("E_Id:" + a.DoctorId + " / Name:" + a.DoctorName + " / T_Id:" + a.PackageTypeId + " / TypeDesc:" + a.PackageTypeDescription + " / Count:" + a.PackageCount + " / Value:" + a.TotalPackageValue); }