protected override Organization Parse() { return(new Organization { Id = ToInt(OrganizationID), Name = OrganizationName.ToString(), About = About.ToString(), LastUpdate = ToDateTime(LastUpdate), Address = CompleteAddress.ToString(), StreetName = StreetName.ToString(), StreetNumber = ToInt(StreetNo), Barangay = Barangay.ToString(), City = CityOrMunicipality.ToString(), State = StateOrProvince.ToString(), Country = Country.ToString(), DateEstablished = DateEstablished.ToString(), ParentOrganization = ParentOrganization.ToString(), Preacher = FeastBuilderOrPreacher.ToString(), Branch = BranchOrLocation.ToString(), ContactNumber = ContactNo.ToString(), Email = EmailAddress.ToString(), Website = Website.ToString(), Longitude = (float)Convert.ToDouble(Longitude), Latitude = (float)Convert.ToDouble(Latitude), RetreatSchedule = RetreatSchedule.ToString(), RecollectionSchedule = RecollectionSchedule.ToString(), TalkSchedule = TalkSchedule.ToString(), CampSchedule = CampSchedule.ToString(), VolunteerSchedule = VolunteerSchedule.ToString(), OrgMasking = MaskingData.ToString() }); }
public Barangay GetBarangay(int baranggayId) { _barangay = new Barangay() { BarangayId = baranggayId }; try { int operationType = Convert.ToInt32(OperationType.SelectSpecific); using (IDbConnection con = new SqlConnection(AppSettings.ConnectionStrings)) { if (con.State == ConnectionState.Closed) { con.Open(); } var oBarangay = con.Query <Barangay>("sp_Barangay", _barangay.SetParameters(_barangay, operationType), commandType: CommandType.StoredProcedure).ToList(); if (oBarangay != null && oBarangay.Count() > 0) { _barangay = oBarangay.SingleOrDefault(); } } } catch (Exception ex) { _psgc.Message = ex.Message; } return(_barangay); }
protected override Church Parse() { return(new Church { Id = ToInt(SimbahanID), StreetNumber = ToInt(StreetNo), StreetName = StreetName.ToString(), Barangay = Barangay.ToString(), StateProvince = StateOrProvince.ToString(), City = City.ToString(), ZipCode = ZipCode.ToString(), CompleteAddress = CompleteAddress.ToString(), Diocese = Diocese.ToString(), Parish = Parish.ToString(), Priest = ParishPriest.ToString(), Vicariate = Vicariate.ToString(), DateEstablished = DateEstablished.ToString(), LastUpdate = ToDateTime(LastUpdate), FeastDay = FeastDay.ToString(), ContactNo = ContactNo.ToString(), Latitude = ToDouble(Latitude), Longitude = ToDouble(Longitude), HasAdorationChapel = ToBoolean(HasAdorationChapel), ChurchHistory = ChurchHistory.ToString(), OfficeHours = OfficeHours.ToString(), ChurchTypeId = ToInt(ChurchTypeID), Website = Website.ToString(), EmailAddress = EmailAddress.ToString(), DevotionSchedule = DevotionSchedule.ToString(), LocationId = ToInt(LocationID), ChurchCode = ChurchCode.ToString() }); }
public Barangay AddBarangay(Barangay barangay) { try { int operationType = Convert.ToInt32(barangay.BarangayId == 0 ? OperationType.Insert : OperationType.Update); using (IDbConnection con = new SqlConnection(AppSettings.ConnectionStrings)) { if (con.State == ConnectionState.Closed) { con.Open(); } var oBarangay = con.Query <Barangay>("sp_Barangay", _barangay.SetParameters(barangay, operationType), commandType: CommandType.StoredProcedure); if (oBarangay != null && oBarangay.Count() > 0) { _barangay = oBarangay.FirstOrDefault(); } } } catch (Exception ex) { _psgc.Message = ex.Message; } return(_barangay); }
public async Task <Barangay> UpdateBarangayAsync(Barangay barangay) { _db.Entry(barangay).State = EntityState.Modified; await _db.SaveChangesAsync(); return(barangay); }
public IHttpActionResult PutBarangay(int id, Barangay barangay) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != barangay.BarangayId) { return(BadRequest()); } db.Entry(barangay).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BarangayExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
/// <summary> /// Tip: override GenerateEditDetailsDeleteLinks and supply custom values for the 'param' parameter /// </summary> protected override AddressLayoutContentsCreateEditViewModel GetLayoutContentsViewModelForCreateEdit(Address item, string title1, string title2, string title3, int pageSize, int labelClassColumnCount, int parentId, string param) { var initialPersonSuggestion = GetInitialPersonSuggestion(item); var initialSuggestion = item?.Barangay?.CreateSuggestion(); var action = GetActionName(); if (initialSuggestion == null) { var tmpItem = new Barangay(); initialSuggestion = tmpItem.CreateSuggestion(); } var contentsVm = new AddressLayoutContentsCreateEditViewModel(item, title1, title2, title3, pageSize, action, parentId: parentId) { GetAddressTypes = GetAddressTypes, GetOwnerTypes = GetOwnerTypes, InitialBarangaySuggestion = initialSuggestion, InitialStreetAddress = item?.StreetAddress, InitialPersonSuggestion = initialPersonSuggestion }; if (!string.IsNullOrWhiteSpace(param)) { contentsVm.HasParent = true; } return(contentsVm); }
/// <summary> /// /// </summary> /// <param name="barangay"></param> /// <returns></returns> public async Task <Barangay> AddBarangayAsync(Barangay barangay) { _db.Barangays.Add(barangay); await _db.SaveChangesAsync(); return(barangay); }
private async void dgvBarangay_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (listBarangay.Count() != 0) { if (dgvBarangay.Columns[e.ColumnIndex].HeaderText == "Edit") { barangayID = int.Parse(dgvBarangay.CurrentRow.Cells[2].Value.ToString()); EditBarangay = true; frmAddBarangay fab = new frmAddBarangay(); fab.ShowDialog(); } if (dgvBarangay.Columns[e.ColumnIndex].HeaderText == "Delete") { barangayID = int.Parse(dgvBarangay.CurrentRow.Cells[2].Value.ToString()); Barangay barangay = await repository.GetBarangayByIdAsync(barangayID); DialogResult dr = MessageBox.Show("Are you sure to delete Barangay " + barangay.BrgyName + " from list?", "Warning!", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { await repository.DeleteBarangayAsync(barangayID); MessageBox.Show("Delete Successfull!", "Success!"); await LoadBarangay(); } } } }
public static List <Barangay> GetBrgyPerCity(string par) { var dbUtil = new DatabaseManager(); var brgylist = new List <Barangay>(); int prm = int.Parse(par); using (var conn = new SqlConnection(dbUtil.getSQLConnectionString("MainDB"))) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "spBrgyPerCity"; cmd.CommandTimeout = 180; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@ctyID", prm); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { var brngy = new Barangay { brgyid = ReferenceEquals(reader["brgyid"], DBNull.Value) ? 0 : Convert.ToInt32(reader["brgyid"]), brgymunicipalityid = ReferenceEquals(reader["idcity"], DBNull.Value) ? 0 : Convert.ToInt32(reader["idcity"]), brgyname = ReferenceEquals(reader["brgyname"], DBNull.Value) ? String.Empty : reader["brgyname"].ToString() }; brgylist.Add(brngy); } return(brgylist); } } } }
private async void frmAddBarangay_Load(object sender, EventArgs e) { await CallLoad(); foreach (var item in GetClusters) { cbCluster.Items.Add(item.ClusterName); } if (frmSettings.OnEdit == true) { this.Text = "Update Info"; btnAdd.Text = "Update"; Barangay barangay = await rep_Barangay.Get(frmSettings.BrgyID); txtBarangay.Text = barangay.BarangayName; if (barangay.Municipality.District == "1st District") { rb_1stDistrict.Checked = true; } else { rb_2ndDistrict.Checked = true; } cbMunicipality.Text = barangay.Municipality.MunicipalityName; cbCluster.Text = barangay.BarangayCluster; } }
public void DeleteBarangay(Barangay brg) { if (brg == null) { throw new ArgumentNullException(nameof(brg)); } _context.Barangays.Remove(brg); }
public Barangay Update(Barangay model) { var attach = context.Barangay.Attach(model); attach.State = EntityState.Modified; context.SaveChanges(); return(model); }
public static Barangay GetById(string uniqueId) { using (DB context = new DB()) { Barangay obj = context.Barangays.Where(o => o.UniqueId == new Guid(uniqueId)).SingleOrDefault(); return(obj); } }
public ActionResult DeleteConfirmed(int id) { Barangay barangay = db.Barangays.Find(id); db.Barangays.Remove(barangay); db.SaveChanges(); return(RedirectToAction("Index")); }
public void CreateBarangay(Barangay brg) { if (brg == null) { throw new ArgumentNullException(nameof(brg)); } brg.BarangayId = Guid.NewGuid(); _context.Barangays.Add(brg); }
public async Task <Barangay> DeleteBarangayAsync(int id) { Barangay barangay = await _db.Barangays.FindAsync(id); _db.Barangays.Remove(barangay); await _db.SaveChangesAsync(); return(barangay); }
public ActionResult Edit([Bind(Include = "BarangayID,Name")] Barangay barangay) { if (ModelState.IsValid) { db.Entry(barangay).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(barangay)); }
public Barangay Add(Barangay model) { if (model != null) { context.Barangay.Add(model); context.SaveChanges(); } return(model); }
public Barangay AddNewBarangay([FromBody] Barangay oBarangay) { if (ModelState.IsValid) { return(_iBarangayService.AddBarangay(oBarangay)); } else { return(null); } }
public static BarangaySuggestion CreateSuggestion(this Barangay barangay) { var id = barangay.Id != 0 ? barangay.Id : (int?)null; var barangayName = barangay.Name; var cityMunicipalityName = barangay.CityMunicipality?.Name; var zipCode = barangay.CityMunicipality?.ZipCode; var provinceName = barangay.CityMunicipality?.Province?.Name; var regionName = barangay.CityMunicipality?.Province?.Region?.Name; return(new BarangaySuggestion(id, barangayName, cityMunicipalityName, provinceName, regionName, zipCode)); }
public ActionResult Edit(Barangay model) { bool result = BarangayData.Edit(model); if (result) { return(RedirectToAction("Index")); } return(View()); }
public ActionResult Delete(Barangay model) { bool result = BarangayData.Delete(model.UniqueId.ToString()); if (result) { return(RedirectToAction("Index")); } return(View()); }
public IHttpActionResult GetBarangay(int id) { Barangay barangay = db.Barangays.Find(id); if (barangay == null) { return(NotFound()); } return(Ok(barangay)); }
public Barangay UpdateBarangay(int barangayId, [FromBody] Barangay oBarangay) { if (ModelState.IsValid) { return(_iBarangayService.UpdateBarangay(barangayId, oBarangay)); } else { return(null); } }
private bool input_Validity() { if (Firstname.Equals("") || Lastname.Equals("") || maskedTextBox_Wallet_Id.Equals("") || Province.Equals("") || City.Equals("") || Barangay.Equals("") || BlockStr.Equals("")) { MessageBox.Show("Incomplete Fields"); return(false); } return(true); }
public ActionResult Create([Bind(Include = "BarangayID,Name")] Barangay barangay) { if (ModelState.IsValid) { db.Barangays.Add(barangay); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(barangay)); }
private async void frmAddBarangay_Load(object sender, EventArgs e) { await LoadBarangay(); if (frmSettings.EditBarangay == true) { btnAdd.Text = "Update"; Barangay barangay = await repository.GetBarangayByIdAsync(frmSettings.barangayID); txtBarangay.Text = barangay.BrgyName; } }
// GET: Edit Barangay public ActionResult Edit(string id) { if (String.IsNullOrEmpty(id)) { return(RedirectToAction("Index")); } ViewBag.Districts = DistrictData.ListAll(); Barangay model = BarangayData.GetById(id); return(View(model)); }
public IHttpActionResult PostBarangay(Barangay barangay) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Barangays.Add(barangay); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = barangay.BarangayId }, barangay)); }
protected void btnNext_Click(object sender, EventArgs e) { rep = new Reports(); bar = new Barangay(); mc = new MonthConverter(); bool inserted = false; if (txtPopulation.Text != "") { if (Int32.Parse(txtPopulation.Text) > 0) { if (rep.HasDataForTheYear(Int32.Parse(ddlYear.Text), ddlMonth.Text,bar.GetBarangayID(ddlBarangay.Text))) { Response.Write("<script> window.alert('Barangay: "+ddlBarangay.Text+" of the Year: "+ ddlYear.Text+" has data in the database. Please Try Other Year for the Barangay')</script>"); } else { inserted = rep.InsertPopulation(bar.GetBarangayID(ddlBarangay.Text), Int32.Parse(txtPopulation.Text), Int32.Parse("0"), mc.MonthNameToIndex(ddlMonth.Text), Int32.Parse(ddlYear.Text)); if (inserted) { Response.Redirect("~/Reports/Templates/xAllProgram.aspx?&month=" + Server.UrlEncode(ddlMonth.Text) + "&year=" + Server.UrlEncode(ddlYear.Text) + "&barangay=" + Server.UrlEncode(ddlBarangay.Text) + "&population=" + Server.UrlEncode(txtPopulation.Text)); } else { Response.Write("<script> window.alert('Population Insertion has failed, Please try Again.')</script>"); } } } else Response.Write("<script> window.alert('Population should be greater than zero.')</script>"); } else Response.Write("<script> window.alert('Please Fill the Population Field.')</script>"); }
protected void Button1_Click(object sender, EventArgs e) { //string noPerIndicator = ""; //string indicatorData = ""; //string pregnant = ""; //string male = ""; //string female = ""; //string startUser = ""; //string endUser = ""; //string _new = ""; //string others = ""; //string dropOut = ""; data = new DataAccess(); mc = new MonthConverter(); bar = new Barangay(); rep = new Reports(); if (rep.HasDataForTheYear(year,monthName, bar.GetBarangayID(barangay))) Response.Write("<script type='text/javascript'>" + "alert(\"Month " + lbl_month.Text + " and Year " + year + " exists in the database. Please Try other Month and Year.\");</script>"); else { string noPerIndicator = ""; string indicatorData = ""; string pregnant = ""; string male = ""; string female = ""; string startUser = ""; string endUser = ""; string _new = ""; string others = ""; string dropOut = ""; //Maternal Care -----------------------------------------------------------------------> for (int c = 0; c < pro.CountIndicatorPerProgram("Maternal Care"); c++) { TextBox tempNo = tblMaternal.FindControl("txtMaternalNo_" + c.ToString()) as TextBox; noPerIndicator = tempNo.Text; Label tempIndicator = tblMaternal.FindControl("lblMaternalIndicator" + c.ToString()) as Label; indicatorData = tempIndicator.Text; rep.InsertMaternalCareReport(indicatorData, Int32.Parse(noPerIndicator), bar.GetBarangayID(lbl_Barangay.Text), month, year); } //Dental Care -------------------------------------------------------------------------> for (int h = 0; h < pro.CountIndicatorPerProgram("Dental Care"); h++) { TextBox tempMale = tblDynamic.FindControl("txtDentalCareMale_" + h.ToString()) as TextBox; male = tempMale.Text; TextBox tempFemale = tblDynamic.FindControl("txtDentalCareFemale_" + h.ToString()) as TextBox; female = tempFemale.Text; Label tempIndicator = tblDynamic.FindControl("lblDentalCareIndicator" + h.ToString()) as Label; indicatorData = tempIndicator.Text; rep.InsertDentalCareReport(indicatorData, Int32.Parse(male), Int32.Parse(female), bar.GetBarangayID(lbl_Barangay.Text), month, year); } //Child Care ------------------------------------_-------------------------------------> for (int r = 0; r < pro.CountIndicatorPerProgram("Child Care"); r++) { TextBox tempMale = tblDynamic.FindControl("txtChildCareMale_" + r.ToString()) as TextBox; male = tempMale.Text; TextBox tempFemale = tblDynamic.FindControl("txtChildCareFemale_" + r.ToString()) as TextBox; female = tempFemale.Text; Label tempIndicator = tblDynamic.FindControl("lblChildCareIndicator" + r.ToString()) as Label; indicatorData = tempIndicator.Text; rep.InsertChildReport(indicatorData, Int32.Parse(male), Int32.Parse(female), bar.GetBarangayID(lbl_Barangay.Text), month, year); } //Filariasis ------------------------------------_-------------------------------------> for (int i = 0; i < pro.CountIndicatorPerProgram("Filariasis"); i++) { TextBox tempMale = tblDynamic.FindControl("txtFilariasisMale_" + i.ToString()) as TextBox; male = tempMale.Text; TextBox tempFemale = tblDynamic.FindControl("txtFilariasisFemale_" + i.ToString()) as TextBox; female = tempFemale.Text; Label tempIndicator = tblDynamic.FindControl("lblFilariasisIndicator" + i.ToString()) as Label; indicatorData = tempIndicator.Text; rep.InsertFilariasisReport(indicatorData, Int32.Parse(male), Int32.Parse(female), bar.GetBarangayID(lbl_Barangay.Text), month, year); } //Leprosy ------------------------------------_-----------------------------------------> for (int z = 0; z < pro.CountIndicatorPerProgram("Leprosy"); z++) { TextBox tempMale = tblDynamic.FindControl("txtLeprosyMale_" + z.ToString()) as TextBox; male = tempMale.Text; TextBox tempFemale = tblDynamic.FindControl("txtLeprosyFemale_" + z.ToString()) as TextBox; female = tempFemale.Text; Label tempIndicator = tblDynamic.FindControl("lblLeprosyIndicator" + z.ToString()) as Label; indicatorData = tempIndicator.Text; rep.InsertLeprosyReport(indicatorData, Int32.Parse(male), Int32.Parse(female), bar.GetBarangayID(lbl_Barangay.Text), month, year); } //Malaria ------------------------------------_-----------------------------------------> for (int z = 0; z < pro.CountIndicatorPerProgram("Malaria"); z++) { TextBox tempPregnant = tblMalaria.FindControl("txtMalariaPregnant_" + z.ToString()) as TextBox; pregnant = tempPregnant.Text; TextBox tempMale = tblMalaria.FindControl("txtMalariaMale_" + z.ToString()) as TextBox; male = tempMale.Text; TextBox tempFemale = tblMalaria.FindControl("txtMalariaFemale_" + z.ToString()) as TextBox; female = tempFemale.Text; Label tempIndicator = tblMalaria.FindControl("lblMalariaIndicator" + z.ToString()) as Label; indicatorData = tempIndicator.Text; rep.InsertMalariaReport(indicatorData, Int32.Parse(pregnant), Int32.Parse(male), Int32.Parse(female), bar.GetBarangayID(lbl_Barangay.Text), month, year); } //Schisto ------------------------------------_-----------------------------------------> for (int i = 0; i < pro.CountIndicatorPerProgram("Schistomiasis"); i++) { TextBox tempMale = tblDynamic.FindControl("txtSchistomiasisMale_" + i.ToString()) as TextBox; male = tempMale.Text; TextBox tempFemale = tblDynamic.FindControl("txtSchistomiasisFemale_" + i.ToString()) as TextBox; female = tempFemale.Text; Label tempIndicator = tblDynamic.FindControl("lblSchistomiasisIndicator" + i.ToString()) as Label; indicatorData = tempIndicator.Text; rep.InsertSchisReport(indicatorData, Int32.Parse(male), Int32.Parse(female), bar.GetBarangayID(lbl_Barangay.Text), month, year); } //Tuberculosis ----------------------------------------------------------------------------> for (int i = 0; i < pro.CountIndicatorPerProgram("Tuberculosis"); i++) { TextBox tempMale = tblDynamic.FindControl("txtTuberculosisMale_" + i.ToString()) as TextBox; male = tempMale.Text; TextBox tempFemale = tblDynamic.FindControl("txtTuberculosisFemale_" + i.ToString()) as TextBox; female = tempFemale.Text; Label tempIndicator = tblDynamic.FindControl("lblTuberculosisIndicator" + i.ToString()) as Label; indicatorData = tempIndicator.Text; rep.InsertTbReport(indicatorData, Int32.Parse(male), Int32.Parse(female), bar.GetBarangayID(lbl_Barangay.Text), month, year); } //Family Planning ----------------------------------------------------------------------------> for (int i = 0; i < pro.CountIndicatorPerProgram("Family Planning"); i++) { TextBox temp1 = tblFamilyPlanning.FindControl("txtFamilyPlanningStartUser_" + i.ToString()) as TextBox; startUser = temp1.Text; TextBox temp2 = tblFamilyPlanning.FindControl("txtFamilyPlanningNew_" + i.ToString()) as TextBox; _new = temp2.Text; TextBox temp3 = tblFamilyPlanning.FindControl("txtFamilyPlanningOthers_" + i.ToString()) as TextBox; others = temp3.Text; TextBox temp4 = tblFamilyPlanning.FindControl("txtFamilyPlanningDropOut_" + i.ToString()) as TextBox; dropOut = temp4.Text; TextBox temp5 = tblFamilyPlanning.FindControl("txtFamilyPlanningEndUser_" + i.ToString()) as TextBox; endUser = temp5.Text; Label tempIndicator = tblFamilyPlanning.FindControl("lblFamilyPlanningIndicator" + i.ToString()) as Label; indicatorData = tempIndicator.Text; rep.InsertFPReport(indicatorData, Int32.Parse(startUser), Int32.Parse(_new), Int32.Parse(others), Int32.Parse(dropOut), Int32.Parse(endUser), bar.GetBarangayID(lbl_Barangay.Text), month, year); } Response.Write("<script type='text/javascript'>" + "alert(\"Inserted Successfully\");</script>"); } }