public static void ddlPositionPopulate(DropDownList ddl, string sValue, bool bShowSelect) { if (ddl != null) { using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { ddl.DataTextField = "PositionName"; ddl.DataValueField = "PositionCode"; ddl.DataSource = wac.list_positionWACs.OrderBy(o => o.position).Select(s => new { PositionCode = s.pk_positionWAC_code, PositionName = s.position });; ddl.DataBind(); if (bShowSelect) { ddl.Items.Insert(0, new ListItem("[SELECT]", "")); } try { if (!string.IsNullOrEmpty(sValue)) { ddl.SelectedValue = sValue; } } catch { } } } }
//private void HandleSupplementalAgreementsBasedOnFarm(int iPK_FarmBusiness, int? iPK_SupplementalAgreementTaxParcel) private void HandleSupplementalAgreementsBasedOnFarm(int?iPK_SupplementalAgreementTaxParcel) { Panel pnlSA_Available = fvBMPPlanning.FindControl("pnlSA_Available") as Panel; Panel pnlSA_Message = fvBMPPlanning.FindControl("pnlSA_Message") as Panel; Label lblSA_Message = fvBMPPlanning.FindControl("lblSA_Message") as Label; DropDownList ddlSAA = fvBMPPlanning.FindControl("ddlSAA") as DropDownList; DropDownList ddlSA = fvBMPPlanning.FindControl("ddlSA") as DropDownList; using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { //var a = wac.bmp_ag_SAs.Where(w => w.bmp_ag.fk_farmBusiness == iPK_FarmBusiness).Select(s => s.pk_bmp_ag_SA); //if (a.Count() > 0) //{ //if (fvBMPPlanning.CurrentMode == FormViewMode.Insert) WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_SupplementalAgreementTaxParcel(ddlSA, iPK_FarmBusiness, null, true); //else WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_SupplementalAgreementTaxParcel(ddlSA, iPK_FarmBusiness, iPK_SupplementalAgreementTaxParcel, true); if (fvBMPPlanning.CurrentMode == FormViewMode.Insert) { WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_SupplementalAgreementTaxParcel(ddlSA, null, true); } else { WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_SupplementalAgreementTaxParcel(ddlSA, iPK_SupplementalAgreementTaxParcel, true); } pnlSA_Message.Visible = false; pnlSA_Available.Visible = true; //} //else //{ // lblSA_Message.Text = "No Supplemental Agreements have been assigned to this farm"; // pnlSA_Available.Visible = false; // pnlSA_Message.Visible = true; //} } }
protected void ddlInsert_SelectedIndexChanged(object sender, EventArgs e) { if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "I", "GlobalData", "GlobalData", "msgInsert")) { if (!string.IsNullOrEmpty(ddlInsert.SelectedValue)) { int?i = null; int iCode = 0; try { using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { iCode = wac.participantType_add(Convert.ToInt32(hfPK_Participant.Value), ddlInsert.SelectedValue, Session["userName"].ToString(), ref i); if (iCode == 0) { object[] oArgs = new object[] { Convert.ToInt32(hfPK_Participant.Value) }; Page.GetType().InvokeMember("InvokedMethod_ControlGroup_RebindRecord", System.Reflection.BindingFlags.InvokeMethod, null, this.Page, oArgs); } else { WACAlert.Show("Error Returned from Database.", iCode); } } } catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); } } } }
private void PopulateFilter_AgreementNumber() { using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { string sAgreementNumber = null; if (!string.IsNullOrEmpty(ddlFilter_AgreementNumber.SelectedValue)) { sAgreementNumber = ddlFilter_AgreementNumber.SelectedValue; } var a = wDataContext.supplementalAgreements.Select(s => s); if (!string.IsNullOrEmpty(ddlFilter_TaxParcelID.SelectedValue)) { a = a.Where(w => w.supplementalAgreementTaxParcels.First(f => f.taxParcel.taxParcelID == ddlFilter_TaxParcelID.SelectedValue).taxParcel.taxParcelID == ddlFilter_TaxParcelID.SelectedValue); } if (!string.IsNullOrEmpty(ddlFilter_TaxParcelOwner.SelectedValue)) { a = a.Where(w => w.supplementalAgreementTaxParcels.First(f => f.taxParcel.ownerStr_dnd == ddlFilter_TaxParcelOwner.SelectedValue).taxParcel.ownerStr_dnd == ddlFilter_TaxParcelOwner.SelectedValue); } var b = a.GroupBy(g => g.agreement_nbr_ro).OrderBy(o => o.Key).Select(s => s.Key); ddlFilter_AgreementNumber.Items.Clear(); ddlFilter_AgreementNumber.DataSource = b; ddlFilter_AgreementNumber.DataBind(); ddlFilter_AgreementNumber.Items.Insert(0, new ListItem("[SELECT ALL]", "")); if (!string.IsNullOrEmpty(sAgreementNumber)) { try { ddlFilter_AgreementNumber.SelectedValue = sAgreementNumber; } catch { } } } }
private void BindAg_WFP3_Bid() { FormView fv = fvAg_WFP3_Bid; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { var a = from b in wDataContext.form_wfp3_bids.Where(w => w.pk_form_wfp3_bid == PK_Wfp3Bid) select b; fv.DataKeyNames = new string[] { "pk_form_wfp3_bid" }; fv.DataSource = a; fv.DataBind(); string sRegionWAC = WACGlobal_Methods.SpecialQuery_Agriculture_GetWACRegion_ByFarmBusinessPK(FK_FarmBusiness); if (fv.CurrentMode == FormViewMode.Insert) { WACGlobal_Methods.PopulateControl_Participant_DBView_DDL(fv.FindControl("ddlContractor") as DropDownList, null, new string[] { "C" }, null, null, new string[] { sRegionWAC }, null, null, null, false, false, false, false, false, false, WACGlobal_Methods.Enum_Participant_Forms.ALL, true); } if (fv.CurrentMode == FormViewMode.Edit) { WACGlobal_Methods.PopulateControl_Participant_DBView_DDL(fv.FindControl("ddlContractor") as DropDownList, a.Single().fk_participant_contractor, new string[] { "C" }, null, null, new string[] { sRegionWAC }, null, null, null, false, false, false, false, false, false, WACGlobal_Methods.Enum_Participant_Forms.ALL, true); } } }
protected void fvSA_ItemUpdating(object sender, FormViewUpdateEventArgs e) { StringBuilder sb = new StringBuilder(); //Calendar calAgreementDate = fvSA.FindControl("UC_EditCalendar_SA_AgreementDate").FindControl("cal") as Calendar; //Calendar calInactiveDate = fvSA.FindControl("UC_EditCalendar_SA_InactiveDate").FindControl("cal") as Calendar; CustomControls_AjaxCalendar tbCalAgreementDate = (CustomControls_AjaxCalendar)fvSA.FindControl("tbCalAgreementDate"); CustomControls_AjaxCalendar tbCalInactiveDate = (CustomControls_AjaxCalendar)fvSA.FindControl("tbCalInactiveDate"); using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { var a = wDataContext.supplementalAgreements.Where(w => w.pk_supplementalAgreement == Convert.ToInt32(fvSA.DataKey.Value)).Select(s => s).Single(); try { a.agreement_date = tbCalAgreementDate.CalDateNotNullable; //if (calInactiveDate.SelectedDate.Year > 1900) a.inactive_date = calInactiveDate.SelectedDate; //else a.inactive_date = null; a.inactive_date = tbCalInactiveDate.CalDateNullable; a.modified = DateTime.Now; a.modified_by = Session["userName"].ToString(); wDataContext.SubmitChanges(); fvSA.ChangeMode(FormViewMode.ReadOnly); Populate_SA_FormView(Convert.ToInt32(fvSA.DataKey.Value)); if (!string.IsNullOrEmpty(sb.ToString())) { WACAlert.Show(sb.ToString(), 0); } } catch (Exception ex) { WACAlert.Show(ex.Message, 0); } } }
protected void fvSA_Note_ItemUpdating(object sender, FormViewUpdateEventArgs e) { StringBuilder sb = new StringBuilder(); FormView fv = fvSA.FindControl("fvSA_Note") as FormView; TextBox tbNote = fv.FindControl("tbNote") as TextBox; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { var a = wDataContext.supplementalAgreementNotes.Where(w => w.pk_supplementalAgreementNote == Convert.ToInt32(fv.DataKey.Value)).Select(s => s).Single(); try { a.note = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 255); a.modified = DateTime.Now; a.modified_by = Session["userName"].ToString(); wDataContext.SubmitChanges(); fv.ChangeMode(FormViewMode.ReadOnly); Populate_SA_Note_FormView(fv, Convert.ToInt32(fv.DataKey.Value)); if (!string.IsNullOrEmpty(sb.ToString())) { WACAlert.Show(sb.ToString(), 0); } } catch (Exception ex) { WACAlert.Show(ex.Message, 0); } } }
public override IList GetFilteredList(List <WACParameter> parms) { try { using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { int pk_participant = WACGlobal_Methods.KeyAsInt(WACParameter.GetPrimaryKey(parms).ParmValue); var e = wac.participants.Where(w => w.pk_participant == pk_participant).Select(s => new Participant(s.pk_participant, s.lname, s.fname, s.email, s.fk_gender_code, s.list_gender.gender, s.fk_ethnicity_code, s.list_ethnicity.ethnicity, s.fk_race_code, s.list_race.race, s.fk_diversityData_code, s.list_diversityData.dataSetVia, s.fk_mailingStatus_code, s.list_mailingStatus.status, s.fk_property, s.fk_organization, s.organization.org, s.active, s.form_W9_signed_date, s.fk_regionWAC_code, s.list_regionWAC.regionWAC, s.fk_prefix_code, s.list_prefix.prefix, s.mname, s.nickname, s.fk_suffix_code, s.list_suffix.suffix, s.fullname_LF_dnd, s.fullname_FL_dnd, s.web, s.fk_dataReview_code, s.dataReview_note, s.fk_participant_split)); if (e.Any()) { return(e.ToList <Participant>()); } else { return(new List <Participant>()); } } } catch (Exception ex) { throw new WACEX_GeneralDatabaseException("Error loading Participant. " + ex.Message, -1); } }
protected void fvAg_WFP3_Technician_ItemUpdating(object sender, FormViewUpdateEventArgs e) { StringBuilder sb = new StringBuilder(); DropDownList ddlAg_WFP3_Technician_Type = fvAg_WFP3_Technician.FindControl("ddlAg_WFP3_Technician_Type") as DropDownList; DropDownList ddlTechnician = fvAg_WFP3_Technician.FindControl("ddlTechnician") as DropDownList; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { var a = wDataContext.form_wfp3_teches.Where(w => w.pk_form_wfp3_tech == PK_Wfp3Tech).Select(s => s).Single(); try { if (!string.IsNullOrEmpty(ddlAg_WFP3_Technician_Type.SelectedValue) && !string.IsNullOrEmpty(ddlTechnician.SelectedValue)) { a.fk_designerEngineerType_code = ddlAg_WFP3_Technician_Type.SelectedValue; a.fk_list_designerEngineer = Convert.ToInt32(ddlTechnician.SelectedValue); } else { sb.Append("Type and Technician were not updated. Type and Technician are required. "); } a.modified = DateTime.Now; a.modified_by = Session["userName"].ToString(); wDataContext.SubmitChanges(); if (!string.IsNullOrEmpty(sb.ToString())) { WACAlert.Show(sb.ToString(), 0); } } catch (Exception ex) { WACAlert.Show(ex.Message, 0); } } }
public override IList <DDLListItem> GetList(List <WACParameter> parms) { string _swis = (string)WACParameter.GetParameterValue(parms, "swis"); bool newTPOnly = (bool)WACParameter.GetParameterValue(parms, "NewTaxParcelsOnly"); using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { //var c = wac.vw_taxParcel_DEP_alls.Where(w => w.swis == _swis).Distinct((x, y) => x.SBL == y.SBL).OrderBy(o => o.PRINT_KEY). // Select(s => new DDLListItem(s.SBL, s.PRINT_KEY)); //return c.ToList(); var c = wac.vw_taxParcel_DEP_alls.Where(w => w.SWIS == _swis).Distinct((x, y) => x.SBL == y.SBL).OrderBy(o => o.PRINT_KEY). Select(s => new DDLListItem(s.SBL, s.PRINT_KEY)); var d = wac.taxParcels.Where(w => w.fk_list_swis == _swis).Distinct((x, y) => x.SBL == y.SBL).OrderBy(o => o.taxParcelID). Select(s => new DDLListItem(s.SBL, s.taxParcelID)); if (newTPOnly) { var minus = c.ToList().Except(d.ToList(), new DDLListItemComparer()); return(minus.OrderBy(o => o.DataTextField).ToList()); } else { var union = c.ToList().Union(d.ToList(), new DDLListItemComparer()). Distinct((x, y) => x.DataValueField == y.DataValueField); return(union.OrderBy(o => o.DataTextField).ToList()); } } }
public void BindOrganization(int i) { using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { var a = wDataContext.organizations.Where(w => w.pk_organization == i).Select(s => s); fvOrganization.DataKeyNames = new string[] { "pk_organization" }; fvOrganization.DataSource = a; fvOrganization.DataBind(); if (fvOrganization.CurrentMode != FormViewMode.Insert) { hfOrganizationPK.Value = a.Single().pk_organization.ToString(); } if (fvOrganization.CurrentMode == FormViewMode.Edit) { DropDownList ddl = fvOrganization.FindControl("UC_DropDownListByAlphabet_Organization").FindControl("ddl") as DropDownList; Label lbl = fvOrganization.FindControl("UC_DropDownListByAlphabet_Organization").FindControl("lblLetter") as Label; string sLetter = null; try { sLetter = a.Single().participant.lname[0].ToString(); } catch { } WACGlobal_Methods.EventControl_Custom_DropDownListByAlphabet(ddl, lbl, sLetter, "PARTICIPANT", "ALL", a.Single().fk_participant_contact); WACGlobal_Methods.PopulateControl_Property_EditInsert_UserControl(fvOrganization.FindControl("UC_Property_EditInsert_Organization") as UserControl, a.Single().property); } } }
protected void lbVenue_EventVenueType_Delete_Click(object sender, EventArgs e) { if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "D", "GlobalData", "GlobalData", "msgDelete")) { LinkButton lb = (LinkButton)sender; int i = Convert.ToInt32(lb.CommandArgument); int iCode = 0; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { try { iCode = wDataContext.eventVenueType_delete(i); if (iCode == 0) { BindVenue(Convert.ToInt32(fvVenue.DataKey.Value)); } else { WACAlert.Show("Error Returned from Database.", iCode); } } catch (Exception ex) { WACAlert.Show(ex.Message, 0); } } } }
protected void ddlVenue_EventVenueType_Add_SelectedIndexChanged(object sender, EventArgs e) { if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "I", "GlobalData", "GlobalData", "msgInsert")) { DropDownList ddl = (DropDownList)sender; if (!string.IsNullOrEmpty(ddl.SelectedValue)) { int?i = null; int iCode = 0; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { try { iCode = wDataContext.eventVenueType_add(Convert.ToInt32(fvVenue.DataKey.Value), ddl.SelectedValue, ref i); if (iCode == 0) { BindVenue(Convert.ToInt32(fvVenue.DataKey.Value)); } else { WACAlert.Show("Error Returned from Database.", iCode); } } catch (Exception ex) { WACAlert.Show(ex.Message, 0); } } } } }
public IList <DDLListItem> GetParticipantTypeList(List <WACParameter> parms, object item) { try { IList <DDLListItem> _items; using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { var c = wac.list_participantTypes.Select(s => new DDLListItem(s.pk_participantType_code, s.participantType)); _items = c.ToList(); string selectedValue = null; if (item != null) { selectedValue = ((ParticipantType)item).fk_participantType_code; } if (!string.IsNullOrEmpty(selectedValue)) { foreach (DDLListItem ddls in _items) { if (selectedValue.Contains(ddls.DataValueField)) { ddls.SelectedValue = true; break; } } } return(_items); } } catch (Exception ex) { throw new WACEX_GeneralDatabaseException("Error loading Participant Type list. " + ex.Message, -1); } }
private void BindCountyDDL(string selected) { DropDownList ddl = ddlCounty; if (ddl != null) { if (!TaxParcelCountyBound) { using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { var c = wac.taxParcels.Where(w => w.list_swi.county != "" && w.list_swi.county != "unknown" && w.list_swi.county != "n/a"). Select(s => new { s.list_swi.county }).Distinct().OrderBy("county", false); ddl.Items.Insert(0, new ListItem("[SELECT]", "")); foreach (var county in c) { ddl.Items.Add(new ListItem(county.county, county.county)); } TaxParcelCountyBound = true; } } try { if (!string.IsNullOrEmpty(selected)) { ddl.SelectedValue = selected; } } catch { } } }
public override IList GetFilteredList(List <WACParameter> parms) { try { using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { int pk_participantCommunication = WACGlobal_Methods.KeyAsInt(WACParameter.GetSelectedKey(parms).ParmValue); var e = wac.participantCommunications.Where(w => w.pk_participantCommunication == pk_participantCommunication).Select(s => new ParticipantCommunication(s.pk_participantCommunication, s.fk_participant, s.fk_communication, s.fk_communicationType_code, s.fk_communicationUsage_code, s.fk_organization, s.extension, s.note, s.source, s.created, s.created_by, s.modified, s.modified_by)); if (e.Any()) { return(e.ToList <ParticipantCommunication>()); } else { return(new List <ParticipantCommunication>()); } } } catch (Exception ex) { throw new WACEX_GeneralDatabaseException("Error loading ParticipantCommunication. " + ex.Message, -1); } }
private void Populate_GridView() { using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { var a = wDataContext.supplementalAgreements.OrderBy(o => o.agreement_nbr_ro).ThenByDescending(o => o.agreement_date).Select(s => s); if (!string.IsNullOrEmpty(ddlFilter_AgreementNumber.SelectedValue)) { a = a.Where(w => w.agreement_nbr_ro == ddlFilter_AgreementNumber.SelectedValue); } if (!string.IsNullOrEmpty(ddlFilter_TaxParcelID.SelectedValue)) { a = a.Where(w => w.supplementalAgreementTaxParcels.First(f => f.taxParcel.taxParcelID == ddlFilter_TaxParcelID.SelectedValue).taxParcel.taxParcelID == ddlFilter_TaxParcelID.SelectedValue); } if (!string.IsNullOrEmpty(ddlFilter_TaxParcelOwner.SelectedValue)) { a = a.Where(w => w.supplementalAgreementTaxParcels.First(f => f.taxParcel.ownerStr_dnd == ddlFilter_TaxParcelOwner.SelectedValue).taxParcel.ownerStr_dnd == ddlFilter_TaxParcelOwner.SelectedValue); } if (!string.IsNullOrEmpty(Session["orderAg_SA"].ToString())) { a = a.OrderBy(Session["orderAg_SA"].ToString(), null); } gv.DataKeyNames = new string[] { "pk_supplementalAgreement" }; gv.DataSource = a; gv.DataBind(); if (ViewState["SelectedValue"] != null) { string sSelectedValue = (string)ViewState["SelectedValue"]; foreach (GridViewRow gvr in gv.Rows) { string sKeyValue = gv.DataKeys[gvr.RowIndex].Value.ToString(); if (sKeyValue == sSelectedValue) { gv.SelectedIndex = gvr.RowIndex; return; } else { gv.SelectedIndex = -1; } } } lblCount.Text = "Records: " + a.Count(); if (gv.Rows.Count == 1) { gv.SelectedIndex = 0; gv.SelectedRowStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFAA"); fvSA.ChangeMode(FormViewMode.ReadOnly); Populate_SA_FormView(Convert.ToInt32(gv.SelectedDataKey.Value)); if (gv.SelectedIndex != -1) { ViewState["SelectedValueAgs"] = gv.SelectedValue.ToString(); } } } }
protected void fvOrganization_ItemInserting(object sender, FormViewInsertEventArgs e) { int?i = null; int iCode = 0; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { TextBox tbOrg = fvOrganization.FindControl("tbOrg") as TextBox; try { string sOrg = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbOrg.Text, 96).Trim(); iCode = wDataContext.organization_add(sOrg, Session["userName"].ToString(), ref i); if (iCode == 0) { fvOrganization.ChangeMode(FormViewMode.ReadOnly); BindOrganization(Convert.ToInt32(i)); } else { WACAlert.Show("Error Returned from Database.", iCode); } } catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); } } }
private void Populate_SA_FormView(int i) { using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { var a = wDataContext.supplementalAgreements.Where(w => w.pk_supplementalAgreement == i).Select(s => s); fvSA.DataKeyNames = new string[] { "pk_supplementalAgreement" }; fvSA.DataSource = a; fvSA.DataBind(); if (fvSA.CurrentMode == FormViewMode.ReadOnly && a.Count() == 1) { ListView lvSA_Activity = fvSA.FindControl("lvSA_Activity") as ListView; lvSA_Activity.DataSource = wDataContext.supplementalAgreement_get_activity(i).OrderBy(o => o.farmID).ThenBy(o => o.Revision); lvSA_Activity.DataBind(); } //if (fvSA.CurrentMode == FormViewMode.Insert) //{ // WACGlobal_Methods.PopulateControl_Generic_CalendarAndDDL(fvSA, "UC_EditCalendar_SA_AgreementDate", WACGlobal_Methods.SpecialDataType_DateTime_Today(), null); //} //if (fvSA.CurrentMode == FormViewMode.Edit) //{ // WACGlobal_Methods.PopulateControl_Generic_CalendarAndDDL(fvSA, "UC_EditCalendar_SA_AgreementDate", a.Single().agreement_date, null); // WACGlobal_Methods.PopulateControl_Generic_CalendarAndDDL(fvSA, "UC_EditCalendar_SA_InactiveDate", a.Single().inactive_date, null); //} } }
protected void fvOrganization_Note_ItemDeleting(object sender, FormViewDeleteEventArgs e) { //if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "D", "GlobalData", "GlobalData", "msgDelete")) //{ int iCode = 0; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { try { if (WACGlobal_Methods.Security_UserCanModifyDeleteNote(Session["userName"], "organizationNote", Convert.ToInt32(fvOrganization_Note.DataKey.Value))) { iCode = wDataContext.organizationNote_delete(Convert.ToInt32(fvOrganization_Note.DataKey.Value), Session["userName"].ToString()); if (iCode == 0) { lbOrganization_Note_Close_Click(null, null); } else { WACAlert.Show("Error Returned from Database.", iCode); } } } catch (Exception ex) { WACAlert.Show(ex.Message, 0); } } //} }
protected void fvSA_Note_ItemDeleting(object sender, FormViewDeleteEventArgs e) { FormView fv = fvSA.FindControl("fvSA_Note") as FormView; if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "D", "A", "supplementalAgreementNote", "msgDelete")) { int iCode = 0; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { try { iCode = wDataContext.supplementalAgreementNote_delete(Convert.ToInt32(fv.DataKey.Value), Session["userName"].ToString()); if (iCode == 0) { lbSA_Note_Close_Click(null, null); } else { WACAlert.Show("Error Returned from Database.", iCode); } } catch (Exception ex) { WACAlert.Show(ex.Message, 0); } } } }
private void BindParticipant_Property(int i) { using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { var a = from b in wDataContext.participantProperties.Where(w => w.pk_participantProperty == i) select b; fvParticipant_Property.DataKeyNames = new string[] { "pk_participantProperty" }; fvParticipant_Property.DataSource = a; fvParticipant_Property.DataBind(); if (fvParticipant_Property.CurrentMode == FormViewMode.Insert) { DropDownList ddlZipCode = (DropDownList)fvParticipant_Property.FindControl("ddlZipCode"); WACGlobal_Methods.ZipCodesFromExistingAddresses(ddlZipCode); } if (fvParticipant_Property.CurrentMode == FormViewMode.Edit) { WACGlobal_Methods.PopulateControl_Property_EditInsert_UserControl(fvParticipant_Property.FindControl("UC_Property_EditInsert_Participant_Property") as UserControl, a.Single().property); //WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fvParticipant_Property, "ddlMaster", a.Single().master, false); //DropDownList ddl = fvParticipant_Property.FindControl("UC_DropDownListByAlphabet_Participant_Property").FindControl("ddl") as DropDownList; //Label lblLetter = fvParticipant_Property.FindControl("UC_DropDownListByAlphabet_Participant_Property").FindControl("lblLetter") as Label; //string sLetter = null; //try { sLetter = a.Single().participant1.lname.Substring(0, 1); } //catch { } //WACGlobal_Methods.EventControl_Custom_DropDownListByAlphabet(ddl, lblLetter, sLetter, "PARTICIPANT", "ALL", a.Single().fk_participant_cc); } } }
private void BindAg_WFP3_PaymentBMP() { FormView fv = fvAg_WFP3_PaymentBMP; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { var a = from b in wDataContext.form_wfp3_paymentBMPs.Where(w => w.pk_form_wfp3_paymentBMP == PK_Wfp3PaymentBMP) select b; fv.DataKeyNames = new string[] { "pk_form_wfp3_paymentBMP" }; fv.DataSource = a; fv.DataBind(); if (fv.CurrentMode == FormViewMode.Insert) { WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_ByWFP3BMP_DDL(fv, "ddlBMP", Convert.ToInt32(FK_Wfp3), null); WACGlobal_Methods.PopulateControl_DatabaseLists_PaymentStatus_DDL(fv.FindControl("ddlPaymentStatus") as DropDownList, null, true); WACGlobal_Methods.PopulateControl_DatabaseLists_AgencyFunding_DDL(fv.FindControl("ddlFundingAgency") as DropDownList, null, "Y", null, true); WACGlobal_Methods.PopulateControl_Custom_Agriculture_WFP3PaymentBMP_ByWFP3Specification_DDL(fv.FindControl("ddlBMPPractice") as DropDownList, Convert.ToInt32(FK_Wfp3), null, true, true); WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fv, "ddlReimbursementYN", "N", true); } if (fv.CurrentMode == FormViewMode.Edit) { decimal?bmp = a.Any() ? a.Single().fk_bmpPractice_code : null; WACGlobal_Methods.PopulateControl_DatabaseLists_PaymentStatus_DDL(fv.FindControl("ddlPaymentStatus") as DropDownList, a.Single().fk_paymentStatus_code, true); WACGlobal_Methods.PopulateControl_DatabaseLists_AgencyFunding_DDL(fv.FindControl("ddlFundingAgency") as DropDownList, null, "Y", a.Single().fk_agencyFunding_code, true); //WACGlobal_Methods.PopulateControl_Custom_Agriculture_WFP3PaymentBMP_ByWFP3Specification_DDL(fv.FindControl("ddlBMPPractice") as DropDownList, Convert.ToInt32(FK_Wfp3), null, true, true); //WACGlobal_Methods.PopulateControl_Custom_Agriculture_WFP3PaymentBMP_ByWFP3Specification_DDL(fv.FindControl("ddlBMPPractice") as DropDownList, Convert.ToInt32(FK_Wfp3), a.Single().fk_bmpPractice_code, true, true); WACGlobal_Methods.PopulateControl_DatabaseLists_BMPPractice_DDL((DropDownList)fv.FindControl("ddlBMPPractice"), bmp, true, true, false); DropDownList ddlReimbursementYN = fv.FindControl("ddlReimbursementYN") as DropDownList; WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fv.FindControl("ddlReimbursementYN") as DropDownList, a.Single().reimbursement, true); } } }
private void BindAg_WFP3_Specification() { FormView fv = fvAg_WFP3_Specification; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { var a = wDataContext.form_wfp3_specifications.Where(w => w.pk_form_wfp3_specification == PK_Wfp3Spec).Select(s => s); fv.DataKeyNames = new string[] { "pk_form_wfp3_specification" }; fv.DataSource = a; fv.DataBind(); if (fv.CurrentMode == FormViewMode.Insert) { WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_ByWFP3BMP_DDL(fv, "ddlBMP", FK_Wfp3, null); WACGlobal_Methods.PopulateControl_DatabaseLists_BMPPractice_DDL(fv.FindControl("ddlPractice") as DropDownList, null, true, true, false); WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fv.FindControl("ddlBidRequired") as DropDownList, null, true); } if (fv.CurrentMode == FormViewMode.Edit) { WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_ByWFP3BMP_DDL(fv, "ddlBMP", FK_Wfp3, a.Single().fk_form_wfp3_bmp); WACGlobal_Methods.PopulateControl_DatabaseLists_BMPPractice_DDL(fv.FindControl("ddlPractice") as DropDownList, a.Single().fk_bmpPractice_code, true, true, false); WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fv.FindControl("ddlBidRequired") as DropDownList, a.Single().bid_reqd, true); } } }
private void BindAg_WFP3_BMP() { FormView fv = fvAg_WFP3_BMP; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { var a = wDataContext.vw_form_wfp3_BMPs.Where(w => w.pk_form_wfp3_bmp == PK_Wfp3Bmp).Select(s => s); fv.DataKeyNames = new string[] { "pk_form_wfp3_bmp" }; fv.DataSource = a; fv.DataBind(); if (fv.CurrentMode == FormViewMode.Insert) { // JWJ 9/17/2012 changes parameter 3 from { 0,1 } to { 0 } re: BA934 WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_ByFarmBusiness_DDL(fv.FindControl("ddlBMP") as DropDownList, Convert.ToInt32(FK_FarmBusiness), null, new int?[] { 0 }, true); } if (fv.CurrentMode == FormViewMode.Edit) { // JWJ 9/17/2012 changes parameter 3 from { 0,1 } to { 0 } re: BA934 WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_ByFarmBusiness_DDL(fv.FindControl("ddlBMP") as DropDownList, Convert.ToInt32(FK_FarmBusiness), a.Single().pk_bmp_ag, new int?[] { 0 }, true); //var b = wDataContext.bmp_ags.Where(w => w.pk_bmp_ag == a.Single().pk_bmp_ag).Select(s => s); WACGlobal_Methods.PopulateControl_Custom_Agriculture_Units_By_BMPPractice(a.Single().fk_bmpPractice_code, fv.FindControl("lblAg_WFP3_BMP_Units") as Label); } } }
public void ddlPhonePopulate(DropDownList ddl, string selectedValue, bool bShowSelect) { if (ddl != null) { using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { ddl.DataTextField = "number"; ddl.DataValueField = "pk_communication"; ddl.DataSource = wac.vw_participantWAC_phone_eligibles.Where(w => w.pk_participantWAC == FK_ParticipantWAC).Select(s => new { number = s.PhoneFormattedHR, pk_communication = s.pk_communication }); ddl.DataBind(); if (bShowSelect) { ddl.Items.Insert(0, new ListItem("[SELECT]", "")); } try { if (!string.IsNullOrEmpty(selectedValue)) { ddl.SelectedValue = selectedValue; } } catch { } } } }
protected void lbBMPPlanning_ImplementationYears_Delete_Click(object sender, EventArgs e) { bool b = WACGlobal_Methods.Security_UserObjectCustom(Session["userID"], WACGlobal_Methods.Enum_Security_UserObjectCustom.A_PLAN); if (b) { LinkButton lb = (LinkButton)sender; int iCode = 0; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { try { iCode = wDataContext.bmp_ag_implementation_delete(Convert.ToInt32(lb.CommandArgument), Session["userName"].ToString()); if (iCode == 0) { BindData_BMPPlanning_FormView(Convert.ToInt32(fvBMPPlanning.DataKey.Value)); } else { WACAlert.Show("Error Returned from Database.", iCode); } } catch (Exception ex) { WACAlert.Show(ex.Message, 0); } } } else { WACAlert.Show("You do not have permission to insert into the BMP Planning Implementation Year table.", 0); } }
private void SetupViewer_Generic(int iPK1, int iPK2, string sSectorCode) { try { using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { StringBuilder sb = new StringBuilder(); var a = from b in wDataContext.documentArchives.Where(w => w.PK_1 == iPK1 && w.PK_2 == iPK2 && w.list_participantTypeSectorFolder.fk_participantTypeSector_code == sSectorCode).OrderBy(o => o.fk_participantTypeSectorFolder_code) select b; lb.Text = "[+] Documents (" + a.Count() + ")"; sb.Append("<table cellpadding='5' rules='cols'>"); sb.Append("<tr valign='top'>"); sb.Append("<td class='B U'>File Type</td>"); sb.Append("<td class='B U'>File Link</td>"); sb.Append("</tr>"); foreach (var c in a) { sb.Append("<tr valign='top'>"); sb.Append("<td>" + c.list_participantTypeSectorFolder.folder + "</td>"); sb.Append("<td>" + GetEncodedALink(c.filename_actual, c.filename_display) + "</td>"); //sb.Append("<td><a href='WACDocumentDownload.aspx?pk=" + c.pk_documentArchive + "' target='_blank'>" + c.filename_display + "</a></td>"); sb.Append("</tr>"); } sb.Append("</table>"); lbl.Text = sb.ToString(); } } catch (Exception ex) { DisplayErrorMessage(ex.Message); } }
protected void lbDelete_Click(object sender, EventArgs e) { LinkButton lb = (LinkButton)sender; if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "D", "GlobalData", "GlobalData", "msgDelete")) { int iCode = 0; using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext()) { try { iCode = wDataContext.participantType_delete(Convert.ToInt32(lb.CommandArgument), Session["userName"].ToString()); if (iCode == 0) { object[] oArgs = new object[] { Convert.ToInt32(hfPK_Participant.Value) }; Page.GetType().InvokeMember("InvokedMethod_ControlGroup_RebindRecord", System.Reflection.BindingFlags.InvokeMethod, null, this.Page, oArgs); } else { WACAlert.Show("Error Returned from Database.", iCode); } } catch (Exception ex) { WACAlert.Show(ex.Message, 0); } } } }
public void fvHR_WACEmployee_Position_ItemDeleting(object sender, EventArgs e) { int iCode = 0; PK_ParticipantPosition = Convert.ToInt32(fvHR_WACEmployee_Position.DataKey.Value); using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { try { iCode = wac.participantWAC_position_delete(PK_ParticipantPosition, Session["userName"].ToString()); if (iCode == 0) { fvHR_WACEmployee_Position.ChangeMode(FormViewMode.ReadOnly); BindHR_WACEmployee_Position(); } else { WACAlert.Show("Error Returned from Database.", iCode); } OnFormActionCompleted(this, new FormViewEventArgs(FK_ParticipantWAC, "position")); } catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); } } }