public void ChangeDonorStatus(Donors donor) { var updatedDonor = context.Donors.First(d => d.DonorId == donor.DonorId); updatedDonor.Status = "Available"; context.SaveChanges(); }
public void DonorInteractions(Donors donor) { Console.WriteLine($"Congratulations! {donor.Status} accepted your generous gesture and you donated your blood to him."); Console.WriteLine("Do you wish to enroll to donate blood again or leave the blood donation program?"); Console.WriteLine("1. I wish to enroll again."); Console.WriteLine("2. I want to leave the program."); int command = 0; do { if (!int.TryParse(Console.ReadLine(), out command)) { throw new FormatException("Value must be an integer."); } } while (command != 1 && command != 2); if (command == 1) { donorsDAO.ChangeDonorStatus(donor); Console.WriteLine("You've successfully enrolled in the program again. "); Console.WriteLine("Press any key to return to the main menu."); Console.ReadKey(); } else { donorsDAO.DeleteDonor(donor); Console.WriteLine("You've successfully unenrolled from the program. You may return back at any time."); Console.WriteLine("Press any key to return to the main menu."); Console.ReadKey(); } }
public List <Donors> getDonorListByEmail(string email) { email += "%"; string query = "SELECT * FROM donors WHERE Email LIKE '" + email + "'"; MySqlDataReader reader = DataAccess.GetData(query); //reader.Read(); Donors donors = null; List <Donors> donorsList = new List <Donors>(); while (reader.Read()) { donors = new Donors(); donors.Id = Convert.ToInt32(reader["ID"].ToString()); donors.Name = reader["Name"].ToString(); donors.Address = reader["Address"].ToString(); donors.Age = Convert.ToInt32(reader["Age"].ToString()); donors.Phone = reader["Phone"].ToString(); donors.Email = reader["Email"].ToString(); donors.Gender = reader["Gender"].ToString(); donors.Weight = Convert.ToInt32(reader["Weight"].ToString()); donors.BloodGroup = reader["Blood_Group"].ToString(); donors.Status = reader["Status"].ToString(); donors.Date = reader["Date"].ToString(); donorsList.Add(donors); } return(donorsList); }
private void Button1_Click(object sender, EventArgs e) { try { int donorId = int.Parse(textBox1.Text.ToString()); Donors k = new Donors(); int result = k.DeleteDonor(donorId); if (result > 0) { label2.Text = "Donor deleted"; } else { label2.Text = "Donor Not deleted"; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
static void Stat(Client player, string[] cmd, int iarg) { if (cmd.Length == 1) { Chat.TellStatTo(player, player.Settings, player); player.TellSystem(Chat.Yellow + " ", Chat.Gold + Donors.Status(player.MinecraftUsername)); } for (int n = 1; n < cmd.Length; n++) { ClientSettings s = null; Client p = PlayerList.GetPlayerByName(cmd [n]); if (p != null) { s = p.Settings; } if (s == null || s.Cloaked != null) { s = Client.LoadProxyPlayer(cmd [n]); p = null; } if (s == null) { player.TellSystem(Chat.Red, cmd [n] + " is not found"); } else { Chat.TellStatTo(p, s, player); BadPlayer b = Banned.GetBanHistory(cmd [n]); if (b != null) { player.TellSystem(Chat.Yellow + cmd [n] + " ", Chat.Red + b.ToString()); } } } }
private void Button3_Click(object sender, EventArgs e) { try { int donorId = int.Parse(textBox1.Text.ToString()); Donors s = new Donors(); s = s.SearchDonorByID(donorId); textBox1.Text = s.DonorId.ToString(); textBox2.Text = s.NationalmedNumber.ToString(); textBox3.Text = s.TelephoneNumber.ToString(); textBox4.Text = s.BloodType; textBox5.Text = s.AdressId.ToString(); textBox6.Text = s.BloodBankId.ToString(); textBox7.Text = s.Gender; textBox8.Text = s.BirthDate; textBox9.Text = s.Name; textBox10.Text = s.Email; textBox11.Text = s.Password; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public DonationContext() { Database.EnsureCreated(); if (!Donors.Any() && !Donations.Any()) { using (StreamReader rd = new StreamReader("source7.csv")) { while (!rd.EndOfStream) { var line = rd.ReadLine(); var values = line.Split(','); Donor temp = new Donor { FirstName = values[0], LastName = values[1], Pesel = values[2], //Gender =(Gender)Convert.ToInt32(values[3]), BloodGroup = (BloodGroup)Convert.ToInt32(values[4]), Rh = (BloodRhFactor)Convert.ToInt32(values[5]) }; //AddDonor(temp); AddDonation(new Donation { Donor = temp, Amount = Convert.ToInt32(values[7]), DonationType = (DonationType)Convert.ToInt32(values[6]), Date = DateTime.ParseExact(values[8], "M/d/yyyy", null) }); } } } }
public List <Donors> getDonorListByDate(string firstDate, string secondDate) { string query = string.Format("SELECT * FROM donors WHERE (date BETWEEN '{0}' AND '{1}')", firstDate, secondDate); MySqlDataReader reader = DataAccess.GetData(query); //reader.Read(); Donors donors = null; List <Donors> donorsList = new List <Donors>(); while (reader.Read()) { donors = new Donors(); donors.Id = Convert.ToInt32(reader["ID"].ToString()); donors.Name = reader["Name"].ToString(); donors.Address = reader["Address"].ToString(); donors.Age = Convert.ToInt32(reader["Age"].ToString()); donors.Phone = reader["Phone"].ToString(); donors.Email = reader["Email"].ToString(); donors.Gender = reader["Gender"].ToString(); donors.Weight = Convert.ToInt32(reader["Weight"].ToString()); donors.BloodGroup = reader["Blood_Group"].ToString(); donors.Status = reader["Status"].ToString(); donors.Date = reader["Date"].ToString(); donorsList.Add(donors); } return(donorsList); }
public void DeleteDonor(Donors donor) { var donorToDelete = context.Donors.First(d => d.DonorId == donor.DonorId); context.Donors.Remove(donorToDelete); context.SaveChanges(); }
protected void btnSubmitPickupRequest_Click(object sender, EventArgs e) { int output; BLL objBLL = new BLL(); Donation objDonation = new Donation(); objDonation.DonorId = Globals.signedInDonor.Id; objDonation.Category = donationType.Value; objDonation.PickupAddress = pickupAddress.Value; objDonation.PickupDate = Convert.ToDateTime(inputPickupDate.Value); objDonation.Recipient = Convert.ToInt32(selectCharity.Value); objDonation.Status = "Awaiting Pickup"; output = objBLL.RequestPickupBLL(objDonation); if (output > 0) { Donors objDonor = objBLL.FindDonor(objDonation.DonorId); Charities objCharity = objBLL.FindCharity(objDonation.Recipient); objBLL.send(objDonation, objDonor, objCharity); objBLL.send(objDonation, objCharity, objDonor); ClientScript.RegisterStartupScript(this.GetType(), "alertwindow", "alert('Pickup Request Submitted'); window.location.href = 'RequestPickup.aspx';", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "alertwindow", "alert('Pickup Request Failed'); window.location.href = 'RequestPickup.aspx';", true); } }
public void ShowPotentialDonors(Patients patient, int numberOfDonors) { List <Donors> potentialDonors = patientsDAO.FindCompatibleDonors(patient); potentialDonors = potentialDonors.OrderBy(d => d.BloodGroup).Take(numberOfDonors).ToList(); Console.WriteLine($"Here are all the donors compatible with your blood group {patient.BloodGroup} and their phone numbers."); for (int i = 0; i < potentialDonors.Count; i++) { Console.WriteLine($"{i + 1}. {potentialDonors[i].Name} {potentialDonors[i].PhoneNumber}"); } Console.WriteLine(); Console.Write("Pick the number of donor you want blood from: "); int donorIndex = 0; do { donorIndex = int.Parse(Console.ReadLine()); } while (donorIndex <= 0 && donorIndex > numberOfDonors); Donors donatingDonor = potentialDonors[donorIndex - 1]; donorsDAO.TransfuseBlood(donatingDonor, patient); Console.WriteLine($"You successfully received blood from {donatingDonor.Name}. You can call him to thank."); Console.WriteLine($"We hope your {patient.Diagnose} will be cured. Your account will be deleted now."); Console.WriteLine("If you receive blood again you can register at any time."); patientsDAO.DeletePatient(patient); Console.WriteLine("Press any key to return to the main menu."); }
public void TransfuseBlood(Donors donatingDonor, Patients receivingPatient) { var updatedDonor = context.Donors.First(d => d.DonorId == donatingDonor.DonorId); updatedDonor.Status = $"{receivingPatient.Name}"; context.SaveChanges(); }
private void Button1_Click(object sender, EventArgs e) { try { Donors s = new Donors(); s.DonorId = donorId; s.NationalmedNumber = int.Parse(textBox2.Text.ToString()); s.TelephoneNumber = int.Parse(textBox3.Text.ToString()); s.BloodType = textBox4.Text.Trim(); s.AdressId = int.Parse(textBox5.Text.ToString()); s.BloodBankId = int.Parse(textBox6.Text.ToString()); s.Gender = textBox7.Text.Trim(); s.BirthDate = textBox8.Text.Trim(); s.Name = textBox9.Text.Trim(); s.Email = textBox10.Text.Trim(); s.Password = textBox11.Text.Trim(); int result = s.UpdateDonor(s); if (result > 0) { if (home != null) { home.BindGridView(); } MessageBox.Show("Update successsfully."); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
async void Handle_Clicked(object sender, System.EventArgs e) { if (await CrossConnectivity.Current.IsRemoteReachable("http://www.google.com")) { var Donor = new Donors(); Donor.Group = Group.SelectedItem as string; Donor.Name = Name.Text; Donor.MobileNumber = Mobile.Text; if (place != null) { Donor.Latitude = place.Coordinates.Latitude; Donor.Longitude = place.Coordinates.Longitude; } if (string.IsNullOrWhiteSpace(Donor.Group)) { await DisplayAlert("Error", "Group not mentioned", "OK"); } var res = await BasicServices.AddBloodAsync(Donor); if (res.data) { await DisplayAlert("Success", res.Message, "OK"); } else { await DisplayAlert("Error", res.Message, "OK"); } } else { await DisplayAlert("Error", "No Internet", "OK"); } }
public Donors GetByName(string name) { name += "%"; string query = "SELECT * FROM donors WHERE Name LIKE '" + name + "'"; MySqlDataReader reader = DataAccess.GetData(query); reader.Read(); Donors donors = null; if (reader.HasRows) { donors = new Donors(); donors.Id = Convert.ToInt32(reader["ID"]); donors.Name = reader["Name"].ToString(); donors.Address = reader["Address"].ToString(); donors.Age = Convert.ToInt32(reader["Age"]); donors.Phone = reader["Phone"].ToString(); donors.Email = reader["Email"].ToString(); donors.Gender = reader["Gender"].ToString(); donors.Weight = Convert.ToInt32(reader["Weight"]); donors.BloodGroup = reader["Blood_Group"].ToString(); } return(donors); }
private void DonorRegister_Click(object sender, EventArgs e) { DonorsService donorsService = new DonorsService(); Donors donors = new Donors(); donors.Name = DonorName.Text; donors.Address = DonorAddress.Text; donors.Age = Convert.ToInt32(DonorAge.Text); donors.Gender = (string)DonorGender.SelectedItem; donors.Phone = DonorPhone.Text; donors.Email = DonorEmail.Text; donors.BloodGroup = (string)DonorBloodGroup.SelectedItem; donors.Weight = Convert.ToInt32(DonorWeight.Text); if (donorsService.SendDonorEmail(donors.Email)) { if (donorsService.Add(donors) > 0) { MessageBox.Show("Record Added!"); } } else { MessageBox.Show("Error!"); } }
public void DonorRegister(Donors donor) { context.Donors.Add(donor); context.SaveChanges(); Console.WriteLine("Register successful! Redirecting..."); DonorLogin(donor.Email, donor.Password); }
public bool Register(DonorRegisterViewModel model) { bool result = false; if (model != null) { var repo = unitOfWork.GetRepository <Donors>(); var donor = new Donors { Email = model.Email, Password = model.Password, Age = model.Age, City = model.City, Country = model.Country, FirstName = model.FirstName, LastName = model.LastName, MiddleName = model.MiddleName, Phone = model.Phone, Pincode = model.Pincode, State = model.State }; repo.Insert(donor); unitOfWork.Save(); result = true; } return(result); }
public int Edit(Donors donors) { string query = "UPDATE donors SET Name = '" + donors.Name + "', Address = '" + donors.Address + "', Age = '" + donors.Age + "', Gender = '" + donors.Gender + "', Phone = '" + donors.Phone + "', Blood_Group = '" + donors.BloodGroup + "', Weight = '" + donors.Weight + "' WHERE ID = " + donors.Id; //string query = "UPADATE donors SET Name='" + donors.Name + "' Age= '" + donors.Age + "' Address= '" + donors.Address + "' Phone= '" + donors.Phone + "' Email= '" + donors.Email + "' Gender= '" + donors.Gender + "' Weight= '" + donors.Weight + "' Blood_Group= '" + donors.BloodGroup + "' WHERE id=" + id; return(DataAccess.ExecuteQuery(query)); }
public Donors FindDonor(int donorId) { Donors objDonor = new Donors(); DAL objDAL = new DAL(); objDonor = objDAL.FindDonor(donorId); return(objDonor); }
public int DonorSignUpBLL(Donors objDonor) { int output; DAL objDAL = new DAL(); output = objDAL.DonorSignUpDAL(objDonor); return(output); }
public async Task <Donors> AddDonor(Donors donor) { var result = await bloodDonorAPIContext.Donors.AddAsync(donor); await bloodDonorAPIContext.SaveChangesAsync(); return(result.Entity); }
public Donors FindDonor(string email, string password) { Donors objDonor = new Donors(); DAL objDAL = new DAL(); objDonor = objDAL.FindDonor(email, password); return(objDonor); }
public Boolean PostDonor(Donors Donor) { _Connection.Sheet = "Donors"; var range = $"{_Connection.Sheet}!A:E"; var valueRange = new ValueRange(); var oblist = new List <object>() { Donor.ID, Donor.FullName, Donor.FirstName, Donor.LastName, Donor.ConnectionID, Donor.Gender, Donor.AgeGroup, Donor.Email, Donor.PhoneNumber, Donor.Country, Donor.City, Donor.NativeLanguage, Donor.TotalDonation, Donor.LastDonation, Donor.VIP, Donor.AnashIsrael, Donor.AnashUSA, Donor.PinskSchoolGraduate, Donor.KievSchoolGraduate, Donor.YeshivaGraduate, Donor.InPinsk, Donor.BusinessAssociate, Donor.BoysCounselor, Donor.GirlsCounselor, Donor.HelpedByPinsk, Donor.GeneralSupporter, Donor.MHSG, Donor.BelarusAnsectors, Donor.BelarusTourism, Donor.YYFundraiser, Donor.YYFamily, Donor.YYStaff, Donor.RShteiermanFamily, Donor.RFimaFamily, Donor.MarriedAYYGraduate, Donor.YearsInYadYisroel, Donor.Other }; valueRange.Values = new List <IList <object> > { oblist }; var appendRequest = _Connection.Service.Spreadsheets.Values.Append(valueRange, _Connection.SpreadsheetId, range); appendRequest.ValueInputOption = SpreadsheetsResource.ValuesResource.AppendRequest.ValueInputOptionEnum.USERENTERED; var appendReponse = appendRequest.Execute(); return(true); }
public void BindGridView() { try { Donors s = new Donors(); dgvDonors.DataSource = s.ListDonors(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void send(Donation objDonation, Charities objCharity, Donors objDonor) //Method for Charity Update Email { /* * Domain: sandbox159fa439dcf34a9eb2ff92d54042540e.mailgun.org * Key: key-f1eea887912d47d16655bca93ef5eb76 * Email: [email protected] * */ try { RestClient client = new RestClient(); client.BaseUrl = new Uri("https://api.mailgun.net/v3"); client.Authenticator = new HttpBasicAuthenticator("api", "key-f1eea887912d47d16655bca93ef5eb76");// replace this key with your key. RestRequest req = new RestRequest(); req.AddParameter("domain", "sandbox159fa439dcf34a9eb2ff92d54042540e.mailgun.org", ParameterType.UrlSegment); //replace it with your sandbox id. req.Resource = "{domain}/messages"; req.AddParameter("from", "Admin @ Useless is Useful <*****@*****.**>"); //default smtp login from your sandbox domain details. req.AddParameter("to", "Test <*****@*****.**>"); //authorized email only. req.AddParameter("subject", string.Format("Update On your case! - Id: {0}", objDonation.Id)); // Subject of your email req.AddParameter("html", string.Format(@" <html> <h3>Hello! {0}</h3> <p>Here is an update on how your case is going </p> <h4>Donation ID: {1}</h4> <p>Your Case details are:<br/><br/> Donor Name: {2}<br/> Donation Category: {3}<br/> Pickup Date: {4}<br/> Pickup Address: {5}<br/> Number of items donated: {6}<br/> Number of recycled items: {7}<br/> Drop off date: {8}<br/> Donation Status: {9}<br/> </p> <p>We will be in touch with further updates!</p> <p>Many Thanks,<br/> Admin @ Useless is Useful. </p> </html> ", objCharity.CharityName, objDonation.Id, objDonor.FirstName + " " + objDonor.LastName, objDonation.Category, objDonation.PickupDate.ToShortDateString(), objDonation.PickupAddress, objDonation.NoItems, objDonation.NoRecycledItems, objDonation.DropOffDate.ToString(), objDonation.Status));// Body of your email. req.Method = Method.POST; client.Execute(req); } catch (Exception ex) { //log exception. throw ex; } }
private void ShowDonorMenu(Donors donor) { Console.WriteLine($"Login successful! Welcome {donor.Name}."); if (donor.Status != "Available") { donorController.DonorInteractions(donor); } else { Console.WriteLine("You are enrolled in the program. Patients will connect with you soon."); Console.WriteLine("Press any key to return to main menu."); Console.ReadKey(); } }
public Donors GetSelectedDonor(string ID) { _Connection.Sheet = "Donors"; var CurrentDonorRange = $"{_Connection.Sheet}!A" + (int.Parse(ID) + 1).ToString() + ":AY" + (int.Parse(ID) + 1).ToString(); SpreadsheetsResource.ValuesResource.GetRequest request = _Connection.Service.Spreadsheets.Values.Get(_Connection.SpreadsheetId, CurrentDonorRange); var response = request.Execute(); IList <IList <object> > values = response.Values; Donors SelectedDonor = new Donors(); SelectedDonor.ID = values[0][0].ToString(); SelectedDonor.FullName = values[0][1].ToString(); SelectedDonor.FirstName = values[0][2].ToString(); SelectedDonor.LastName = values[0][3].ToString(); SelectedDonor.ConnectionID = values[0][4].ToString(); SelectedDonor.Gender = values[0][5].ToString(); SelectedDonor.AgeGroup = values[0][6].ToString(); SelectedDonor.Email = values[0][7].ToString(); SelectedDonor.PhoneNumber = values[0][8].ToString(); SelectedDonor.Country = values[0][9].ToString(); SelectedDonor.City = values[0][10].ToString(); SelectedDonor.NativeLanguage = values[0][11].ToString(); SelectedDonor.TotalDonation = int.Parse(values[0][12].ToString()); SelectedDonor.LastDonation = int.Parse(values[0][13].ToString()); SelectedDonor.VIP = bool.Parse(values[0][14].ToString()); SelectedDonor.AnashIsrael = bool.Parse(values[0][15].ToString()); SelectedDonor.AnashUSA = bool.Parse(values[0][16].ToString()); SelectedDonor.PinskSchoolGraduate = bool.Parse(values[0][17].ToString()); SelectedDonor.KievSchoolGraduate = bool.Parse(values[0][18].ToString()); SelectedDonor.YeshivaGraduate = bool.Parse(values[0][19].ToString()); SelectedDonor.InPinsk = bool.Parse(values[0][20].ToString()); SelectedDonor.BusinessAssociate = bool.Parse(values[0][21].ToString()); SelectedDonor.BoysCounselor = bool.Parse(values[0][22].ToString()); SelectedDonor.GirlsCounselor = bool.Parse(values[0][23].ToString()); SelectedDonor.HelpedByPinsk = bool.Parse(values[0][24].ToString()); SelectedDonor.GeneralSupporter = bool.Parse(values[0][25].ToString()); SelectedDonor.MHSG = bool.Parse(values[0][26].ToString()); SelectedDonor.BelarusAnsectors = bool.Parse(values[0][27].ToString()); SelectedDonor.BelarusTourism = bool.Parse(values[0][28].ToString()); SelectedDonor.YYFundraiser = bool.Parse(values[0][29].ToString()); SelectedDonor.YYFamily = bool.Parse(values[0][30].ToString()); SelectedDonor.YYStaff = bool.Parse(values[0][31].ToString()); SelectedDonor.RShteiermanFamily = bool.Parse(values[0][32].ToString()); SelectedDonor.RFimaFamily = bool.Parse(values[0][33].ToString()); SelectedDonor.MarriedAYYGraduate = bool.Parse(values[0][34].ToString()); SelectedDonor.YearsInYadYisroel = Int32.Parse(values[0][35].ToString()); SelectedDonor.Other = values[0][36].ToString(); return(SelectedDonor); }
public void addinfo(Donors donor) { var collection = db.GetCollection <BsonDocument>("Donors"); var document = new BsonDocument { { "firstname", donor.FirstName }, { "lastname", donor.LastName }, { "email", donor.Email }, { "contact", donor.Contact }, { "username", donor.UserName }, { "password", donor.Password } }; collection.InsertOneAsync(document); }
static void Pardon(Client player, string[] cmd, int iarg) { if (cmd.Length != 2) { throw new ErrorException("Missing username"); } if (player.Admin() || Donors.IsDonor(player)) { Banned.Pardon(player, cmd [1]); return; } Banned.VotePardon(player, cmd [1]); }