public List <ServiceTokenInfo> GenerateServiceToken(string ServiceID, string PatientID, string UserID) { ServiceTokenInfo ci = new ServiceTokenInfo(); List <ServiceTokenInfo> ServiceTokenInformation = new List <ServiceTokenInfo>(); DataSet ds; using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connstr"].ToString())) { using (SqlCommand cmd = new SqlCommand("SP_ServiceTokenGenerate", con)) { con.Open(); cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ServiceId", SqlDbType.Int).Value = Convert.ToInt32(ServiceID); cmd.Parameters.Add("@PatientId", SqlDbType.Int).Value = Convert.ToInt32(PatientID); cmd.Parameters.Add("@empId", SqlDbType.Int).Value = Convert.ToInt32(UserID); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { ds = new DataSet(); da.Fill(ds); } } } try { if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { ServiceTokenInformation.Add(new ServiceTokenInfo() { ServiceName = dr["ServiceName"].ToString(), ServiceTokenID = Convert.ToInt32(dr["ServiceTokenID"]), QueueNo = Convert.ToInt32(dr["ServiceTokenQueueNo"]), BayArea = dr["BayAreasAlloted"].ToString(), Rooms = dr["RoomNosAlloted"].ToString(), ExpectedWaitingTime = dr["ExpectedWaitingTime"].ToString() + " min" }); } } } } } catch (Exception ex) { throw ex; } return(ServiceTokenInformation); }
public List <ServiceTokenInfo> LoadServiceTokenWithID(string TokenOrQNo, string ServiceID) { ServiceTokenInfo ci = new ServiceTokenInfo(); List <ServiceTokenInfo> ServiceTokenInformation = new List <ServiceTokenInfo>(); DataSet ds; using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connstr"].ToString())) { using (SqlCommand cmd = new SqlCommand("SP_ServiceTokenGetDetails", con)) { con.Open(); cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ServiceId", SqlDbType.Int).Value = Convert.ToInt32(ServiceID); cmd.Parameters.Add("@TokenOrQNo", SqlDbType.Int).Value = Convert.ToInt32(TokenOrQNo); cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = DateTime.Now.ToString(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { ds = new DataSet(); da.Fill(ds); } } } try { if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { ServiceTokenInformation.Add(new ServiceTokenInfo() { ServiceName = dr["ServiceName"].ToString(), ServiceTokenID = Convert.ToInt32(dr["ServiceTokenID"]), QueueNo = Convert.ToInt32(dr["ServiceTokenQueueNo"]), BayArea = dr["BayArea"].ToString(), Rooms = dr["RoomNo"].ToString(), ExpectedWaitingTime = dr["ExpectedWaitingTime"].ToString() + " min", CurrentStatus = dr["StatusText"].ToString(), UserName = dr["PatientName"].ToString(), gender = dr["Gender"].ToString(), age = dr["Age"].ToString(), address = dr["Address"].ToString() //mobile = "10 min" }); } } else { ServiceTokenInformation.Add(new ServiceTokenInfo() { ServiceTokenID = 0 }); } } } } catch (Exception ex) { throw ex; } return(ServiceTokenInformation); }