Exemplo n.º 1
0
    public static ForumUserCommentbyEst getoneForumCommentbyID(string forumcommentID)
    {
        ForumUserCommentbyEst fu = new ForumUserCommentbyEst();

        try
        {
            SqlCommand command = new SqlCommand("Select * from ForumUserCommentbyEst where forumcommentID=@forumcommentID");
            command.Parameters.AddWithValue("@forumcommentID", forumcommentID);
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                fu.forumcommentID = reader["forumcommentID"].ToString();
                AForumUser onef = AForumUserDB.getForumUserbyID(reader["forumID"].ToString());
                fu.forumID  = onef;
                fu.comments = reader["comments"].ToString();
                Establishment u = EstablishmentDB.getEstablishmentByID(reader["commentby"].ToString());
                fu.commentby = u;
                fu.date      = Convert.ToDateTime(reader["date"]);
                fu.status    = reader["status"].ToString();
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(fu);
    }
    public static List <EstablishmentBPRequest> getAllEstablishmentRequests()
    {
        List <EstablishmentBPRequest> establishmentRequests = new List <EstablishmentBPRequest>();

        try
        {
            SqlCommand command = new SqlCommand("Select * from BloodPlateletRequestEstab");
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                EstablishmentBPRequest r = new EstablishmentBPRequest();
                r.ID            = reader["bplEstabRequestID"].ToString();
                r.Establishment = EstablishmentDB.getEstablishmentByID(reader["establishmentID"].ToString());
                r.Units         = Convert.ToInt32(reader["unitsRequired"]);
                r.MatchedUnits  = Convert.ToInt32(reader["unitsMatched"]);
                r.BloodGroup    = reader["bloodGroup"].ToString();
                r.Type          = reader["bloodOrPlatelet"].ToString();
                r.Status        = reader["status"].ToString();
                r.RequestDate   = Convert.ToDateTime(reader["requestDate"]);
                establishmentRequests.Add(r);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(establishmentRequests);
    }
Exemplo n.º 3
0
    public static List <ForumEstablishment> getAllForumEstablishment()
    {
        List <ForumEstablishment> forumlists = new List <ForumEstablishment>();

        try
        {
            SqlCommand command = new SqlCommand("Select * from ForumEstablishment");
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                ForumEstablishment fu = new ForumEstablishment();
                fu.ForumID = reader["forumID"].ToString();
                fu.title   = reader["title"].ToString();
                fu.message = reader["message"].ToString();
                fu.date    = Convert.ToDateTime(reader["date"]);
                fu.status  = reader["status"].ToString();
                Establishment es = EstablishmentDB.getEstablishmentByID(reader["establishmentID"].ToString());
                fu.estID = es;
                forumlists.Add(fu);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(forumlists);
    }
Exemplo n.º 4
0
    public static ForumEstablishment getForumEstbyID(string id)
    {
        ForumEstablishment fu = new ForumEstablishment();

        try
        {
            SqlCommand command = new SqlCommand("Select * from ForumEstablishment where forumID=@forumID");
            command.Parameters.AddWithValue("@forumID", id);
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                fu.ForumID = reader["forumID"].ToString();
                fu.title   = reader["title"].ToString();
                fu.message = reader["message"].ToString();
                fu.date    = Convert.ToDateTime(reader["date"]);
                fu.status  = reader["status"].ToString();
                Establishment es = EstablishmentDB.getEstablishmentByID(reader["establishmentID"].ToString());
                fu.estID = es;
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(fu);
    }
Exemplo n.º 5
0
    public static BPMatchUserToEstab getBloodRequestsMatchbyID(string ID)
    {
        BPMatchUserToEstab m = new BPMatchUserToEstab();

        try
        {
            SqlCommand command = new SqlCommand("Select * from BPMatchUserToEstab where bpMatchUsrEstID=@UserID");
            command.Parameters.AddWithValue("@UserID", ID);
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                m.bpMatchUsrEstID = reader["bpMatchUsrEstID"].ToString();
                Establishment es = EstablishmentDB.getEstablishmentByID(reader["matchID"].ToString());
                m.matchID = es;
                BloodPlateletRequestUser u = BloodPlateletRequestUserDB.getUserBloodRequestsbyID(reader["bplUserRequestID"].ToString());
                m.bpRequestID = u;
                m.distance    = Convert.ToInt32(reader["distance"]);
                m.status      = reader["status"].ToString();
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(m);
    }
Exemplo n.º 6
0
    //get all blood and platelet match list from database
    public static List <BPMatchUserToEstab> getAllbpMatchUserToEsta()
    {
        List <BPMatchUserToEstab> matches = new List <BPMatchUserToEstab>();

        try
        {
            SqlCommand command = new SqlCommand("Select * from BPMatchUserToEstab");
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                BPMatchUserToEstab m = new BPMatchUserToEstab();
                m.bpMatchUsrEstID = reader["bpMatchUsrEstID"].ToString();
                Establishment es = EstablishmentDB.getEstablishmentByID(reader["matchID"].ToString());
                m.matchID = es;
                BloodPlateletRequestUser u = BloodPlateletRequestUserDB.getUserBloodRequestsbyID(reader["bplUserRequestID"].ToString());
                m.bpRequestID = u;
                m.distance    = Convert.ToInt32(reader["distance"]);
                m.status      = reader["status"].ToString();
                matches.Add(m);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(matches);
    }
Exemplo n.º 7
0
    public static List <OrganRecipient> getAllRecipients()
    {
        List <OrganRecipient> organRecipients = new List <OrganRecipient>();

        try
        {
            SqlCommand command = new SqlCommand("Select * from organReceiverWaiting");
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                OrganRecipient r = new OrganRecipient();
                r.ID            = reader["OrganWlID"].ToString();
                r.Establishment = EstablishmentDB.getEstablishmentByID(reader["establishmentID"].ToString());
                r.Bloodgroup    = reader["bloodGroup"].ToString();
                r.DOB           = Convert.ToDateTime(reader["DOB"]);
                r.Height        = Convert.ToInt32(reader["height"]);
                r.Weight        = Convert.ToInt32(reader["weight"]);
                r.Addedon       = Convert.ToDateTime(reader["addedOn"]);
                r.Organrequired = reader["organRequired"].ToString();
                r.Comments      = reader["comments"].ToString();
                r.Urgency       = Convert.ToInt32(reader["urgency"]);
                r.Refnumber     = reader["hospitalPatientNumber"].ToString();
                r.Status        = reader["status"].ToString();
                organRecipients.Add(r);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(organRecipients);
    }
Exemplo n.º 8
0
    public static List <ForumUserCommentbyEst> getAlloneForumAllComment()
    {
        List <ForumUserCommentbyEst> fulists = new List <ForumUserCommentbyEst>();

        try
        {
            SqlCommand command = new SqlCommand("Select * from ForumUserCommentbyEst");
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                ForumUserCommentbyEst fu = new ForumUserCommentbyEst();

                fu.forumcommentID = reader["forumcommentID"].ToString();
                AForumUser onef = AForumUserDB.getForumUserbyID(reader["forumID"].ToString());
                fu.forumID  = onef;
                fu.comments = reader["comments"].ToString();
                Establishment u = EstablishmentDB.getEstablishmentByID(reader["commentby"].ToString());
                fu.commentby = u;
                fu.date      = Convert.ToDateTime(reader["date"]);
                fu.status    = reader["status"].ToString();
                fulists.Add(fu);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(fulists);
    }
Exemplo n.º 9
0
    public static EstabEstabMatch getMatchByID(string id)
    {
        EstabEstabMatch m = new EstabEstabMatch();

        try
        {
            SqlCommand command = new SqlCommand("Select * from bpMatchEstabToEstab where bpMatchEstabID = @id");
            command.Parameters.AddWithValue("@id", id);
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                m.ID       = reader["bpMatchEstabID"].ToString();
                m.Request  = EstablishmentBPRequestDB.getRequestByID(reader["bplEstabRequestID"].ToString());
                m.Match    = EstablishmentDB.getEstablishmentByID(reader["matchID"].ToString());
                m.Status   = reader["status"].ToString();
                m.Distance = Convert.ToInt32(reader["distance"]);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(m);
    }
Exemplo n.º 10
0
    public static List <GReportBloodPlatelet> HgetAllBloodUToE()
    {
        List <GReportBloodPlatelet> utoelists = new List <GReportBloodPlatelet>();

        try
        {
            SqlCommand command = new SqlCommand("select bpr.bplUserRequestID , bpr.requestorID,bpr.bloodGroup,bpr.bloodOrPlatelet, bpr.unitsRequird,ue.matchID,tue.unitsPossible,bpr.requestDate,tue.status from BloodPlateletRequestUser bpr, BPMatchUserToEstab ue, BplTransactionUserToEstab tue where bpr.bplUserRequestID = ue.bplUserRequestID and ue.bpMatchUsrEstID = tue.bpMatchUsrEstID and tue.status='complete'");
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                GReportBloodPlatelet fu = new GReportBloodPlatelet();

                fu.ID = reader["bplUserRequestID"].ToString();
                Users u = UsersDB.getUserbyID(reader["requestorID"].ToString());
                fu.Requestor       = u.name;
                fu.BloodGroup      = reader["bloodGroup"].ToString();
                fu.BloodOrPlatelet = reader["bloodOrPlatelet"].ToString();
                fu.UnitRequire     = reader["unitsRequird"].ToString();
                Establishment es = EstablishmentDB.getEstablishmentByID(reader["matchID"].ToString());
                fu.Giver     = es.Name;
                fu.GivenUnit = reader["unitsPossible"].ToString();
                fu.Date      = Convert.ToDateTime(reader["requestDate"]);
                fu.Status    = reader["status"].ToString();
                utoelists.Add(fu);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(utoelists);
    }
Exemplo n.º 11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["establishment"] == null)
     {
         Server.Transfer("CommonLogin.aspx");
     }
     else
     {
         List <Chat> clist = ChatDB.getallChat();
         foreach (Chat ch in clist)
         {
             Users s = UsersDB.getUserbyID(ch.by);
             if (s.email == null)
             {
                 Establishment es = EstablishmentDB.getEstablishmentByID(ch.by);
                 if (ch.status == "allow")
                 {
                     tbxChat.Text += es.Name + " @ " + ch.time + " : " + ch.message + "\r\n";
                 }
             }
             else
             {
                 if (ch.status == "allow")
                 {
                     tbxChat.Text += s.username + " @ " + ch.time + " : " + ch.message + "\r\n";
                 }
             }
         }
     }
 }
Exemplo n.º 12
0
    public static DeceasedDonor getDonorByID(string id)
    {
        DeceasedDonor o = new DeceasedDonor();

        try
        {
            SqlCommand command = new SqlCommand("Select * from deceasedDonor where deceasedOrganID = @id");
            command.Parameters.AddWithValue("@id", id);
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                o.ID            = reader["deceasedOrganID"].ToString();
                o.Establishment = EstablishmentDB.getEstablishmentByID(reader["establishmentID"].ToString());
                o.Bloodgroup    = reader["bloodGroup"].ToString();
                o.DOB           = Convert.ToDateTime(reader["DOB"]);
                o.Donorheight   = Convert.ToInt32(reader["height"]);
                o.Donorweight   = Convert.ToInt32(reader["weight"]);
                o.Deathdate     = Convert.ToDateTime(reader["deathDate"]);
                o.Organtype     = reader["organType"].ToString();
                o.Comments      = reader["comments"].ToString();
                o.Refnumber     = reader["hospitalPatientNumber"].ToString();
                o.Status        = reader["status"].ToString();
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(o);
    }
Exemplo n.º 13
0
    public static List <ShowOrgan> getAllLOrganListByReceiver(string donor)
    {
        List <ShowOrgan> organlist = new List <ShowOrgan>();

        try
        {
            SqlCommand command = new SqlCommand("select ld.ldonorID,ld.userID,ld.organType,rw.establishmentID,rw.hospitalPatientNumber from liveDonor ld, organMatchingLive ml, organReceiverWaiting rw where ld.ldonorID = ml.ldonorID and ml.OrganWlID = rw.OrganWlID and rw.status = 'complete' and rw.establishmentID = @donor");
            command.Parameters.AddWithValue("@donor", donor);
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                ShowOrgan r = new ShowOrgan();
                r.DOID = reader["ldonorID"].ToString();
                Users es = UsersDB.getUserbyID(reader["ld.userID"].ToString());
                r.Donor     = es.name;
                r.OrganType = reader["organType"].ToString();
                Establishment es2 = EstablishmentDB.getEstablishmentByID(reader["rw.establishmentID"].ToString());
                r.Receiver       = es2.Name;
                r.hospitalRefNum = reader["hospitalPatientNumber"].ToString();
                organlist.Add(r);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(organlist);
    }
    public static List <BloodPlateletRequestUser> getAllUserBloodRequests()
    {
        List <BloodPlateletRequestUser> userrequests = new List <BloodPlateletRequestUser>();

        try
        {
            SqlCommand command = new SqlCommand("Select * from BloodPlateletRequestUser");
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                BloodPlateletRequestUser br = new BloodPlateletRequestUser();
                br.bplUserRequestID = reader["bplUserRequestID"].ToString();
                br.Units            = Convert.ToInt32(reader["unitsRequird"]);
                br.unitMatched      = Convert.ToInt32(reader["unitsMatched"]);
                Establishment est = EstablishmentDB.getEstablishmentByID(reader["establishmentID"].ToString());
                br.Establishment = est;
                Users u = UsersDB.getUserbyID(reader["requestorID"].ToString());
                br.requestorID     = u;
                br.Type            = reader["bloodGroup"].ToString();
                br.bloodOrPlatelet = reader["bloodOrPlatelet"].ToString();
                br.Status          = reader["status"].ToString();
                br.Time            = Convert.ToDateTime(reader["requestDate"]);
                userrequests.Add(br);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(userrequests);
    }
Exemplo n.º 15
0
    public static List <ShowOrgan> getAllDOrganListByReceiver(string donor)
    {
        List <ShowOrgan> organlist = new List <ShowOrgan>();

        try
        {
            SqlCommand command = new SqlCommand("select omd.deceasedOrganMatch,dd.establishmentID,dd.organType,rw.establishmentID,dd.hospitalPatientNumber from organMatchingDeceased omd, deceasedDonor dd, organReceiverWaiting rw where omd.deceasedOrganID = dd.deceasedOrganID and omd.OrganWlID = rw.OrganWlID and omd.status = 'complete' and rw.establishmentID = @donor");
            command.Parameters.AddWithValue("@donor", donor);
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                ShowOrgan r = new ShowOrgan();
                r.DOID = reader["deceasedOrganMatch"].ToString();
                Establishment es = EstablishmentDB.getEstablishmentByID(reader["dd.establishmentID"].ToString());
                r.Donor     = es.Name;
                r.OrganType = reader["organType"].ToString();
                Establishment es2 = EstablishmentDB.getEstablishmentByID(reader["rw.establishmentID"].ToString());
                r.Receiver       = es2.Name;
                r.hospitalRefNum = reader["hospitalPatientNumber"].ToString();
                organlist.Add(r);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(organlist);
    }
Exemplo n.º 16
0
 protected void BtnSentMessage_Click1(object sender, EventArgs e)
 {
     if (Session["echat"] != null)
     {
         string             eID = Session["echat"].ToString();
         Establishment      r   = EstablishmentDB.getEstablishmentByID(eID);
         Establishment      s   = (Establishment)Session["establishment"];
         IndividualChatRoom icr = new IndividualChatRoom(s.ID, r.ID, System.DateTime.Now, TextBox1.Text);
         IndividualChatRoomDB.insertIndChat(icr);
     }
     else if (Session["rwEst"] != null)
     {
         string             eID = Session["rwEst"].ToString();
         Establishment      r   = EstablishmentDB.getEstablishmentByID(eID);
         Establishment      s   = (Establishment)Session["establishment"];
         IndividualChatRoom icr = new IndividualChatRoom(s.ID, r.ID, System.DateTime.Now, TextBox1.Text);
         IndividualChatRoomDB.insertIndChat(icr);
     }
     else
     {
         Users              r   = UsersDB.getUserbyID(Session["ldID"].ToString());
         Establishment      s   = (Establishment)Session["establishment"];
         IndividualChatRoom icr = new IndividualChatRoom(s.ID, r.userId, System.DateTime.Now, TextBox1.Text);
         IndividualChatRoomDB.insertIndChat(icr);
     }
     TextBox1.Text = "";
     UpdatePanel1.Update();
 }
    public static EstablishmentBPRequest getRequestByID(string id)
    {
        EstablishmentBPRequest r = new EstablishmentBPRequest();

        try
        {
            SqlCommand command = new SqlCommand("Select * from bloodPlateletRequestEstab where bplEstabRequestID = @id");
            command.Parameters.AddWithValue("@id", id);
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                r.ID            = reader["bplEstabRequestID"].ToString();
                r.Units         = Convert.ToInt32(reader["unitsRequired"]);
                r.MatchedUnits  = Convert.ToInt32(reader["unitsMatched"]);
                r.Establishment = EstablishmentDB.getEstablishmentByID(reader["establishmentID"].ToString());
                r.BloodGroup    = reader["bloodGroup"].ToString();
                r.Type          = reader["bloodOrPlatelet"].ToString();
                r.Status        = reader["status"].ToString();
                r.RequestDate   = Convert.ToDateTime(reader["requestDate"]);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(r);
    }
Exemplo n.º 18
0
    public static List <EstabEstabMatch> getAllMatches()
    {
        List <EstabEstabMatch> matches = new List <EstabEstabMatch>();

        try
        {
            SqlCommand command = new SqlCommand("Select * from BPMatchEstabToEstab");
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                EstabEstabMatch m = new EstabEstabMatch();
                m.ID       = reader["bpMatchEstabID"].ToString();
                m.Request  = EstablishmentBPRequestDB.getRequestByID(reader["bplEstabRequestID"].ToString());
                m.Match    = EstablishmentDB.getEstablishmentByID(reader["matchID"].ToString());
                m.Status   = reader["status"].ToString();
                m.Distance = Convert.ToInt32(reader["distance"]);
                matches.Add(m);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(matches);
    }
Exemplo n.º 19
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        Establishment es = EstablishmentDB.getEstablishmentByID(Session["est"].ToString());

        Session["echat"] = es.ID;
        Session["rwEst"] = null;
        Session["ldID"]  = null;
        Server.Transfer("IndividualChatE.aspx");
    }
Exemplo n.º 20
0
 protected void BtnSentMessage_Click1(object sender, EventArgs e)
 {
     if (Session["chat"] != null)
     {
         Users s = UsersDB.getUserbyEmail(Session["email"].ToString());
         Users r = UsersDB.getUserbyUsername(lblName.Text);
         IndividualChatRoom icr = new IndividualChatRoom(s.UserId, r.UserId, System.DateTime.Now, TextBox1.Text);
         IndividualChatRoomDB.insertIndChat(icr);
     }
     else
     {
         string             eID = Session["echat"].ToString();
         Users              s   = UsersDB.getUserbyEmail(Session["email"].ToString());
         Establishment      r   = EstablishmentDB.getEstablishmentByID(eID);
         IndividualChatRoom icr = new IndividualChatRoom(s.UserId, r.ID, System.DateTime.Now, TextBox1.Text);
         IndividualChatRoomDB.insertIndChat(icr);
     }
     TextBox1.Text = "";
     UpdatePanel1.Update();
 }
Exemplo n.º 21
0
    public static List <GReportBloodPlatelet> getAllBloodUToUWTime(string ID)
    {
        List <GReportBloodPlatelet> utoelists = new List <GReportBloodPlatelet>();

        try
        {
            SqlCommand command = new SqlCommand("select bpr.bplUserRequestID , bpr.requestorID,bpr.bloodGroup,bpr.bloodOrPlatelet, bpr.unitsRequird,uu.matchID,bpr.requestDate,bpr.establishmentID, tuu.status from BloodPlateletRequestUser bpr, BPMatchUserToUser uu, BplTransactionUserToUser tuu where bpr.bplUserRequestID = uu.bplUserRequestID and uu.bpMatchUsrUsr = tuu.bpMatchUsrUsr and bpr.establishmentID=@ID and tuu.status='complete'");
            command.Parameters.AddWithValue("@ID", ID);
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                GReportBloodPlatelet fu = new GReportBloodPlatelet();

                fu.ID = reader["bplUserRequestID"].ToString();
                Users u = UsersDB.getUserbyID(reader["requestorID"].ToString());
                fu.Requestor       = u.name;
                fu.BloodGroup      = reader["bloodGroup"].ToString();
                fu.BloodOrPlatelet = reader["bloodOrPlatelet"].ToString();
                fu.UnitRequire     = reader["unitsRequird"].ToString();
                Users u2 = UsersDB.getUserbyID(reader["matchID"].ToString());
                fu.Giver     = u2.Name;
                fu.GivenUnit = "1";
                fu.Date      = Convert.ToDateTime(reader["requestDate"]);
                Establishment es = EstablishmentDB.getEstablishmentByID(reader["establishmentID"].ToString());
                fu.Status = es.Name;
                utoelists.Add(fu);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(utoelists);
    }
Exemplo n.º 22
0
    public static List <GReportBloodPlatelet> getAllBloodEToE(DateTime from, DateTime to)
    {
        List <GReportBloodPlatelet> utoelists = new List <GReportBloodPlatelet>();

        try
        {
            SqlCommand command = new SqlCommand("select bpr.bplEstabRequestID , bpr.establishmentID,bpr.bloodGroup,bpr.bloodOrPlatelet, bpr.unitsRequired,uu.matchID,tuu.unitsPossible,bpr.requestDate,tuu.status from BloodPlateletRequestEstab bpr, BPMatchEstabToEstab uu, BplTransactionEstabToEstab tuu where bpr.bplEstabRequestID = uu.bplEstabRequestID and uu.bpMatchEstabID = tuu.bpMatchEstabID and requestDate between @from AND @to");
            command.Parameters.AddWithValue("@from", from);
            command.Parameters.AddWithValue("@to", to);
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                GReportBloodPlatelet fu = new GReportBloodPlatelet();

                fu.ID = reader["bplEstabRequestID"].ToString();
                Establishment es = EstablishmentDB.getEstablishmentByID(reader["establishmentID"].ToString());
                fu.Requestor       = es.Name;
                fu.BloodGroup      = reader["bloodGroup"].ToString();
                fu.BloodOrPlatelet = reader["bloodOrPlatelet"].ToString();
                fu.UnitRequire     = reader["unitsRequired"].ToString();
                Establishment es2 = EstablishmentDB.getEstablishmentByID(reader["matchID"].ToString());
                fu.Giver     = es2.Name;
                fu.GivenUnit = reader["unitsPossible"].ToString();
                fu.Date      = Convert.ToDateTime(reader["requestDate"]);
                fu.Status    = reader["status"].ToString();
                utoelists.Add(fu);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(utoelists);
    }
Exemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["chat"] == null)
        {
            string        eID = Session["echat"].ToString();
            Establishment r   = EstablishmentDB.getEstablishmentByID(eID);
            lblName.Text = r.Name;
            Users s = UsersDB.getUserbyEmail(Session["email"].ToString());
            tbxChat.Text = "";
            List <IndividualChatRoom> iuu = IndividualChatRoomDB.getAllChatby2ID(r.ID, s.UserId);
            tbxChat.Style["text-align"] = "left";
            if (iuu.Count > 0)
            {
                foreach (IndividualChatRoom i in iuu)
                {
                    if (i.Sender == s.UserId)
                    {
                        tbxChat.Text += s.username + " : " + i.Messages + "\r\n";
                    }
                    else
                    {
                        tbxChat.Text += r.Name + " : " + i.Messages + "\r\n";
                    }
                }
            }
            else
            {
                tbxChat.Text = "You can start the chat now";
                tbxChat.Style["text-align"] = "center";
            }
        }

        else
        {
            uUsername = Session["chat"].ToString();
            Users r = UsersDB.getUserbyID(uUsername);
            lblName.Text = r.username;
            Users s = UsersDB.getUserbyEmail(Session["email"].ToString());
            tbxChat.Text = "";
            List <IndividualChatRoom> iuu = IndividualChatRoomDB.getAllChatby2ID(r.UserId, s.UserId);
            tbxChat.Style["text-align"] = "left";
            if (iuu.Count > 0)
            {
                foreach (IndividualChatRoom i in iuu)
                {
                    if (i.Sender == s.userId)
                    {
                        tbxChat.Text += s.username + " : " + i.Messages + "\r\n";
                    }
                    else
                    {
                        tbxChat.Text += r.username + " : " + i.Messages + "\r\n";
                    }
                }
            }
            else
            {
                tbxChat.Text = "You can start the chat now";
                tbxChat.Style["text-align"] = "center";
            }
        }
    }
Exemplo n.º 24
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["echat"] != null)
     {
         string        eID = Session["echat"].ToString();
         Establishment r   = EstablishmentDB.getEstablishmentByID(eID);
         lblName.Text = r.Name;
         Establishment s = (Establishment)Session["establishment"];
         tbxChat.Text = "";
         List <IndividualChatRoom> iuu = IndividualChatRoomDB.getAllChatby2ID(s.ID, r.ID);
         tbxChat.Style["text-align"] = "left";
         if (iuu.Count > 0)
         {
             foreach (IndividualChatRoom i in iuu)
             {
                 if (i.Sender == s.ID)
                 {
                     tbxChat.Text += s.Name + " : " + i.Messages + "\r\n";
                 }
                 else
                 {
                     tbxChat.Text += r.Name + " : " + i.Messages + "\r\n";
                 }
             }
         }
         else
         {
             tbxChat.Text = "You can start the chat now";
             tbxChat.Style["text-align"] = "center";
         }
     }
     else if (Session["rwEst"] != null)
     {
         string        eID = Session["rwEst"].ToString();
         Establishment re  = EstablishmentDB.getEstablishmentByID(eID);
         lblName.Text = re.Name;
         Establishment s = (Establishment)Session["establishment"];
         tbxChat.Text = "";
         List <IndividualChatRoom> iuu = IndividualChatRoomDB.getAllChatby2ID(s.ID, re.ID);
         tbxChat.Style["text-align"] = "left";
         if (iuu.Count > 0)
         {
             foreach (IndividualChatRoom i in iuu)
             {
                 if (i.Sender == s.ID)
                 {
                     tbxChat.Text += s.Name + " : " + i.Messages + "\r\n";
                 }
                 else
                 {
                     tbxChat.Text += re.Name + " : " + i.Messages + "\r\n";
                 }
             }
         }
         else
         {
             tbxChat.Text = "You can start the chat now";
             tbxChat.Style["text-align"] = "center";
         }
     }
     else if (Session["ldID"] != null)
     {
         Users r = UsersDB.getUserbyID(Session["ldID"].ToString());
         lblName.Text = r.Name;
         Establishment s = (Establishment)Session["establishment"];
         tbxChat.Text = "";
         List <IndividualChatRoom> iuu = IndividualChatRoomDB.getAllChatby2ID(s.ID, r.UserId);
         tbxChat.Style["text-align"] = "left";
         if (iuu.Count > 0)
         {
             foreach (IndividualChatRoom i in iuu)
             {
                 if (i.Sender == s.ID)
                 {
                     tbxChat.Text += s.Name + " : " + i.Messages + "\r\n";
                 }
                 else
                 {
                     tbxChat.Text += r.Name + " : " + i.Messages + "\r\n";
                 }
             }
         }
         else
         {
             tbxChat.Text = "You can start the chat now";
             tbxChat.Style["text-align"] = "center";
         }
     }
 }
Exemplo n.º 25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["establishment"] == null)
        {
            Server.Transfer("Login.aspx");
        }
        else
        {
            tbxChat.Text = "";
            List <Chat> clist = ChatDB.getallChat();
            foreach (Chat ch in clist)
            {
                Users s = UsersDB.getUserbyID(ch.by);
                if (s.email == null)
                {
                    Establishment es = EstablishmentDB.getEstablishmentByID(ch.by);
                    if (ch.status == "allow")
                    {
                        tbxChat.Text += es.Name + " @ " + ch.time + " : " + ch.message + "\r\n";
                    }
                }
                else
                {
                    if (ch.status == "allow")
                    {
                        tbxChat.Text += s.username + " @ " + ch.time + " : " + ch.message + "\r\n";
                    }
                }
            }
            cnum = clist.Count;


            currente           = (Establishment)(Session["establishment"]);
            lblOutputPost.Text = "";
            List <ForumUser> flist = ForumUserDB.getAllForumUserbyStatus();

            if (flist.Count == 0)
            {
                Panel1.Visible   = false;
                lblGVOutput.Text = "There is no forum posted by user right now!";
            }
            else
            {
                Panel1.Visible    = true;
                gvUser.DataSource = flist;
                gvUser.DataBind();
                lblGVOutput.Text = "";
            }

            List <ForumEstablishment> elist = ForumEstablishmentDB.getAllForumEstbyStatus();

            if (elist.Count == 0)
            {
                Panel2.Visible      = false;
                lblGVEstOutput.Text = "There is no forum posted by establishment right now!";
            }
            else
            {
                lblGVEstOutput.Text = "";
                Panel2.Visible      = true;
                gvEst.DataSource    = elist;
                gvEst.DataBind();
            }
        }
    }