protected void btnDelete_Click(object sender, EventArgs e) { int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.Trim()); int companyId = Int32.Parse(hdfCompanyId.Value.Trim()); PostPageChanges(); ArrayList workIdArrayList = GetWorkIdArrayList(); if (workIdArrayList.Count > 0) { FlatSectionJls flatSectionJls = new FlatSectionJls(); flatSectionJls.LoadByWorkIdArrayList(workIdArrayList, 1, companyId); if (flatSectionJls.Table.Rows.Count > 0) { // Delete store dataset Session.Remove("flatSectionJlsTDS"); // Store datasets Session["jlsNavigatorTDS"] = jlsNavigatorTDS; Session["flatSectionJlsTDS"] = flatSectionJls.Data; // Redirect string url = "./jls_delete.aspx?source_page=jls_navigator2.aspx&client_id=" + hdfCurrentClientId.Value + "&project_id=" + hdfCurrentProjectId.Value + GetNavigatorState(); Response.Redirect(url); } } else { RestoreNavigatorState(); cvSelection.IsValid = false; } }
private void UpdateDatabase() { // Get ids int companyId = Int32.Parse(hdfCompanyId.Value); int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value); // Delete DB.Open(); DB.BeginTransaction(); try { FlatSectionJls flatSectionJls = new FlatSectionJls(flatSectionJlsTDS); flatSectionJls.DeleteDirect(companyId); DB.CommitTransaction(); } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
private void Delete() { Page.Validate(); if (Page.IsValid) { // Delete jliners FlatSectionJls flatSectionJls = new FlatSectionJls(flatSectionJlsTDS); // ... Delete in flatSectionJlsTDS foreach (FlatSectionJlsTDS.FlatSectionJlsRow flatSectionJlsRow in (FlatSectionJlsTDS.FlatSectionJlsDataTable)flatSectionJls.Table) { if ((flatSectionJlsRow.Selected) && (!flatSectionJlsRow.Deleted)) { flatSectionJls.Delete(flatSectionJlsRow.WorkID); } } // Update databse UpdateDatabase(); // Redirect string url = ""; if (Request.QueryString["source_page"] == "jls_navigator2.aspx") { url = "./jls_navigator2.aspx?source_page=jls_delete.aspx&client_id=" + hdfCurrentClientId.Value + "&project_id=" + hdfCurrentProjectId.Value + GetNavigatorState() + "&update=yes"; } if (Request.QueryString["source_page"] == "flat_section_jls_summary.aspx") { url = "./flat_section_jls_summary.aspx?source_page=jls_delete.aspx&client_id=" + hdfCurrentClientId.Value + "&project_id=" + hdfCurrentProjectId.Value + GetNavigatorState() + "&update=yes"; } Response.Redirect(url); } }
private int Update() { FlatSectionJls flatSectionJls = new FlatSectionJls(flatSectionJlsTDS); int jlsSelected = 0; // Update flatSectionJlsTDS foreach (GridViewRow row in grdvJls.Rows) { int workId = Int32.Parse(((HiddenField)row.FindControl("hdfWorkID")).Value.ToString().Trim()); bool selected = ((CheckBox)row.FindControl("cbxSelected")).Checked; flatSectionJls.UpdateSelected(workId, selected); if (selected) jlsSelected++; } // Save jliners selection flatSectionJlsTDS.AcceptChanges(); // Store datasets Session["flatSectionJlsTDS"] = flatSectionJlsTDS; return jlsSelected; }
private void UpdateDatabase() { // Get Ids int projectId = Int32.Parse(hdfCurrentProjectId.Value.Trim()); int companyId = Int32.Parse(hdfCompanyId.Value); Int64 countryId = int.Parse(hdfCountryId.Value); Int64? provinceId = null; if (hdfProvinceId.Value != "") provinceId = Int64.Parse(hdfProvinceId.Value); Int64? countyId = null; if (hdfCountyId.Value != "") countyId = Int64.Parse(hdfCountyId.Value); Int64? cityId = null; if (hdfCityId.Value != "") cityId = Int64.Parse(hdfCityId.Value); // Update DB DB.Open(); DB.BeginTransaction(); try { FlatSectionJls flatSectionJls = new FlatSectionJls(flatSectionJlsTDS); flatSectionJls.UpdateDirect(countryId, provinceId, countyId, cityId, projectId, companyId); DB.CommitTransaction(); flatSectionJlsTDS.AcceptChanges(); // Store datasets Session["flatSectionJlsTDS"] = flatSectionJlsTDS; } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
private void Save() { Page.Validate(); if (Page.IsValid) { FlatSectionJls flatSectionJls = new FlatSectionJls(flatSectionJlsTDS); // Update flatSectionJlsTDS foreach (GridViewRow row in grdvJls.Rows) { // ... Get standard fields int workId = int.Parse(((HiddenField)row.FindControl("hdfWorkID")).Value); string street = ""; if (((TextBox)row.FindControl("tbxStreet")).Text.Trim() != "") street = ((TextBox)row.FindControl("tbxStreet")).Text.Trim(); string usmhId = ""; if (((TextBox)row.FindControl("tbxUSMH")).Text.Trim() != "") usmhId = ((TextBox)row.FindControl("tbxUSMH")).Text.Trim(); string dsmhId = ""; if (((TextBox)row.FindControl("tbxDSMH")).Text.Trim() != "") dsmhId = ((TextBox)row.FindControl("tbxDSMH")).Text.Trim(); string size_ = ""; if (((TextBox)row.FindControl("tbxSize_")).Text.Trim() != "") size_ = ((TextBox)row.FindControl("tbxSize_")).Text.Trim(); string length = ""; if (((TextBox)row.FindControl("tbxLength")).Text.Trim() != "") length = ((TextBox)row.FindControl("tbxLength")).Text.Trim(); string subArea = ""; if (((TextBox)row.FindControl("tbxSubArea")).Text.Trim() != "") subArea = ((TextBox)row.FindControl("tbxSubArea")).Text.Trim(); string trafficControl = ""; if (((DropDownList)row.FindControl("ddlTrafficControl")).SelectedValue != " ") trafficControl = ((DropDownList)row.FindControl("ddlTrafficControl")).SelectedValue; string trafficControlDetails = ""; if (((TextBox)row.FindControl("tbxTrafficControlDetails")).Text.Trim() != "") trafficControlDetails = ((TextBox)row.FindControl("tbxTrafficControlDetails")).Text.Trim(); bool standardBypass = ((CheckBox)row.FindControl("cbxStandardBypass")).Checked; string standardBypassComments = ""; if (((TextBox)row.FindControl("tbxStandardBypassComments")).Text.Trim() != "") standardBypassComments = ((TextBox)row.FindControl("tbxStandardBypassComments")).Text.Trim(); // ... Update row flatSectionJls.Update(workId, street, usmhId, dsmhId, size_, length, subArea, trafficControl, trafficControlDetails, standardBypass, standardBypassComments); } // Store datasets Session["flatSectionJlsTDS"] = flatSectionJlsTDS; // Update database UpdateDatabase(); ViewState["update"] = "yes"; // Redirect string url = ""; if (Request.QueryString["source_page"] == "jls_navigator2.aspx") { url = "./jls_navigator2.aspx?source_page=flat_section_jls_edit.aspx&client_id=" + hdfCurrentClientId.Value + "&project_id=" + hdfCurrentProjectId.Value + GetNavigatorState() + "&update=yes"; } if (Request.QueryString["source_page"] == "flat_section_jls_summary.aspx") { url = "./flat_section_jls_summary.aspx?source_page=flat_section_jls_edit.aspx&client_id=" + hdfCurrentClientId.Value + "&project_id=" + hdfCurrentProjectId.Value + GetNavigatorState() + "&update=yes"; } Response.Redirect(url); } }
private void Apply() { Page.Validate(); if (Page.IsValid) { FlatSectionJls flatSectionJls = new FlatSectionJls(flatSectionJlsTDS); // Update flatSectionJlsTDS foreach (GridViewRow row in grdvJls.Rows) { // ... Get standard fields int workId = int.Parse(((HiddenField)row.FindControl("hdfWorkID")).Value); string street = ""; if (((TextBox)row.FindControl("tbxStreet")).Text.Trim() != "") street = ((TextBox)row.FindControl("tbxStreet")).Text.Trim(); string usmhId = ""; if (((TextBox)row.FindControl("tbxUSMH")).Text.Trim() != "") usmhId = ((TextBox)row.FindControl("tbxUSMH")).Text.Trim(); string dsmhId = ""; if (((TextBox)row.FindControl("tbxDSMH")).Text.Trim() != "") dsmhId = ((TextBox)row.FindControl("tbxDSMH")).Text.Trim(); string size_ = ""; if (((TextBox)row.FindControl("tbxSize_")).Text.Trim() != "") size_ = ((TextBox)row.FindControl("tbxSize_")).Text.Trim(); string length = ""; if (((TextBox)row.FindControl("tbxLength")).Text.Trim() != "") length = ((TextBox)row.FindControl("tbxLength")).Text.Trim(); string subArea = ""; if (((TextBox)row.FindControl("tbxSubArea")).Text.Trim() != "") subArea = ((TextBox)row.FindControl("tbxSubArea")).Text.Trim(); string trafficControl = ""; if (((DropDownList)row.FindControl("ddlTrafficControl")).SelectedValue != " ") trafficControl = ((DropDownList)row.FindControl("ddlTrafficControl")).SelectedValue; string trafficControlDetails = ""; if (((TextBox)row.FindControl("tbxTrafficControlDetails")).Text.Trim() != "") trafficControlDetails = ((TextBox)row.FindControl("tbxTrafficControlDetails")).Text.Trim(); bool standardBypass = ((CheckBox)row.FindControl("cbxStandardBypass")).Checked; string standardBypassComments = ""; if (((TextBox)row.FindControl("tbxStandardBypassComments")).Text.Trim() != "") standardBypassComments = ((TextBox)row.FindControl("tbxStandardBypassComments")).Text.Trim(); // ... Update row flatSectionJls.Update(workId, street, usmhId, dsmhId, size_, length, subArea, trafficControl, trafficControlDetails, standardBypass, standardBypassComments); } // Store datasets Session["flatSectionJlsTDS"] = flatSectionJlsTDS; // Update database UpdateDatabase(); ViewState["update"] = "yes"; } }