protected void UpdatePublishButton_Click(object sender, EventArgs e) { string publicStatus = publishStatusDropDownList.Text; if (!string.IsNullOrEmpty(publicStatus) && Request.QueryString["DonorId"] != null) { DonorInfo aDonorInfo = new DonorInfo(); int id = Convert.ToInt32(Request.QueryString["DonorId"]); aDonorInfo.Id = id; aDonorInfo.PublishStatus = publicStatus; string msg = _donorInfoManager.UpdatePublishInfo(aDonorInfo); if (msg == "update") { DisplayMessage("Updated Successfully", Color.ForestGreen); } else if (msg == "failed") { DisplayMessage("Update data failed.", Color.ForestGreen); } else if (msg == "exist") { DisplayMessage("Duplicate Data Required! Same Division Name Exist.", Color.Red); } } else { DisplayMessage("Empty Fields Are Required! Try Again", Color.Red); } }
private bool ValidateAll(DonorInfo newDonor) { bool valid = true; //first name check if (!Validator.NullOrEmptyRule(newDonor.First_Name)) { lblVFName.Text = "Please enter First Name"; valid = false; } else { lblVFName.Text = ""; } //last name check if (!Validator.NullOrEmptyRule(newDonor.Last_Name)) { lblVLName.Text = "Please enter Last Name"; valid = false; } else { lblVLName.Text = ""; } //email check if (!Validator.NullOrEmptyRule(newDonor.Email)) { lblVEmail.Text = "Please enter Email"; valid = false; } else if (!Validator.EmailCheck(newDonor.Email)) { lblVEmail.Text = "Email Invalid"; valid = false; } else { lblVEmail.Text = ""; } //phone check if (!Validator.NullOrEmptyRule(newDonor.Phone)) { lblVPhone.Text = "Please enter Phone Number"; valid = false; } else if (!Validator.PhoneCheck(newDonor.Phone)) { lblVPhone.Text = "Phone Number Invalid"; valid = false; } else { lblVPhone.Text = ""; } return(valid); }
protected void loginButton_Click(object sender, EventArgs e) { string a = donorIdTextBox.Text; string b = passwordTextBox.Text; if (!string.IsNullOrEmpty(a) && !string.IsNullOrEmpty(b)) { /* List<DonorInfo > aDonorInfos = _donorInfoManager.GetAllDonorInfo(a, b) ?? new List<DonorInfo>();*/ DonorInfo aDonorInfo = new DonorInfo(); aDonorInfo.DonorUserId = a; aDonorInfo.DonorPassword = b; string msg = _donorInfoManager.IsMatch(a, b); if (msg == "success") { Session["DonorUserId"] = aDonorInfo.DonorUserId; Session["DonorPassword"] = aDonorInfo.DonorPassword; Response.Redirect("DonorProfile.aspx"); InfoMessageLabel.Text = null; } else if (msg == "failed") { DisplayMessage("Invalid UserId Or Password! Try Again.", Color.Red); } } else { DisplayMessage("Empty Fields Are Required! Try Again.", Color.Red); } }
public DonorInfo GetDataUpdById(int donorId) { DonorInfo aDonorInfo = null; string query = "SELECT * FROM DonorInfo WHERE Id='" + donorId + "'"; Connection.Open(); Command = new SqlCommand(query, Connection); Reader = Command.ExecuteReader(); if (Reader.HasRows) { Reader.Read(); aDonorInfo = new DonorInfo { DonorName = Reader["DonorName"].ToString(), DonorType = Reader["DonorType"].ToString(), FatherName = Reader["FatherName"].ToString(), MotherName = Reader["MotherName"].ToString(), BloodInfoId = (int)Reader["BloodInfoId"], Gender = Reader["Gender"].ToString(), Dob = Convert.ToDateTime(Reader["Dob"]), Mobile = Reader["Mobile"].ToString(), AlterMobile = Reader["AlterMobile"].ToString(), Email = Reader["Email"].ToString(), DivisionInfoId = (int)Reader["DivisionInfoId"], DistrictInfoId = (int)Reader["DistrictInfoId"], SubDistrictInfoId = (int)Reader["SubDistrictInfoId"], City = Reader["City"].ToString(), DonorUserId = Reader["DonorUserId"].ToString(), DonorPassword = Reader["DonorPassword"].ToString(), AbilityToDonate = Reader["AbilityToDonate"].ToString() }; Reader.Close(); } Connection.Close(); return(aDonorInfo); }
protected void updateButton_Click(object sender, EventArgs e) { string a = donorIdTextBox.Text; string b = donorTypeDropDownList.Text; string c = fatherNameTextBox.Text; string d = motherNameTextBox.Text; string es = bloodGroupDropDownList.Text; string f = genderDropDownList.Text; string g = dobTextBox.Text; string h = mobileNoTextBox.Text; string hs = abilityDropDownList.Text; string i = divisionDropDownList.Text; string j = districtDropDownList.Text; string k = subDistrictDropDownList.Text; string l = cityTextBox.Text; string m = donorIdTextBox.Text; string n = passwordTextBox.Text; if (!string.IsNullOrEmpty(a) && !string.IsNullOrEmpty(b) && !string.IsNullOrEmpty(c) && !string.IsNullOrEmpty(d) && !string.IsNullOrEmpty(es) && !string.IsNullOrEmpty(f) && !string.IsNullOrEmpty(g) && !string.IsNullOrEmpty(h) && !string.IsNullOrEmpty(i) && !string.IsNullOrEmpty(j) && !string.IsNullOrEmpty(k) && !string.IsNullOrEmpty(l) && !string.IsNullOrEmpty(m) && !string.IsNullOrEmpty(n) && Request.QueryString["DonorId"] != null) { DonorInfo aDonorInfo = new DonorInfo(); int ab = Convert.ToInt32(Request.QueryString["DonorId"]); aDonorInfo.Id = ab; aDonorInfo.DonorName = a; aDonorInfo.DonorType = b; aDonorInfo.FatherName = c; aDonorInfo.MotherName = d; aDonorInfo.BloodInfoId = Convert.ToInt32(es); aDonorInfo.Gender = f; aDonorInfo.Dob = Convert.ToDateTime(g); aDonorInfo.Mobile = h; aDonorInfo.AlterMobile = alterPhoneTextBox.Text; aDonorInfo.Email = emailTextBox.Text; aDonorInfo.DivisionInfoId = Convert.ToInt32(i); aDonorInfo.DistrictInfoId = Convert.ToInt32(j); aDonorInfo.SubDistrictInfoId = Convert.ToInt32(k); aDonorInfo.City = l; aDonorInfo.DonorUserId = m; aDonorInfo.DonorPassword = n; aDonorInfo.AbilityToDonate = hs; string msg = _donorInfoManager.UpdateDonorInfo(aDonorInfo); if (msg == "update") { DisplayMessage("Updated Successfully", Color.ForestGreen); Response.Redirect("DonorProfile.aspx"); } else if (msg == "failed") { DisplayMessage("Update data failed.", Color.ForestGreen); } else if (msg == "exist") { DisplayMessage("Duplicate Data Required! Check Mobile No.& UserId.", Color.Red); } } else { DisplayMessage("Empty Fields Are Required! Try Again", Color.Red); } }
private void SaveDonorInformation() { var addDonorInfo = new DonorInfo { Id = Convert.ToInt32(txtId.Text), Name = txtName.Text, City = txtCity.Text, ContactNumber = Convert.ToInt32(txtContactNumber.Text), BloodGroup = txtBloodGroup.Text, DischargeDate = Convert.ToDateTime(dtDischargeDate.Text), DonationDetails = new List <DonationDetails> { new DonationDetails { } } }; donateService.AddDonorInfo(addDonorInfo); if (addDonorInfo.HasError) { MessageBox.Show(addDonorInfo.ErrorMessage); } else { MessageBox.Show("Donor's Information Saved"); } }
public ActionResult DeleteConfirmed(int id) { DonorInfo donorInfo = db.DonorInfo.Find(id); db.DonorInfo.Remove(donorInfo); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,FirstName,Middle,LastName,Title,Suffix,CompanyName,Address,City,State,Zip,Email,Phone,Birthday,Gender,Relationship,Identity")] DonorInfo donorInfo) { if (ModelState.IsValid) { db.Entry(donorInfo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(donorInfo)); }
public int UpdatePublishInfo(DonorInfo aDonorInfo) { int rowAffected = 0; string query = "UPDATE DonorInfo SET PublishStatus='" + aDonorInfo.PublishStatus + "' WHERE Id='" + aDonorInfo.Id + "'"; Connection.Open(); Command = new SqlCommand(query, Connection); rowAffected = Command.ExecuteNonQuery(); Connection.Close(); return(rowAffected); }
public int UpdateDonorInfoCheck(DonorInfo aDonorInfo) { int rowAffected = 0; string query = "UPDATE DonorInfo SET DonorName='" + aDonorInfo.DonorName + "',DonorType='" + aDonorInfo.DonorType + "',FatherName='" + aDonorInfo.FatherName + "',MotherName='" + aDonorInfo.MotherName + "',BloodInfoId='" + aDonorInfo.BloodInfoId + "', Gender='" + aDonorInfo.Gender + "', Dob='" + aDonorInfo.Dob + "',Mobile='" + aDonorInfo.Mobile + "', AlterMobile='" + aDonorInfo.AlterMobile + "',Email= '" + aDonorInfo.Email + "', DivisionInfoId='" + aDonorInfo.DivisionInfoId + "', DistrictInfoId='" + aDonorInfo.DistrictInfoId + "',SubDistrictInfoId='" + aDonorInfo.SubDistrictInfoId + "',City='" + aDonorInfo.City + "',DonorUserId='" + aDonorInfo.DonorUserId + "',DonorPassword='******',AbilityToDonate='" + aDonorInfo.AbilityToDonate + "' WHERE Id='" + aDonorInfo.Id + "'"; Connection.Open(); Command = new SqlCommand(query, Connection); rowAffected = Command.ExecuteNonQuery(); Connection.Close(); return(rowAffected); }
private void btnSubmit_Clicked(object sender, EventArgs e) { newDonor = GetDonor(); if (ValidateAll(newDonor)) { btnSubmit.IsEnabled = false; DependencyService.Get <IToast>().ShortAlert("Submitting... please wait."); InsertDonorToDatabase(newDonor); } }
public string UpdatePublishInfo(DonorInfo aDonorInfo) { int rowAffected = _donorInfoGateway.UpdatePublishInfo(aDonorInfo); if (rowAffected > 0) { return("update"); } else { return("failed"); } }
// GET: DonorInfoes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DonorInfo donorInfo = db.DonorInfo.Find(id); if (donorInfo == null) { return(HttpNotFound()); } return(View(donorInfo)); }
private void InsertDonorToDatabase(DonorInfo donor) { try { //first removes handler so that this event can only be subscribed to once App.service.InsertDonorCompleted -= Service_InsertDonorCompleted; App.service.InsertDonorCompleted += Service_InsertDonorCompleted; App.service.InsertDonorAsync(donor); } catch (Exception ex) { DependencyService.Get <IToast>().LongAlert("Error, unable to access server."); btnSubmit.IsEnabled = true; Debug.WriteLine(ex); } }
public bool IsExistData(DonorInfo aDonorInfo) { string query = "SELECT * FROM DonorInfo WHERE Mobile='" + aDonorInfo.Mobile + "' AND DonorUserId='" + aDonorInfo.DonorUserId + "' "; Connection.Open(); Command = new SqlCommand(query, Connection); Reader = Command.ExecuteReader(); if (Reader.HasRows) { return(true); } Reader.Close(); Connection.Close(); return(false); }
public DonationPickupFormPage(DonorInfo d) { InitializeComponent(); if (App.service == null) { App.InitializeService(); } donor = d; if (itemCategories == null) { InitializePickers(); } }
public int SaveDonorInfo(DonorInfo aDonorInfo) { int rowAffected = 0; string query = "INSERT INTO DonorInfo VALUES('" + aDonorInfo.DonorName + "','" + aDonorInfo.DonorType + "','" + aDonorInfo.FatherName + "','" + aDonorInfo.MotherName + "','" + aDonorInfo.BloodInfoId + "','" + aDonorInfo.Gender + "','" + aDonorInfo.Dob + "','" + aDonorInfo.Mobile + "','" + aDonorInfo.AlterMobile + "', '" + aDonorInfo.Email + "' ,'" + aDonorInfo.DivisionInfoId + "','" + aDonorInfo.DistrictInfoId + "','" + aDonorInfo.SubDistrictInfoId + "','" + aDonorInfo.City + "','" + aDonorInfo.DonorUserId + "','" + aDonorInfo.DonorPassword + "','" + aDonorInfo.AbilityToDonate + "','" + aDonorInfo.PublishStatus + "')"; Connection.Open(); Command = new SqlCommand(query, Connection); rowAffected = Command.ExecuteNonQuery(); Connection.Close(); return(rowAffected); }
public DonorInfo GetDonorInfoById(int id) { DonorInfo mod = new DonorInfo(); try { //mod = _context.DonorInfo.Find(id); mod = _context.DonorInfo.Include(a => a.DonationDetails).Where(a => a.Id == id).FirstOrDefault(); _context.Entry(mod).State = EntityState.Detached; return(mod); } catch (Exception ex) { mod = null; mod.AddErrorMessage(ex.Message); } return(mod); }
public DonorInfo GetDonorDataById(int id) { DonorInfo aDonorInfo = null; string query = "SELECT * FROM DonorInfo WHERE Id='" + id + "'"; Connection.Open(); Command = new SqlCommand(query, Connection); Reader = Command.ExecuteReader(); if (Reader.HasRows) { Reader.Read(); aDonorInfo = new DonorInfo { PublishStatus = Reader["PublishStatus"].ToString() }; Reader.Close(); } Connection.Close(); return(aDonorInfo); }
private void Service_GetDonorFromEmailCompleted(object sender, GetDonorFromEmailCompletedEventArgs e) { bool success = false; string message = ""; DonorInfo result = new DonorInfo(); if (e.Error == null) { result = e.Result; if (result.Email == email) { donor = result; success = true; message = "Donor information succesfully retrieved."; } else { success = false; message = "Email not found."; } } else { success = false; message = "Error retrieving donor information."; Debug.WriteLine(e.Error); } Device.BeginInvokeOnMainThread(() => { DependencyService.Get <IToast>().ShortAlert(message); btnSubmit.IsEnabled = true; if (success) { this.Navigation.PushAsync(new DonationPickupFormPage(donor)); } }); }
public string SaveDonorInfo(DonorInfo aDonorInfo) { bool isDuplicateData = _donorInfoGateway.IsExistData(aDonorInfo); if (!isDuplicateData) { int rowAffected = _donorInfoGateway.SaveDonorInfo(aDonorInfo); if (rowAffected > 0) { return("success"); } else { return("failed"); } } else { return("exist"); } }
public DonorInfo AddDonorInfo(DonorInfo mod) { try { if (mod.Id == 0) { _context.DonorInfo.Add(mod); } else { _context.Entry(mod).State = EntityState.Modified; _context.Set <DonorInfo>().Attach(mod); } _context.SaveChanges(); } catch (Exception ex) { mod.HasError = true; mod.AddErrorMessage(ex.Message); } return(mod); }
private void GetDataByDonorId(int donorId) { DonorInfo aDonorInfo = _donorInfoManager.GetDonorUpdateDataById(donorId); donorNameTextBox.Text = aDonorInfo.DonorName; donorTypeDropDownList.SelectedValue = aDonorInfo.DonorType; fatherNameTextBox.Text = aDonorInfo.FatherName; motherNameTextBox.Text = aDonorInfo.MotherName; bloodGroupDropDownList.SelectedValue = aDonorInfo.BloodInfoId.ToString( ); genderDropDownList.SelectedValue = aDonorInfo.Gender; dobTextBox.Text = aDonorInfo.Dob.ToString(); mobileNoTextBox.Text = aDonorInfo.Mobile; alterPhoneTextBox.Text = aDonorInfo.AlterMobile; emailTextBox.Text = aDonorInfo.Email; divisionDropDownList.SelectedValue = aDonorInfo.DivisionInfoId.ToString(); districtDropDownList.SelectedValue = aDonorInfo.DistrictInfoId.ToString(); subDistrictDropDownList.SelectedValue = aDonorInfo.SubDistrictInfoId.ToString(); cityTextBox.Text = aDonorInfo.City; donorIdTextBox.Text = aDonorInfo.DonorUserId; passwordTextBox.Text = aDonorInfo.DonorPassword; abilityDropDownList.SelectedValue = aDonorInfo.AbilityToDonate; }
private DonorInfo GetDonor() { string fName, lName, mName, email, phone, city, zip, address, address2; string state; char gender; fName = entFName.Text; lName = entLName.Text; mName = entMName.Text; email = entEmail.Text; //strip non-numeric characters, if null return empty space phone = Regex.Replace(entPhone.Text ?? "", "[^0-9]", ""); city = entCity.Text; zip = entZIP.Text; address = entAddress.Text; address2 = entAddress2.Text; gender = pickGender.SelectedItem.ToString()[0]; state = pickState.SelectedItem.ToString(); DonorInfo newDonor = new DonorInfo(); newDonor.Status_Map_ID = 1; newDonor.First_Name = fName; newDonor.Middle_Name = mName; newDonor.Last_Name = lName; newDonor.Gender = gender; newDonor.Email = email; newDonor.Phone = phone; newDonor.ZipCode = zip; newDonor.City = city; newDonor.State = state; newDonor.Address = address; newDonor.Address2 = address2; return(newDonor); }
private void GetDataById(int id) { DonorInfo aDonorInfo = _donorInfoManager.GetDonorDataById(id); publishStatusDropDownList.SelectedValue = aDonorInfo.PublishStatus.ToString(); }
protected void submitButton_Click(object sender, EventArgs e) { string a = donorTypeDropDownList.SelectedValue; string b = donorNameTextBox.Text.Trim(); string c = fatherNameTextBox.Text.Trim(); string d = motherNameTextBox.Text.Trim(); string es = bloodGroupDropDownList.SelectedValue; string f = genderDropDownList.SelectedValue; string g = dobTextBox.Text.Trim(); string h = mobileNoTextBox.Text.Trim(); string i = alterPhoneTextBox.Text.Trim(); string j = emailTextBox.Text.Trim(); string l = divisionDropDownList.SelectedValue; string m = districtDropDownList.SelectedValue; string n = subDistrictDropDownList.SelectedValue; string o = cityTextBox.Text.Trim(); string p = donorIdTextBox.Text.Trim(); string q = passwordTextBox.Text.Trim(); string r = reenterPasswordTextBox.Text.Trim(); string s = abilityDropDownList.SelectedValue; if (!string.IsNullOrEmpty(a) && !string.IsNullOrEmpty(b) && !string.IsNullOrEmpty(c) && !string.IsNullOrEmpty(d) && !string.IsNullOrEmpty(es) && !string.IsNullOrEmpty(f) && !string.IsNullOrEmpty(g) && !string.IsNullOrEmpty(h) && !string.IsNullOrEmpty(l) && !string.IsNullOrEmpty(m) && !string.IsNullOrEmpty(n) && !string.IsNullOrEmpty(o) && !string.IsNullOrEmpty(p) && !string.IsNullOrEmpty(q) && !string.IsNullOrEmpty(r) && !string.IsNullOrEmpty(s)) { DonorInfo aDonorInfo = new DonorInfo(); aDonorInfo.DonorType = a; aDonorInfo.DonorName = b; aDonorInfo.FatherName = c; aDonorInfo.MotherName = d; aDonorInfo.BloodInfoId = Convert.ToInt32(es); aDonorInfo.Gender = f; aDonorInfo.Dob = Convert.ToDateTime(g); aDonorInfo.Mobile = h; aDonorInfo.AlterMobile = i; aDonorInfo.Email = j; aDonorInfo.DivisionInfoId = Convert.ToInt32(l); aDonorInfo.DistrictInfoId = Convert.ToInt32(m); aDonorInfo.SubDistrictInfoId = Convert.ToInt32(n); aDonorInfo.City = o; aDonorInfo.DonorUserId = p; aDonorInfo.DonorPassword = q; aDonorInfo.AbilityToDonate = s; aDonorInfo.PublishStatus = "unpublish"; if (r == aDonorInfo.DonorPassword) { if (trueInfoCheckBox.Checked && PermissionInfoCheckBox.Checked) { string msg = _donorInfoManager.SaveDonorInfo(aDonorInfo); if (msg == "success") { DisplayMessage("Saved Successfully", Color.ForestGreen); Response.Redirect("Login.aspx"); } else if (msg == "failed") { DisplayMessage("Saved Failed! Try Again.", Color.Red); } else if (msg == "exist") { DisplayMessage("Duplicate Data Required! Check Mobile No. & Password.", Color.Red); } } else { DisplayMessage("Confirm Your Declaration! Try Again.", Color.Red); } } else { DisplayMessage("Password Not Match! Try Again.", Color.Red); } } else { DisplayMessage("Empty Fields Are Required! Try Again.", Color.Red); } }