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); }
        }
    }
    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); }
        }
    }
示例#3
0
    protected void fvAg_WFP3_Invoice_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        int?     i     = null;
        int      iCode = 0;
        FormView fv    = fvAg_WFP3_Invoice;

        CustomControls_AjaxCalendar invoiceDate = fv.FindControl("tbCalInvoiceDate") as CustomControls_AjaxCalendar;
        TextBox tbInvoiceNumber = fv.FindControl("tbInvoiceNumber") as TextBox;
        TextBox tbAmount        = fv.FindControl("tbAmount") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                DateTime?dtDate = invoiceDate.CalDateNullable;

                string sInvoiceNumber = null;
                if (!string.IsNullOrEmpty(tbInvoiceNumber.Text))
                {
                    sInvoiceNumber = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbInvoiceNumber.Text, 48);
                }
                else
                {
                    sb.Append("Invoice Number is required. ");
                }

                decimal?dAmount = null;
                if (!string.IsNullOrEmpty(tbAmount.Text))
                {
                    try { dAmount = Convert.ToDecimal(tbAmount.Text); }
                    catch { sb.Append("Amount must be a number (Decimal). "); }
                }
                else
                {
                    sb.Append("Amount is required. ");
                }

                if (string.IsNullOrEmpty(sb.ToString()))
                {
                    iCode = wDataContext.form_wfp3_invoice_add(FK_Wfp3, dtDate, sInvoiceNumber, dAmount, Session["userName"].ToString(), ref i);
                    if (iCode != 0)
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                    else
                    {
                        PK_Wfp3Invoice = Convert.ToInt32(i);
                    }
                }
                else
                {
                    WACAlert.Show(sb.ToString(), iCode);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
示例#4
0
    private void Insert_Properties()
    {
        lblGlobal_Insert_Properties.ForeColor = System.Drawing.Color.ForestGreen;
        int?i     = null;
        int iCode = 0;

        TextBox      tbAddress1    = pnlGlobal_Insert_Properties.FindControl("tbAddress1") as TextBox;
        TextBox      tbAddress2    = pnlGlobal_Insert_Properties.FindControl("tbAddress2") as TextBox;
        DropDownList ddlState      = pnlGlobal_Insert_Properties.FindControl("ddlState") as DropDownList;
        DropDownList ddlZip        = pnlGlobal_Insert_Properties.FindControl("ddlZip") as DropDownList;
        TextBox      tbCity        = pnlGlobal_Insert_Properties.FindControl("tbCity") as TextBox;
        TextBox      tbZip4        = pnlGlobal_Insert_Properties.FindControl("tbZip4") as TextBox;
        DropDownList ddlCounty     = pnlGlobal_Insert_Properties.FindControl("ddlCounty") as DropDownList;
        DropDownList ddlTownshipNY = pnlGlobal_Insert_Properties.FindControl("ddlTownshipNY") as DropDownList;
        DropDownList ddlBasin      = pnlGlobal_Insert_Properties.FindControl("ddlBasin") as DropDownList;
        DropDownList ddlSubbasin   = pnlGlobal_Insert_Properties.FindControl("ddlSubbasin") as DropDownList;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                string addr1   = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbAddress1.Text, 100).Trim();
                string addr2   = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbAddress2.Text, 48).Trim();
                string city    = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbCity.Text, 48).Trim();
                string state   = string.IsNullOrEmpty(ddlState.SelectedValue) ? null : ddlState.SelectedValue;
                string zipCode = string.IsNullOrEmpty(ddlZip.SelectedValue) ? null : ddlZip.SelectedValue;
                string zip4    = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbZip4.Text, 4).Trim();
                int?   county  = null;
                if (!string.IsNullOrEmpty(ddlCounty.SelectedValue))
                {
                    county = Convert.ToInt32(ddlCounty.SelectedValue);
                }
                int?township = null;
                if (!string.IsNullOrEmpty(ddlTownshipNY.SelectedValue))
                {
                    township = Convert.ToInt32(ddlTownshipNY.SelectedValue);
                }
                string basinCode    = string.IsNullOrEmpty(ddlBasin.SelectedValue) ? null : ddlBasin.SelectedValue;
                string subBasinCode = string.IsNullOrEmpty(ddlSubbasin.SelectedValue) ? null : ddlSubbasin.SelectedValue;

                iCode = wDataContext.property_add_express(addr1, addr2, city, state, zipCode, zip4, county, township, basinCode, subBasinCode, Session["userName"].ToString(), ref i);
                if (iCode == 0)
                {
                    lblGlobal_Insert_Properties.Text = "Successfully added Property: ";
                }
                else
                {
                    throw new WAC_Exceptions.WACEX_GeneralDatabaseException(string.Empty, iCode);
                }
            }
            catch (Exception ex)
            {
                lblGlobal_Insert_Properties.ForeColor = System.Drawing.Color.Red;
                lblGlobal_Insert_Properties.Text      = "Error Inserting Property: " + ex.Message;
            }
        }
    }
    protected void fvProperty_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        int?i     = null;
        int iCode = 0;

        TextBox      tbAddress1    = fvProperty.FindControl("tbAddress1") as TextBox;
        TextBox      tbAddress2    = fvProperty.FindControl("tbAddress2") as TextBox;
        DropDownList ddlState      = fvProperty.FindControl("ddlState") as DropDownList;
        DropDownList ddlZip        = fvProperty.FindControl("ddlZip") as DropDownList;
        TextBox      tbCity        = fvProperty.FindControl("tbCity") as TextBox;
        TextBox      tbZip4        = fvProperty.FindControl("tbZip4") as TextBox;
        DropDownList ddlCountyNY   = fvProperty.FindControl("ddlCounty") as DropDownList;
        DropDownList ddlTownshipNY = fvProperty.FindControl("ddlTownshipNY") as DropDownList;
        DropDownList ddlBasin      = fvProperty.FindControl("ddlBasin") as DropDownList;
        DropDownList ddlSubbasin   = fvProperty.FindControl("ddlSubbasin") as DropDownList;


        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                string addr1   = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbAddress1.Text, 100).Trim();
                string addr2   = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbAddress2.Text, 48).Trim();
                string city    = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbCity.Text, 48).Trim();
                string state   = string.IsNullOrEmpty(ddlState.SelectedValue) ? null : ddlState.SelectedValue;
                string zipCode = string.IsNullOrEmpty(ddlZip.SelectedValue) ? null : ddlZip.SelectedValue;
                string zip4    = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbZip4.Text, 4).Trim();
                int?   county  = null;
                if (!string.IsNullOrEmpty(ddlCountyNY.SelectedValue))
                {
                    county = Convert.ToInt32(ddlCountyNY.SelectedValue);
                }
                int?township = null;
                if (!string.IsNullOrEmpty(ddlTownshipNY.SelectedValue))
                {
                    township = Convert.ToInt32(ddlTownshipNY.SelectedValue);
                }
                string basinCode    = string.IsNullOrEmpty(ddlBasin.SelectedValue) ? null : ddlBasin.SelectedValue;
                string subBasinCode = string.IsNullOrEmpty(ddlSubbasin.SelectedValue) ? null : ddlSubbasin.SelectedValue;
                iCode = wDataContext.property_add_express(addr1, addr2, city, state, zipCode, zip4, county, township, basinCode, subBasinCode, Session["userName"].ToString(), ref i);
                if (iCode == 0)
                {
                    fvProperty.ChangeMode(FormViewMode.ReadOnly);
                    BindProperty(Convert.ToInt32(i));
                }
                else
                {
                    WACAlert.Show("Error Returned from Database.", iCode);
                }
            }
            catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
        }
    }
    protected void fvAg_WFP3_Modification_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        int?     i     = null;
        int      iCode = 0;
        FormView fv    = fvAg_WFP3_Modification;

        DropDownList ddlBMP   = fv.FindControl("ddlBMP") as DropDownList;
        TextBox      tbAmount = fv.FindControl("tbAmount") as TextBox;
        TextBox      tbNote   = fv.FindControl("tbNote") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                int?iBMP = null;
                if (!string.IsNullOrEmpty(ddlBMP.SelectedValue))
                {
                    iBMP = Convert.ToInt32(ddlBMP.SelectedValue);
                }
                else
                {
                    sb.Append("BMP is required. ");
                }

                decimal?dAmount = null;
                try { dAmount = Convert.ToDecimal(tbAmount.Text); }
                catch { sb.Append("Amount is required. Amount is a number (Decimal). "); }

                string sNote = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 255);

                if (string.IsNullOrEmpty(sb.ToString()))
                {
                    iCode = wDataContext.form_wfp3_modification_add(FK_Wfp3, iBMP, dAmount, sNote, Session["userName"].ToString(), ref i);
                    if (iCode != 0)
                    {
                        WACAlert.Show("Error Returned from Database. " + sb.ToString(), iCode);
                    }
                    else
                    {
                        PK_Wfp3Mod = Convert.ToInt32(i);
                    }
                }
                else
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
示例#7
0
    protected void fvAg_WFP3_Invoice_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        StringBuilder sb = new StringBuilder();

        FormView fv = fvAg_WFP3_Invoice;
        CustomControls_AjaxCalendar invoiceDate = fv.FindControl("tbCalInvoiceDate") as CustomControls_AjaxCalendar;
        TextBox tbInvoiceNumber = fv.FindControl("tbInvoiceNumber") as TextBox;
        TextBox tbAmount        = fv.FindControl("tbAmount") as TextBox;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = wDataContext.form_wfp3_invoices.Where(w => w.pk_form_wfp3_invoice == Convert.ToInt32(fv.DataKey.Value)).Select(s => s).Single();
            try
            {
                a.date = (DateTime)invoiceDate.CalDateNullable;

                if (!string.IsNullOrEmpty(tbInvoiceNumber.Text))
                {
                    a.invoice_nbr = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbInvoiceNumber.Text, 48);
                }
                else
                {
                    sb.Append("Invoice Number was not updated. Invoice Number is required. ");
                }


                if (!string.IsNullOrEmpty(tbAmount.Text))
                {
                    try { a.amt = Convert.ToDecimal(tbAmount.Text); }
                    catch { sb.Append("Amount was not updated. Amount must be a number (Decimal). "); }
                }
                else
                {
                    sb.Append("Amount was not updated. Amount is 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); }
        }
    }
示例#8
0
    private void Insert_Organizations()
    {
        lblGlobal_Insert_Organizations.ForeColor = System.Drawing.Color.ForestGreen;
        StringBuilder sb = new StringBuilder();

        try
        {
            using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
            {
                string sOrganization = null;
                if (!string.IsNullOrEmpty(tbOrganizations_Organization.Text))
                {
                    sOrganization = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbOrganizations_Organization.Text, 96);
                }
                else
                {
                    sb.Append("Organization is required. ");
                }

                if (string.IsNullOrEmpty(sb.ToString()))
                {
                    int?i     = null;
                    int iCode = wac.organization_add(sOrganization, Session["userName"].ToString(), ref i);
                    if (iCode == 0)
                    {
                        tbOrganizations_Organization.Text   = "";
                        lblGlobal_Insert_Organizations.Text = "Successfully added Organization: " + sOrganization;
                    }
                    else
                    {
                        WACAlert.Show("Error Inserting Organization: ", iCode);
                    }
                }
                else
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
        }
        catch (Exception ex)
        {
            lblGlobal_Insert_Organizations.ForeColor = System.Drawing.Color.Red;
            lblGlobal_Insert_Organizations.Text      = "Error Inserting Organization: " + ex.Message;
        }
    }
    protected void fvOrganization_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        TextBox      tbOrg        = fvOrganization.FindControl("tbOrg") as TextBox;
        DropDownList ddlContact   = fvOrganization.FindControl("UC_DropDownListByAlphabet_Organization").FindControl("ddl") as DropDownList;
        HiddenField  hfPropertyPK = fvOrganization.FindControl("UC_Property_EditInsert_Organization").FindControl("hfPropertyPK") as HiddenField;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = (from b in wDataContext.organizations.Where(w => w.pk_organization == Convert.ToInt32(fvOrganization.DataKey.Value)) select b).Single();

            a.org = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbOrg.Text, 96).Trim();

            if (ddlContact.Items.Count > 0)
            {
                if (!string.IsNullOrEmpty(ddlContact.SelectedValue))
                {
                    a.fk_participant_contact = Convert.ToInt32(ddlContact.SelectedValue);
                }
                else
                {
                    a.fk_participant_contact = null;
                }
            }

            if (!string.IsNullOrEmpty(hfPropertyPK.Value))
            {
                a.fk_property = Convert.ToInt32(hfPropertyPK.Value);
            }
            else
            {
                a.fk_property = null;
            }

            a.modified    = DateTime.Now;
            a.modified_by = Session["userName"].ToString();

            try
            {
                wDataContext.SubmitChanges();
                fvOrganization.ChangeMode(FormViewMode.ReadOnly);
                BindOrganization(Convert.ToInt32(fvOrganization.DataKey.Value));
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
    protected void fvAg_WFP3_Modification_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        FormView fv = fvAg_WFP3_Modification;

        DropDownList ddlBMP   = fv.FindControl("ddlBMP") as DropDownList;
        TextBox      tbAmount = fv.FindControl("tbAmount") as TextBox;
        TextBox      tbNote   = fv.FindControl("tbNote") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = wDataContext.form_wfp3_modifications.Where(w => w.pk_form_wfp3_modification == Convert.ToInt32(fv.DataKey.Value)).Select(s => s).Single();
            try
            {
                if (!string.IsNullOrEmpty(ddlBMP.SelectedValue))
                {
                    a.fk_form_wfp3_bmp = Convert.ToInt32(ddlBMP.SelectedValue);
                }
                else
                {
                    sb.Append("BMP was not updated. This is a required field. ");
                }

                try { a.amount = Convert.ToDecimal(tbAmount.Text); }
                catch { sb.Append("Amount was not updated. This is a required field of type number (Decimal). "); }

                a.note = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 255);

                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); }
        }
    }
示例#11
0
    protected void fvOrganization_Note_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        int?i     = null;
        int iCode = 0;

        TextBox tbNote = fvOrganization_Note.FindControl("tbNote") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                string sNote = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 4000).Trim();
                if (string.IsNullOrEmpty(sNote))
                {
                    sb.Append("Note is required. ");
                }

                if (string.IsNullOrEmpty(sb.ToString()))
                {
                    iCode = wDataContext.organizationNote_add(Convert.ToInt32(fvOrganization.DataKey.Value), sNote, Session["userName"].ToString(), ref i);
                    if (iCode == 0)
                    {
                        fvOrganization_Note.ChangeMode(FormViewMode.ReadOnly);
                        BindOrganization_Note(Convert.ToInt32(i));
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
                else
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
        }
    }
示例#12
0
    protected void fvOrganization_Note_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        TextBox tbNote = fvOrganization_Note.FindControl("tbNote") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                var a = (from b in wDataContext.organizationNotes.Where(w => w.pk_organizationNote == Convert.ToInt32(fvOrganization_Note.DataKey.Value))
                         select b).Single();

                if (!string.IsNullOrEmpty(tbNote.Text))
                {
                    a.note = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 4000).Trim();
                }
                else
                {
                    sb.Append("Note was not updated. Note is required. ");
                }

                a.modified    = DateTime.Now;
                a.modified_by = Session["userName"].ToString();

                wDataContext.SubmitChanges();
                fvOrganization_Note.ChangeMode(FormViewMode.ReadOnly);
                BindOrganization_Note(Convert.ToInt32(fvOrganization_Note.DataKey.Value));

                if (!string.IsNullOrEmpty(sb.ToString()))
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
    protected void fvSA_Note_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        int?i     = null;
        int iCode = 0;

        FormView fv     = fvSA.FindControl("fvSA_Note") as FormView;
        TextBox  tbNote = fv.FindControl("tbNote") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                string sNote = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 255);

                if (string.IsNullOrEmpty(sb.ToString()))
                {
                    iCode = wDataContext.supplementalAgreementNote_add(Convert.ToInt32(fvSA.DataKey.Value), sNote, Session["userName"].ToString(), ref i);
                    if (iCode == 0)
                    {
                        fv.ChangeMode(FormViewMode.ReadOnly);
                        Populate_SA_Note_FormView(fv, Convert.ToInt32(i));
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
                else
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
示例#14
0
    protected int fvAg_WFP3_ItemInserting(object sender, EventArgs e)
    {
        int?i     = null;
        int iCode = -1;

        CustomControls_AjaxCalendar tbCalDesignDate          = fvAg_WFP3.FindControl("tbCalDesignDate") as CustomControls_AjaxCalendar;
        CustomControls_AjaxCalendar tbCalProcurementPlanDate = fvAg_WFP3.FindControl("tbCalProcurementPlanDate") as CustomControls_AjaxCalendar;
        CustomControls_AjaxCalendar tbCalOutForBidDate       = fvAg_WFP3.FindControl("tbCalOutForBidDate") as CustomControls_AjaxCalendar;
        CustomControls_AjaxCalendar tbCalBidDeadlineDate     = fvAg_WFP3.FindControl("tbCalBidDeadlineDate") as CustomControls_AjaxCalendar;
        CustomControls_AjaxCalendar tbCalInstallToDate       = fvAg_WFP3.FindControl("tbCalInstallToDate") as CustomControls_AjaxCalendar;
        CustomControls_AjaxCalendar tbCalInstallFromDate     = fvAg_WFP3.FindControl("tbCalInstallFromDate") as CustomControls_AjaxCalendar;
        CustomControls_AjaxCalendar tbCalConstructionDate    = fvAg_WFP3.FindControl("tbCalConstructionDate") as CustomControls_AjaxCalendar;
        CustomControls_AjaxCalendar tbCalPrintDate           = fvAg_WFP3.FindControl("tbCalPrintDate") as CustomControls_AjaxCalendar;
        DropDownList ddlSpecialProvisions     = fvAg_WFP3.FindControl("ddlSpecialProvisions") as DropDownList;
        TextBox      tbDescription            = fvAg_WFP3.FindControl("tbDescription") as TextBox;
        TextBox      tbAttachedPages          = fvAg_WFP3.FindControl("tbAttachedPages") as TextBox;
        TextBox      tbAttachedSpecifications = fvAg_WFP3.FindControl("tbAttachedSpecifications") as TextBox;
        DropDownList ddlProcurementType       = fvAg_WFP3.FindControl("ddlProcurementType") as DropDownList;
        TextBox      tbNote = fvAg_WFP3.FindControl("tbNote") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                string sProcurementType = null;
                if (!string.IsNullOrEmpty(ddlProcurementType.SelectedValue))
                {
                    sProcurementType = ddlProcurementType.SelectedValue;
                }
                if (string.IsNullOrEmpty(sProcurementType))
                {
                    sb.Append("Procurement Type is required. ");
                }

                if (!string.IsNullOrEmpty(sProcurementType))
                {
                    string sDescription = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbDescription.Text, 255);

                    DateTime?dtDesignDate = tbCalDesignDate.CalDateNullable;

                    DateTime?dtProcurementPlanDate = tbCalProcurementPlanDate.CalDateNullable;

                    DateTime?dtOutForBid = tbCalOutForBidDate.CalDateNullable;

                    DateTime?dtBidDeadlineDate = tbCalBidDeadlineDate.CalDateNullable;

                    DateTime?dtUnderConstruction = tbCalConstructionDate.CalDateNullable;

                    string sSpecialProvisions = "N";
                    if (!string.IsNullOrEmpty(ddlSpecialProvisions.SelectedValue))
                    {
                        sSpecialProvisions = ddlSpecialProvisions.SelectedValue;
                    }

                    DateTime?dtInstallFrom = tbCalInstallFromDate.CalDateNullable;

                    DateTime?dtInstallTo = tbCalInstallToDate.CalDateNullable;

                    DateTime?dtPrintDate = tbCalPrintDate.CalDateNullable;

                    string sAttachedPages = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbAttachedPages.Text, 4);

                    string sAttachedSpecifications = null;
                    if (!string.IsNullOrEmpty(tbAttachedSpecifications.Text))
                    {
                        sAttachedSpecifications = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbAttachedSpecifications.Text, 255);
                    }

                    string sNote = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 255);

                    iCode = wDataContext.form_wfp3_add_express(Convert.ToInt32(FK_FarmBusiness), sDescription, sProcurementType, dtDesignDate, dtPrintDate,
                                                               dtProcurementPlanDate, dtBidDeadlineDate, dtOutForBid, dtUnderConstruction, sSpecialProvisions, dtInstallFrom, dtInstallTo, sAttachedPages,
                                                               sAttachedSpecifications, sNote, Session["userName"].ToString(), ref i);
                    if (iCode == 0)
                    {
                        fvAg_WFP3.ChangeMode(FormViewMode.ReadOnly);
                        PK_FormWfp3 = Convert.ToInt32(i);
                        BindAg_WFP3();
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
                else
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
        return(iCode);
    }
示例#15
0
    protected void fvProperty_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        TextBox      tbAddress1    = fvProperty.FindControl("tbAddress1") as TextBox;
        TextBox      tbAddress2    = fvProperty.FindControl("tbAddress2") as TextBox;
        DropDownList ddlState      = fvProperty.FindControl("ddlState") as DropDownList;
        DropDownList ddlZip        = fvProperty.FindControl("ddlZip") as DropDownList;
        TextBox      tbCity        = fvProperty.FindControl("tbCity") as TextBox;
        TextBox      tbZip4        = fvProperty.FindControl("tbZip4") as TextBox;
        DropDownList ddlCountyNY   = fvProperty.FindControl("ddlCounty") as DropDownList;
        DropDownList ddlTownshipNY = fvProperty.FindControl("ddlTownshipNY") as DropDownList;
        DropDownList ddlBasin      = fvProperty.FindControl("ddlBasin") as DropDownList;
        DropDownList ddlSubbasin   = fvProperty.FindControl("ddlSubbasin") as DropDownList;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                var a = wDataContext.properties.Where(w => w.pk_property == Convert.ToInt32(fvProperty.DataKey.Value)).Select(s => s).Single();

                a.address  = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbAddress1.Text, 100).Trim();
                a.address2 = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbAddress2.Text, 48).Trim();
                a.city     = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbCity.Text, 48).Trim();
                if (!string.IsNullOrEmpty(ddlState.SelectedValue))
                {
                    a.state = ddlState.SelectedValue;
                }
                else
                {
                    a.state = null;
                }
                if (!string.IsNullOrEmpty(ddlZip.SelectedValue))
                {
                    a.fk_zipcode = ddlZip.SelectedValue;
                }
                else
                {
                    a.fk_zipcode = null;
                }
                a.zip4 = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbZip4.Text, 4).Trim();
                if (!string.IsNullOrEmpty(ddlCountyNY.SelectedValue))
                {
                    a.fk_list_countyNY = Convert.ToInt32(ddlCountyNY.SelectedValue);
                }
                else
                {
                    a.fk_list_countyNY = null;
                }
                if (!string.IsNullOrEmpty(ddlTownshipNY.SelectedValue))
                {
                    a.fk_list_townshipNY = Convert.ToInt32(ddlTownshipNY.SelectedValue);
                }
                else
                {
                    a.fk_list_townshipNY = null;
                }
                if (!string.IsNullOrEmpty(ddlBasin.SelectedValue))
                {
                    a.fk_basin_code = ddlBasin.SelectedValue;
                }
                else
                {
                    a.fk_basin_code = null;
                }
                if (!string.IsNullOrEmpty(ddlSubbasin.SelectedValue))
                {
                    a.fk_subbasin_code = ddlSubbasin.SelectedValue;
                }
                else
                {
                    a.fk_subbasin_code = null;
                }

                a.modified    = DateTime.Now;
                a.modified_by = Session["userName"].ToString();
                wDataContext.SubmitChanges();
                fvProperty.ChangeMode(FormViewMode.ReadOnly);
                BindProperty(Convert.ToInt32(fvProperty.DataKey.Value));
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
示例#16
0
    protected void fvVenue_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        int?i     = null;
        int iCode = 0;

        TextBox      tbLocation = fvVenue.FindControl("tbLocation") as TextBox;
        DropDownList ddlPhone   = fvVenue.FindControl("UC_Communication_EditInsert_Phone").FindControl("ddlNumber") as DropDownList;
        DropDownList ddlFax     = fvVenue.FindControl("UC_Communication_EditInsert_Fax").FindControl("ddlNumber") as DropDownList;
        TextBox      tbEmail    = fvVenue.FindControl("tbEmail") as TextBox;
        TextBox      tbNote     = fvVenue.FindControl("tbNote") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                string sLocation = null;
                if (!string.IsNullOrEmpty(tbLocation.Text))
                {
                    sLocation = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbLocation.Text, 48).Trim();
                }
                else
                {
                    sb.Append("Location is required. ");
                }

                int?iPhone = null;
                if (!string.IsNullOrEmpty(ddlPhone.SelectedValue))
                {
                    iPhone = Convert.ToInt32(ddlPhone.SelectedValue);
                }
                int?iFax = null;
                if (!string.IsNullOrEmpty(ddlFax.SelectedValue))
                {
                    iFax = Convert.ToInt32(ddlFax.SelectedValue);
                }
                string sEmail = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbEmail.Text, 48).Trim();
                string sNote  = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 255).Trim();

                if (string.IsNullOrEmpty(sb.ToString()))
                {
                    iCode = wDataContext.eventVenue_add(sLocation, iPhone, iFax, sEmail, sNote, Session["userName"].ToString(), ref i);
                    if (iCode == 0)
                    {
                        fvVenue.ChangeMode(FormViewMode.ReadOnly);
                        BindVenue(Convert.ToInt32(i));
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
                else
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
        }
    }
示例#17
0
    private void Insert_Participants()
    {
        lblGlobal_Insert_Participants.ForeColor = System.Drawing.Color.ForestGreen;
        StringBuilder sb = new StringBuilder();

        try
        {
            using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
            {
                string sParticipant       = null;
                string sParticipantSuffix = null;
                string sParticipantOrg    = null;

                string sNameFirst       = null;
                string sNameLast        = null;
                string sFK_Suffix       = null;
                int?   iFK_Organization = null;
                string sParticipantType = null;
                string sWACRegion       = null;

                if (rblParticipants.SelectedValue == "0" || rblParticipants.SelectedValue == "1")
                {
                    if (!string.IsNullOrEmpty(tbParticipants_NameFirst.Text))
                    {
                        sNameFirst = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbParticipants_NameFirst.Text, 48);
                    }
                    else
                    {
                        sb.Append("First Name is required. ");
                    }

                    if (!string.IsNullOrEmpty(tbParticipants_NameLast.Text))
                    {
                        sNameLast = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbParticipants_NameLast.Text, 48);
                    }
                    else
                    {
                        sb.Append("Last Name is required. ");
                    }

                    if (!string.IsNullOrEmpty(ddlParticipants_Suffix.SelectedValue))
                    {
                        sFK_Suffix         = ddlParticipants_Suffix.SelectedValue;
                        sParticipantSuffix = ddlParticipants_Suffix.SelectedItem.Text;
                    }
                }

                if (rblParticipants.SelectedValue == "1" || rblParticipants.SelectedValue == "2")
                {
                    DropDownList ddl = UC_DropDownListByAlphabet_Participants.FindControl("ddl") as DropDownList;
                    if (!string.IsNullOrEmpty(ddl.SelectedValue))
                    {
                        iFK_Organization = Convert.ToInt32(ddl.SelectedValue);
                        sParticipantOrg  = ddl.SelectedItem.Text;
                    }
                    else
                    {
                        sb.Append("Organization is required.");
                    }
                }

                sParticipant = WACGlobal_Methods.SpecialText_Global_Participant_Name_Org(sNameLast, sNameFirst, null, sParticipantSuffix, sParticipantOrg);

                sParticipantType = ddlParticipantType.SelectedValue;

                if (!string.IsNullOrEmpty(ddlWACRegion.SelectedValue))
                {
                    sWACRegion = ddlWACRegion.SelectedValue;
                }

                if (string.IsNullOrEmpty(sb.ToString()))
                {
                    int?i     = null;
                    int iCode = wac.participant_add_express(sNameFirst, sNameLast, sFK_Suffix, iFK_Organization, sParticipantType, sWACRegion, Session["userName"].ToString(), ref i);
                    if (iCode == 0)
                    {
                        //if (!string.IsNullOrEmpty(StringParticipantType))
                        //{
                        //    int? i2 = null;
                        //    int iCode2 = wac.participantType_add(i, StringParticipantType, Session["userName"].ToString(), ref i2);
                        //    if (iCode2 != 0) WACAlert.Show("Successfully added Participant, but Error Inserting Participant Type: ", iCode2);
                        //}

                        Handle_Participant_TypeChange("0", true);
                        lblGlobal_Insert_Participants.Text = "Successfully added Participant: " + sParticipant;
                    }
                    else
                    {
                        WACAlert.Show("Error Inserting Participant: ", iCode);
                    }
                }
                else
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
        }
        catch (Exception ex)
        {
            lblGlobal_Insert_Participants.ForeColor = System.Drawing.Color.Red;
            lblGlobal_Insert_Participants.Text      = "Error Inserting Participant: " + ex.Message;
        }
    }
    protected void fvBMPPlanning_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        StringBuilder sb = new StringBuilder();

        TextBox      tbBMPNumber             = fvBMPPlanning.FindControl("tbBMPNumber") as TextBox;
        TextBox      tbDescription           = fvBMPPlanning.FindControl("tbDescription") as TextBox;
        TextBox      tbSubIssueStatement     = fvBMPPlanning.FindControl("tbSubIssueStatement") as TextBox;
        DropDownList ddlBMPSource            = fvBMPPlanning.FindControl("ddlBMPSource") as DropDownList;
        TextBox      tbLocation              = fvBMPPlanning.FindControl("tbLocation") as TextBox;
        DropDownList ddlRevisionDescription  = fvBMPPlanning.FindControl("ddlRevisionDescription") as DropDownList;
        DropDownList ddlPollutantCategory    = fvBMPPlanning.FindControl("ddlPollutantCategory") as DropDownList;
        DropDownList ddlBMPPractice          = fvBMPPlanning.FindControl("ddlBMPPractice") as DropDownList;
        TextBox      tbUnitsPlanned          = fvBMPPlanning.FindControl("tbUnitsPlanned") as TextBox;
        TextBox      tbPriorPlanningEstimate = fvBMPPlanning.FindControl("tbPriorPlanningEstimate") as TextBox;
        TextBox      tbPlanningEstimate      = fvBMPPlanning.FindControl("tbPlanningEstimate") as TextBox;
        DropDownList ddlCREP     = fvBMPPlanning.FindControl("ddlCREP") as DropDownList;
        DropDownList ddlNMCPType = fvBMPPlanning.FindControl("ddlNMCPType") as DropDownList;
        DropDownList ddlSAA      = fvBMPPlanning.FindControl("ddlSAA") as DropDownList;
        DropDownList ddlSA       = fvBMPPlanning.FindControl("ddlSA") as DropDownList;

        using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
        {
            try
            {
                int? iPH_PK_SA_TP        = null;
                bool bPerformSABMPInsert = false;

                var a = wac.bmp_ags.Where(w => w.pk_bmp_ag == Convert.ToInt32(fvBMPPlanning.DataKey.Value)).Single();

                string sBMP_NBR_Orig = a.bmp_nbr;
                string sBMP_NBR      = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbBMPNumber.Text, 24);
                if (sBMP_NBR_Orig != sBMP_NBR)
                {
                    int iBMP_NBR_Count = wac.bmp_ags.Where(w => w.fk_farmBusiness == a.fk_farmBusiness && w.bmp_nbr == sBMP_NBR).Count();
                    if (iBMP_NBR_Count > 0)
                    {
                        sb.Append("BMP Number was not updated. The BMP Number already exists within this farm.");
                    }
                    else
                    {
                        a.bmp_nbr = sBMP_NBR;
                    }
                }

                if (!string.IsNullOrEmpty(tbDescription.Text))
                {
                    a.description = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbDescription.Text, 400);
                }
                else
                {
                    sb.Append("Description was not updated. Description is required. ");
                }
                if (!string.IsNullOrEmpty(tbSubIssueStatement.Text))
                {
                    a.issueStatement_wfp2 = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbSubIssueStatement.Text, 1000);
                }
                else
                {
                    a.issueStatement_wfp2 = null;
                }
                if (!string.IsNullOrEmpty(ddlBMPSource.SelectedValue))
                {
                    a.fk_BMPSource_code = ddlBMPSource.SelectedValue;
                }
                else
                {
                    sb.Append("BMP Source was not updated. BMP Source is required. ");
                }

                if (!string.IsNullOrEmpty(tbLocation.Text))
                {
                    a.location = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbLocation.Text, 96);
                }
                //else sb.Append("Location was not updated. Location is required. ");

                if (!string.IsNullOrEmpty(ddlRevisionDescription.SelectedValue))
                {
                    a.fk_revisionDescription_code = ddlRevisionDescription.SelectedValue;
                }
                else
                {
                    sb.Append("Revision Description was not updated. Revision Description is required. ");
                }

                if (!string.IsNullOrEmpty(ddlPollutantCategory.SelectedValue))
                {
                    a.fk_pollutant_category_code = ddlPollutantCategory.SelectedValue;
                }
                else
                {
                    sb.Append("Pollutant Category was not updated. Pollutant Category is required. ");
                }

                if (!string.IsNullOrEmpty(ddlBMPPractice.SelectedValue))
                {
                    a.fk_bmpPractice_code = Convert.ToDecimal(ddlBMPPractice.SelectedValue);
                }
                else
                {
                    sb.Append("BMP Practice was not updated. BMP Practice is required. ");
                }

                if (!string.IsNullOrEmpty(tbUnitsPlanned.Text))
                {
                    try { a.units_planned = Convert.ToDecimal(tbUnitsPlanned.Text); }
                    catch { sb.Append("Units Planned was not updated. Units Planned must be a number (Decimal). "); }
                }
                //else sb.Append("Units Planned was not updated. Units Planned is required. ");

                if (!string.IsNullOrEmpty(tbPriorPlanningEstimate.Text))
                {
                    try { a.est_plan_prior = Convert.ToDecimal(tbPriorPlanningEstimate.Text); }
                    catch { sb.Append("Prior Planning Estimate was not updated. Prior Planning Estimate must be a number (Decimal). "); }
                }
                else
                {
                    sb.Append("Prior Planning Estimate was not updated. Prior Planning Estimate is required. ");
                }

                if (!string.IsNullOrEmpty(tbPlanningEstimate.Text))
                {
                    try { a.est_plan_rev = Convert.ToDecimal(tbPlanningEstimate.Text); }
                    catch { sb.Append("Planning Estimate was not updated. Planning Estimate must be a number (Decimal). "); }
                }
                else
                {
                    sb.Append("Planning Estimate was not updated. Planning Estimate is required. ");
                }

                if (!string.IsNullOrEmpty(ddlCREP.SelectedValue))
                {
                    a.CREP = ddlCREP.SelectedValue;
                }
                else
                {
                    a.CREP = null;
                }

                //if (!string.IsNullOrEmpty(ddlNMCPType.SelectedValue)) a.fk_NMCPType_code = ddlNMCPType.SelectedValue;
                //else a.fk_NMCPType_code = null;

                if (!string.IsNullOrEmpty(ddlSAA.SelectedValue) && !string.IsNullOrEmpty(ddlSA.SelectedValue))
                {
                    iPH_PK_SA_TP = Convert.ToInt32(ddlSA.SelectedValue);
                    if (a.fk_supplementalAgreementTaxParcel != iPH_PK_SA_TP)
                    {
                        bPerformSABMPInsert = true;
                    }
                    a.fk_SAAssignType_code = ddlSAA.SelectedValue;
                }
                else if ((!string.IsNullOrEmpty(ddlSAA.SelectedValue) && string.IsNullOrEmpty(ddlSA.SelectedValue)) || (string.IsNullOrEmpty(ddlSAA.SelectedValue) && !string.IsNullOrEmpty(ddlSA.SelectedValue)))
                {
                    sb.Append("Supplemental Agreement was not updated. Both Supplemental Agreement Assignment and Supplemental Agreement must be defined when attaching a Supplemental Agreement. ");
                }
                else if (string.IsNullOrEmpty(ddlSAA.SelectedValue) && string.IsNullOrEmpty(ddlSA.SelectedValue))
                {
                    if (a.fk_supplementalAgreementTaxParcel != null)
                    {
                        bPerformSABMPInsert = true;
                    }
                    a.fk_SAAssignType_code = null;
                }

                a.modified    = DateTime.Now;
                a.modified_by = Session["userName"].ToString();

                //wac.SubmitChanges();

                ISingleResult <bmp_ag_update_expressResult> code = wac.bmp_ag_update_express(a.pk_bmp_ag, a.fk_pollutant_category_code, a.bmp_nbr, a.description, a.fk_bmpPractice_code,
                                                                                             a.units_planned, a.units_completed, a.est_plan_prior, a.est_plan_rev, a.CREP, a.fk_BMPSource_code, a.location, a.fk_revisionDescription_code,
                                                                                             a.fk_SAAssignType_code, a.fk_supplementalAgreementTaxParcel, a.fk_BMPTypeCode, a.fk_BMPCode_code, a.fk_BMPCREPH20_code, a.lifespan_year,
                                                                                             a.revisionDescription_addl, a.issueStatement_wfp2, a.modified_by);
                int iCode = (int)code.ReturnValue;
                if (iCode == 0)
                {
                    if (bPerformSABMPInsert)
                    {
                        int?i = null;
                        //int iCodeInsert = wac.bmp_ag_SA_add(Convert.ToInt32(fvBMPPlanning.DataKey.Value), iPH_PK_SA_TP, Session["userName"].ToString(), ref i);
                        int iCodeInsert = wac.bmp_ag_SA_add(Convert.ToInt32(fvBMPPlanning.DataKey.Value), iPH_PK_SA_TP,
                                                            a.fk_SAAssignType_code, Session["userName"].ToString(), ref i);
                    }

                    fvBMPPlanning.ChangeMode(FormViewMode.ReadOnly);
                    BindData_BMPPlanning_FormView(Convert.ToInt32(fvBMPPlanning.DataKey.Value));
                }
                else
                {
                    WACAlert.Show("Update failed: ", iCode);
                }

                if (!string.IsNullOrEmpty(sb.ToString()))
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
示例#19
0
    protected void fvAg_WFP3_Bid_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        StringBuilder sbErrorCollection = new StringBuilder();

        FormView     fv            = fvAg_WFP3_Bid;
        DropDownList ddlContractor = fv.FindControl("ddlContractor") as DropDownList;
        TextBox      tbBidAmount   = fv.FindControl("tbBidAmount") as TextBox;
        CustomControls_AjaxCalendar tbCalBidAwardDate = fv.FindControl("tbCalBidAwardDate") as CustomControls_AjaxCalendar;
        TextBox tbModificationAmount = fv.FindControl("tbModificationAmount") as TextBox;
        TextBox tbBidRank            = fv.FindControl("tbBidRank") as TextBox;
        TextBox tbNote = fv.FindControl("tbNote") as TextBox;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = (from b in wDataContext.form_wfp3_bids.Where(w => w.pk_form_wfp3_bid == Convert.ToInt32(fv.DataKey.Value))
                     select b).Single();
            try
            {
                if (!string.IsNullOrEmpty(ddlContractor.SelectedValue))
                {
                    a.fk_participant_contractor = Convert.ToInt32(ddlContractor.SelectedValue);
                }
                else
                {
                    sbErrorCollection.Append("Contractor was not updated. This is a required field. ");
                }

                try { if (!string.IsNullOrEmpty(tbBidAmount.Text))
                      {
                          a.bid_amt = Convert.ToDecimal(tbBidAmount.Text);
                      }
                }
                catch { sbErrorCollection.Append("Bid Amount was not updated. Must be a number (Decimal). "); }

                a.bid_awarded = tbCalBidAwardDate.CalDateNullable;

                a.modification_amt = 0;
                try { if (!string.IsNullOrEmpty(tbModificationAmount.Text))
                      {
                          a.modification_amt = Convert.ToDecimal(tbModificationAmount.Text);
                      }
                }
                catch { sbErrorCollection.Append("Modification Amount was not updated. Must be a number (Decimal). "); }

                try { if (!string.IsNullOrEmpty(tbBidRank.Text))
                      {
                          a.bid_rank = Convert.ToByte(tbBidRank.Text);
                      }
                }
                catch { sbErrorCollection.Append("Bid Rank was not updated. Must be a Number (Byte). "); }

                a.note = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 255);

                a.modified    = DateTime.Now;
                a.modified_by = Session["userName"].ToString();

                wDataContext.SubmitChanges();

                if (!string.IsNullOrEmpty(sbErrorCollection.ToString()))
                {
                    WACAlert.Show(sbErrorCollection.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
示例#20
0
    protected void fvList_Ag_BMPPractice_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        int iCode = 0;

        TextBox      tbPK                   = fvList_Ag_BMPPractice.FindControl("tbPK") as TextBox;
        TextBox      tbPractice             = fvList_Ag_BMPPractice.FindControl("tbPractice") as TextBox;
        DropDownList ddlAgency              = fvList_Ag_BMPPractice.FindControl("ddlAgency") as DropDownList;
        DropDownList ddlLifespan            = fvList_Ag_BMPPractice.FindControl("ddlLifespan") as DropDownList;
        DropDownList ddlAgronomic           = fvList_Ag_BMPPractice.FindControl("ddlAgronomic") as DropDownList;
        DropDownList ddlUnit                = fvList_Ag_BMPPractice.FindControl("ddlUnit") as DropDownList;
        DropDownList ddlWACPracticeCategory = fvList_Ag_BMPPractice.FindControl("ddlWACPracticeCategory") as DropDownList;
        TextBox      tbABC                  = fvList_Ag_BMPPractice.FindControl("tbABC") as TextBox;
        TextBox      tbABCNote              = fvList_Ag_BMPPractice.FindControl("tbABCNote") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                decimal?dPracticeCode = null;
                if (!string.IsNullOrEmpty(tbPractice.Text))
                {
                    try { dPracticeCode = Convert.ToDecimal(tbPK.Text); }
                    catch { sb.Append("Practice Code must be a number (Decimal). "); }
                }
                else
                {
                    sb.Append("Practice Code is required. ");
                }

                string sAgency = null;
                if (!string.IsNullOrEmpty(ddlAgency.SelectedValue))
                {
                    sAgency = ddlAgency.SelectedValue;
                }
                else
                {
                    sb.Append("Agency is required. ");
                }

                string sPractice = null;
                if (!string.IsNullOrEmpty(tbPractice.Text))
                {
                    sPractice = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbPractice.Text, 96);
                }
                else
                {
                    sb.Append("Practice is required. ");
                }

                byte?byLifeRequiredYears = Convert.ToByte(ddlLifespan.SelectedValue);

                string sAgronomic = null;
                if (!string.IsNullOrEmpty(ddlAgronomic.SelectedValue))
                {
                    sAgronomic = ddlAgronomic.SelectedValue;
                }

                string sUnit = null;
                if (!string.IsNullOrEmpty(ddlUnit.SelectedValue))
                {
                    sUnit = ddlUnit.SelectedValue;
                }
                else
                {
                    sb.Append("Units is required. ");
                }

                int?iWACPracticeCategory = null;
                if (!string.IsNullOrEmpty(ddlWACPracticeCategory.SelectedValue))
                {
                    iWACPracticeCategory = Convert.ToInt32(ddlWACPracticeCategory.SelectedValue);
                }

                decimal?dABC = null;
                if (!string.IsNullOrEmpty(tbABC.Text))
                {
                    try { dABC = Convert.ToDecimal(tbABC.Text); }
                    catch { sb.Append("ABC must be a number (Interger). "); }
                }

                string sABCNote = null;
                if (!string.IsNullOrEmpty(tbABCNote.Text))
                {
                    sABCNote = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbABCNote.Text, 255);
                }

                if (string.IsNullOrEmpty(sb.ToString()))
                {
                    iCode = wDataContext.list_bmpPractice_add(dPracticeCode, sAgency, sPractice, byLifeRequiredYears, sAgronomic, sUnit, iWACPracticeCategory, dABC, sABCNote);
                    if (iCode == 0)
                    {
                        fvList_Ag_BMPPractice.ChangeMode(FormViewMode.ReadOnly);
                        BindData_Ag_BMPPractice(Convert.ToDecimal(dPracticeCode));
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
                else
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
        }
    }
示例#21
0
    protected void fvList_Ag_BMPPractice_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        TextBox      tbPractice             = fvList_Ag_BMPPractice.FindControl("tbPractice") as TextBox;
        DropDownList ddlAgency              = fvList_Ag_BMPPractice.FindControl("ddlAgency") as DropDownList;
        DropDownList ddlLifespan            = fvList_Ag_BMPPractice.FindControl("ddlLifespan") as DropDownList;
        DropDownList ddlAgronomic           = fvList_Ag_BMPPractice.FindControl("ddlAgronomic") as DropDownList;
        DropDownList ddlUnit                = fvList_Ag_BMPPractice.FindControl("ddlUnit") as DropDownList;
        DropDownList ddlWACPracticeCategory = fvList_Ag_BMPPractice.FindControl("ddlWACPracticeCategory") as DropDownList;
        TextBox      tbABC     = fvList_Ag_BMPPractice.FindControl("tbABC") as TextBox;
        TextBox      tbABCNote = fvList_Ag_BMPPractice.FindControl("tbABCNote") as TextBox;
        DropDownList ddlActive = fvList_Ag_BMPPractice.FindControl("ddlActive") as DropDownList;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                var a = wDataContext.list_bmpPractices.Where(w => w.pk_bmpPractice_code == Convert.ToDecimal(fvList_Ag_BMPPractice.DataKey.Value)).Select(s => s).Single();

                if (!string.IsNullOrEmpty(tbPractice.Text))
                {
                    a.practice = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbPractice.Text, 96);
                }
                else
                {
                    sb.Append("Practice was not updated. Practice is required. ");
                }

                if (!string.IsNullOrEmpty(ddlAgency.SelectedValue))
                {
                    a.fk_agency_code = ddlAgency.SelectedValue;
                }
                else
                {
                    a.fk_agency_code = null;
                }

                a.life_reqd_yr = Convert.ToByte(ddlLifespan.SelectedValue);

                if (!string.IsNullOrEmpty(ddlAgronomic.SelectedValue))
                {
                    a.agronomic = ddlAgronomic.SelectedValue;
                }
                else
                {
                    a.agronomic = null;
                }

                if (!string.IsNullOrEmpty(ddlUnit.SelectedValue))
                {
                    a.fk_unit_code = ddlUnit.SelectedValue;
                }
                else
                {
                    a.fk_unit_code = null;
                }

                if (!string.IsNullOrEmpty(ddlWACPracticeCategory.SelectedValue))
                {
                    a.fk_list_wacPracticeCategory = Convert.ToInt32(ddlWACPracticeCategory.SelectedValue);
                }
                else
                {
                    a.fk_list_wacPracticeCategory = null;
                }

                if (!string.IsNullOrEmpty(tbABC.Text))
                {
                    try { a.ABC = Convert.ToDecimal(tbABC.Text); }
                    catch { sb.Append("ABC was not updated. Must be a number (Interger). "); }
                }

                if (!string.IsNullOrEmpty(tbABCNote.Text))
                {
                    a.ABC_note = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbABCNote.Text, 255);
                }
                else
                {
                    a.ABC_note = null;
                }

                a.active = ddlActive.SelectedValue;

                wDataContext.SubmitChanges();
                fvList_Ag_BMPPractice.ChangeMode(FormViewMode.ReadOnly);
                BindData_Ag_BMPPractice(Convert.ToDecimal(fvList_Ag_BMPPractice.DataKey.Value));

                if (!string.IsNullOrEmpty(sb.ToString()))
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
    protected void fvAg_WFP3_Encumbrance_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        int?     i     = null;
        int      iCode = 0;
        FormView fv    = fvAg_WFP3_Encumbrance;

        DropDownList ddlEncumbrance        = fv.FindControl("ddlEncumbrance") as DropDownList;
        CustomControls_AjaxCalendar ecDate = fvAg_WFP3_Encumbrance.FindControl("tbCalEncumbranceDate") as CustomControls_AjaxCalendar;
        TextBox tbAmount = fv.FindControl("tbAmount") as TextBox;
        TextBox tbNote   = fv.FindControl("tbNote") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                if (wDataContext.form_wfp3_get_okToEncumber(FK_Wfp3) != "N")
                {
                    string sEncumbrance = null;
                    if (!string.IsNullOrEmpty(ddlEncumbrance.SelectedValue))
                    {
                        sEncumbrance = ddlEncumbrance.SelectedValue;
                    }
                    else
                    {
                        sb.Append("Encumbrance is required. ");
                    }

                    DateTime?dtDate = ecDate.CalDateNotNullable;
                    if (dtDate == null)
                    {
                        sb.Append("Date is required. ");
                    }

                    decimal?dAmount = null;
                    if (!string.IsNullOrEmpty(tbAmount.Text))
                    {
                        try
                        {
                            dAmount = Convert.ToDecimal(tbAmount.Text);
                            if (dAmount < (decimal)0.01)
                            {
                                sb.Append("Encumbrance ammount must be greater than zero");
                            }
                        }
                        catch { sb.Append("Amount is incorrect. Must be a number (Decimal). "); }
                    }
                    else
                    {
                        sb.Append("Amount is required. ");
                    }

                    string sNote = null;
                    if (!string.IsNullOrEmpty(tbNote.Text))
                    {
                        sNote = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 255);
                    }

                    if (string.IsNullOrEmpty(sb.ToString()))
                    {
                        iCode = wDataContext.form_wfp3_encumbrance_add(FK_Wfp3, sEncumbrance, dtDate, dAmount, sNote, Session["userName"].ToString(), ref i);
                        if (iCode != 0)
                        {
                            WACAlert.Show("Error Returned from Database.", iCode);
                        }
                        else
                        {
                            PK_Wfp3Encumbrance = Convert.ToInt32(i);
                        }
                    }
                    else
                    {
                        WACAlert.Show(sb.ToString(), iCode);
                    }
                }
                else
                {
                    WACAlert.Show("It is not okay to encumber this package. ", 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
    protected void fvParticipant_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        DropDownList ddlActive           = fvParticipant.FindControl("ddlActive") as DropDownList;
        DropDownList ddlPrefix           = fvParticipant.FindControl("ddlPrefix") as DropDownList;
        TextBox      tbNameFirst         = fvParticipant.FindControl("tbNameFirst") as TextBox;
        TextBox      tbNameMiddle        = fvParticipant.FindControl("tbNameMiddle") as TextBox;
        TextBox      tbNameLast          = fvParticipant.FindControl("tbNameLast") as TextBox;
        DropDownList ddlSuffix           = fvParticipant.FindControl("ddlSuffix") as DropDownList;
        TextBox      tbNickname          = fvParticipant.FindControl("tbNickname") as TextBox;
        DropDownList ddlOrganization     = fvParticipant.FindControl("UC_DropDownListByAlphabet_Organization").FindControl("ddl") as DropDownList;
        TextBox      tbEmail             = fvParticipant.FindControl("tbEmail") as TextBox;
        TextBox      tbWeb               = fvParticipant.FindControl("tbWeb") as TextBox;
        DropDownList ddlRegionWAC        = fvParticipant.FindControl("ddlRegionWAC") as DropDownList;
        DropDownList ddlMailingStatus    = fvParticipant.FindControl("ddlMailingStatus") as DropDownList;
        DropDownList ddlGender           = fvParticipant.FindControl("ddlGender") as DropDownList;
        DropDownList ddlEthnicity        = fvParticipant.FindControl("ddlEthnicity") as DropDownList;
        DropDownList ddlRace             = fvParticipant.FindControl("ddlRace") as DropDownList;
        DropDownList ddlDiversityData    = fvParticipant.FindControl("ddlDiversityData") as DropDownList;
        Calendar     calFormW9SignedDate = fvParticipant.FindControl("UC_EditCalendar_Participant_FormW9SignedDate").FindControl("cal") as Calendar;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                var a = wDataContext.participants.Where(o => o.pk_participant == Convert.ToInt32(fvParticipant.DataKey.Value)).Select(s => s).Single();

                if (!string.IsNullOrEmpty(ddlActive.SelectedValue))
                {
                    a.active = ddlActive.SelectedValue;
                }

                if (!string.IsNullOrEmpty(ddlPrefix.SelectedValue))
                {
                    a.fk_prefix_code = ddlPrefix.SelectedValue;
                }
                else
                {
                    a.fk_prefix_code = null;
                }

                a.fname = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNameFirst.Text, 48).Trim();
                a.mname = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNameMiddle.Text, 24).Trim();
                a.lname = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNameLast.Text, 48).Trim();

                if (!string.IsNullOrEmpty(ddlSuffix.SelectedValue))
                {
                    a.fk_suffix_code = ddlSuffix.SelectedValue;
                }
                else
                {
                    a.fk_suffix_code = null;
                }

                a.nickname = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNickname.Text, 24).Trim();

                if (!string.IsNullOrEmpty(ddlOrganization.SelectedValue))
                {
                    a.fk_organization = Convert.ToInt32(ddlOrganization.SelectedValue);
                }
                else
                {
                    a.fk_organization = null;
                }

                a.email = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbEmail.Text, 48).Trim();
                a.web   = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbWeb.Text, 96).Trim();

                if (!string.IsNullOrEmpty(ddlRegionWAC.SelectedValue))
                {
                    a.fk_regionWAC_code = ddlRegionWAC.SelectedValue;
                }
                else
                {
                    a.fk_regionWAC_code = null;
                }

                a.fk_mailingStatus_code = ddlMailingStatus.SelectedValue;
                a.fk_gender_code        = ddlGender.SelectedValue;
                a.fk_ethnicity_code     = ddlEthnicity.SelectedValue;
                a.fk_race_code          = ddlRace.SelectedValue;
                a.fk_diversityData_code = ddlDiversityData.SelectedValue;

                if (calFormW9SignedDate.SelectedDate.Year > 1900)
                {
                    a.form_W9_signed_date = calFormW9SignedDate.SelectedDate;
                }
                else
                {
                    a.form_W9_signed_date = null;
                }

                //if (!string.IsNullOrEmpty(hfPropertyPK.Value)) a.fk_property = Convert.ToInt32(hfPropertyPK.Value);
                //else a.fk_property = null;

                a.modified    = DateTime.Now;
                a.modified_by = Session["userName"].ToString();

                wDataContext.SubmitChanges();
                fvParticipant.ChangeMode(FormViewMode.ReadOnly);
                BindParticipant(Convert.ToInt32(fvParticipant.DataKey.Value));
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
    protected void fvAg_WFP3_Encumbrance_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        StringBuilder sb = new StringBuilder();

        FormView fv = fvAg_WFP3_Encumbrance;

        DropDownList ddlEncumbrance        = fv.FindControl("ddlEncumbrance") as DropDownList;
        CustomControls_AjaxCalendar ecDate = fv.FindControl("tbCalEncumbranceDate") as CustomControls_AjaxCalendar;
        DropDownList ddlType  = fv.FindControl("ddlType") as DropDownList;
        TextBox      tbAmount = fv.FindControl("tbAmount") as TextBox;
        CustomControls_AjaxCalendar approvedDate = fv.FindControl("tbCalEncumbranceApprovedDate") as CustomControls_AjaxCalendar;
        TextBox tbNote = fv.FindControl("tbNote") as TextBox;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = wDataContext.form_wfp3_encumbrances.Where(w => w.pk_form_wfp3_encumbrance == Convert.ToInt32(fv.DataKey.Value)).Select(s => s).Single();
            try
            {
                if (!string.IsNullOrEmpty(ddlEncumbrance.SelectedValue))
                {
                    a.fk_encumbrance_code = ddlEncumbrance.SelectedValue;
                }
                else
                {
                    sb.Append("Encumbrance was not updated. Encumbrance is required. ");
                }

                DateTime?dt = ecDate.CalDateNullable;
                if (dt == null)
                {
                    sb.Append("Date was not updated. Date is required. ");
                }
                else
                {
                    a.date = (DateTime)ecDate.CalDateNullable;
                }

                if (!string.IsNullOrEmpty(ddlType.SelectedValue))
                {
                    a.fk_encumbranceType_code = ddlType.SelectedValue;
                }
                else
                {
                    a.fk_encumbranceType_code = null;
                }

                if (!string.IsNullOrEmpty(tbAmount.Text))
                {
                    try { a.amt = Convert.ToDecimal(tbAmount.Text); }
                    catch { sb.Append("Amount was not updated. Must be a number (Decimal). "); }
                }
                else
                {
                    sb.Append("Amount was not updated. Amount is required. ");
                }

                a.approved = approvedDate.CalDateNullable;

                if (!string.IsNullOrEmpty(tbNote.Text))
                {
                    a.note = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 255);
                }
                else
                {
                    a.note = null;
                }

                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); }
        }
    }
    protected void fvAg_WFP3_PaymentBMP_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        FormView      fv = fvAg_WFP3_PaymentBMP;
        DropDownList  ddlPaymentStatus      = fv.FindControl("ddlPaymentStatus") as DropDownList;
        TextBox       tbAmount              = fv.FindControl("tbAmount") as TextBox;
        TextBox       tbAmountFundingAgency = fv.FindControl("tbAmountFundingAgency") as TextBox;
        DropDownList  ddlFundingAgency      = fv.FindControl("ddlFundingAgency") as DropDownList;
        DropDownList  ddlReimbursementYN    = fv.FindControl("ddlReimbursementYN") as DropDownList;
        DropDownList  ddlBMPPractice        = fv.FindControl("ddlBMPPractice") as DropDownList;
        TextBox       tbNote         = fv.FindControl("tbNote") as TextBox;
        TextBox       tbNMCPPurchase = fv.FindControl("tbNMCPPurchase") as TextBox;
        StringBuilder sb             = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = (from b in wDataContext.form_wfp3_paymentBMPs.Where(w => w.pk_form_wfp3_paymentBMP == Convert.ToInt32(fv.DataKey.Value))
                     select b).Single();
            try
            {
                if (!string.IsNullOrEmpty(ddlPaymentStatus.SelectedValue))
                {
                    a.fk_paymentStatus_code = ddlPaymentStatus.SelectedValue;
                }
                else
                {
                    sb.Append("Payment Status was not updated. This field is required. ");
                }

                try { a.amt = Convert.ToDecimal(tbAmount.Text); }
                catch { sb.Append("Amount was not updated. This field is required. Data type is number (Decimal). "); }

                try
                {
                    if (!string.IsNullOrEmpty(tbAmountFundingAgency.Text))
                    {
                        a.amt_agencyFunding = Convert.ToDecimal(tbAmountFundingAgency.Text);
                    }
                    else
                    {
                        a.amt_agencyFunding = null;
                    }
                }
                catch { }

                if (!string.IsNullOrEmpty(ddlFundingAgency.SelectedValue))
                {
                    a.fk_agencyFunding_code = ddlFundingAgency.SelectedValue;
                }

                if (!string.IsNullOrEmpty(ddlBMPPractice.SelectedValue))
                {
                    a.fk_bmpPractice_code = Convert.ToDecimal(ddlBMPPractice.SelectedValue);
                }
                else
                {
                    a.fk_bmpPractice_code = null;
                }

                if (!string.IsNullOrEmpty(tbNMCPPurchase.Text))
                {
                    a.purchaseNMCP = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNMCPPurchase.Text, 255);
                }
                else
                {
                    a.purchaseNMCP = null;
                }

                if (!string.IsNullOrEmpty(tbNote.Text))
                {
                    a.note = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 255);
                }
                else
                {
                    a.note = null;
                }
                a.reimbursement = ddlReimbursementYN.SelectedValue;
                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); }
        }
    }
示例#26
0
    protected void fvAg_WFP3_Payment_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        FormView fv = fvAg_WFP3_Payment;

        DropDownList ddlPayee   = fv.FindControl("ddlPayee") as DropDownList;
        DropDownList ddlInvoice = fv.FindControl("ddlInvoice") as DropDownList;
        CustomControls_AjaxCalendar tbCalPaymentDate = fv.FindControl("tbCalPaymentDate") as CustomControls_AjaxCalendar;
        TextBox      tbCheckNumber  = fv.FindControl("tbCheckNumber") as TextBox;
        DropDownList ddlEncumbrance = fv.FindControl("ddlEncumbrance") as DropDownList;
        //DropDownList ddlIsContractor = fv.FindControl("ddlIsContractor") as DropDownList;
        //DropDownList ddlFlood2006 = fv.FindControl("ddlFlood2006") as DropDownList;
        TextBox tbNote = fv.FindControl("tbNote") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = (from b in wDataContext.form_wfp3_payments.Where(w => w.pk_form_wfp3_payment == Convert.ToInt32(fv.DataKey.Value))
                     select b).Single();
            try
            {
                if (!string.IsNullOrEmpty(ddlPayee.SelectedValue))
                {
                    a.fk_participant_payee = Convert.ToInt32(ddlPayee.SelectedValue);
                }
                else
                {
                    sb.Append("Payee was not updated. This is a required field. ");
                }

                if (!string.IsNullOrEmpty(ddlInvoice.SelectedValue))
                {
                    a.fk_form_wfp3_invoice = Convert.ToInt32(ddlInvoice.SelectedValue);
                }
                else
                {
                    a.fk_form_wfp3_invoice = null;
                }

                a.date = (DateTime)tbCalPaymentDate.CalDateNullable;

                if (!string.IsNullOrEmpty(tbCheckNumber.Text))
                {
                    a.check_nbr = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbCheckNumber.Text, 16);
                }
                else
                {
                    sb.Append("Check Number was not updated. This is a required field. ");
                }

                if (!string.IsNullOrEmpty(ddlEncumbrance.SelectedValue))
                {
                    a.fk_encumbrance_code = ddlEncumbrance.SelectedValue;
                }
                else
                {
                    sb.Append("Encumbrance was not updated. This is a required field. ");
                }

                //if (!string.IsNullOrEmpty(ddlIsContractor.SelectedValue)) a.is_contractor = ddlIsContractor.SelectedValue;
                //else a.is_contractor = null;

                //if (!string.IsNullOrEmpty(ddlFlood2006.SelectedValue)) a.flood_2006 = ddlFlood2006.SelectedValue;
                //else a.flood_2006 = null;

                a.note = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 400);

                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); }
        }
    }
示例#27
0
    protected void fvAg_WFP3_Bid_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        int?     i     = null;
        int      iCode = 0;
        FormView fv    = fvAg_WFP3_Bid;

        DropDownList ddlContractor = fv.FindControl("ddlContractor") as DropDownList;
        TextBox      tbBidAmount   = fv.FindControl("tbBidAmount") as TextBox;
        CustomControls_AjaxCalendar tbCalBidAwardDate = fv.FindControl("tbCalBidAwardDate") as CustomControls_AjaxCalendar;
        TextBox tbModificationAmount = fv.FindControl("tbModificationAmount") as TextBox;
        TextBox tbBidRank            = fv.FindControl("tbBidRank") as TextBox;
        TextBox tbNote = fv.FindControl("tbNote") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                int?iContractorFK = null;
                if (!string.IsNullOrEmpty(ddlContractor.SelectedValue))
                {
                    iContractorFK = Convert.ToInt32(ddlContractor.SelectedValue);
                }
                else
                {
                    sb.Append("Contractor is required. ");
                }

                decimal?dBidAmount = null;
                try { if (!string.IsNullOrEmpty(tbBidAmount.Text))
                      {
                          dBidAmount = Convert.ToDecimal(tbBidAmount.Text);
                      }
                }
                catch { }
                if (dBidAmount == null || dBidAmount == 0)
                {
                    sb.Append("Bid Amount is required and must be greater than 0. ");
                }

                decimal?dModificationAmount = null;
                try { if (!string.IsNullOrEmpty(tbModificationAmount.Text))
                      {
                          dModificationAmount = Convert.ToDecimal(tbModificationAmount.Text);
                      }
                }
                catch { }

                string sNote = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 255);

                byte?byBidRank = null;
                try { if (!string.IsNullOrEmpty(tbBidRank.Text))
                      {
                          byBidRank = Convert.ToByte(tbBidRank.Text);
                      }
                }
                catch { }

                DateTime?dtBidAwarded = tbCalBidAwardDate.CalDateNullable;

                if (string.IsNullOrEmpty(sb.ToString()))
                {
                    iCode = wDataContext.form_wfp3_bid_add(FK_Wfp3, iContractorFK, dBidAmount, dModificationAmount, sNote, byBidRank, dtBidAwarded, Session["userName"].ToString(), ref i);
                    if (iCode != 0)
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                    else
                    {
                        PK_Wfp3Bid = Convert.ToInt32(i);
                    }
                }
                else
                {
                    WACAlert.Show(sb.ToString(), iCode);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
示例#28
0
    protected void fvAg_WFP3_Payment_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        int?     i     = null;
        int      iCode = 0;
        FormView fv    = fvAg_WFP3_Payment;

        DropDownList ddlPayee   = fv.FindControl("ddlPayee") as DropDownList;
        DropDownList ddlInvoice = fv.FindControl("ddlInvoice") as DropDownList;
        CustomControls_AjaxCalendar tbCalPaymentDate = fv.FindControl("tbCalPaymentDate") as CustomControls_AjaxCalendar;
        TextBox      tbCheckNumber  = fv.FindControl("tbCheckNumber") as TextBox;
        DropDownList ddlEncumbrance = fv.FindControl("ddlEncumbrance") as DropDownList;
        //DropDownList ddlIsContractor = fv.FindControl("ddlIsContractor") as DropDownList;
        TextBox tbNote = fv.FindControl("tbNote") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                int?iPayee = null;
                if (!string.IsNullOrEmpty(ddlPayee.SelectedValue))
                {
                    iPayee = Convert.ToInt32(ddlPayee.SelectedValue);
                }
                else
                {
                    sb.Append("Payee is required. ");
                }

                int?iInvoice = null;
                if (!string.IsNullOrEmpty(ddlInvoice.SelectedValue))
                {
                    iInvoice = Convert.ToInt32(ddlInvoice.SelectedValue);
                }

                DateTime?dtDate = tbCalPaymentDate.CalDateNullable;

                string sCheckNumber = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbCheckNumber.Text, 16);
                if (string.IsNullOrEmpty(sCheckNumber))
                {
                    sb.Append("Check Number is required. ");
                }

                string sEncumbrance = null;
                if (!string.IsNullOrEmpty(ddlEncumbrance.SelectedValue))
                {
                    sEncumbrance = ddlEncumbrance.SelectedValue;
                }
                else
                {
                    sb.Append("Encumbrance is required. ");
                }

                //string sIsContractor = null;
                //if (!string.IsNullOrEmpty(ddlIsContractor.SelectedValue)) sIsContractor = ddlIsContractor.SelectedValue;

                string sNote = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 400);

                if (string.IsNullOrEmpty(sb.ToString()))
                {
                    iCode = wDataContext.form_wfp3_payment_add(FK_Wfp3, iPayee, iInvoice, dtDate, sCheckNumber, sEncumbrance, sNote, Session["userName"].ToString(), ref i);
                    if (iCode != 0)
                    {
                        WACAlert.Show("Error Returned from Database. " + sb.ToString(), iCode);
                    }
                    else
                    {
                        PK_Wfp3Payment = Convert.ToInt32(i);
                    }
                }
                else
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
    protected void fvBMPPlanning_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        int?i     = null;
        int iCode = 0;

        DropDownList ddlFarm                 = fvBMPPlanning.FindControl("ddlFarm") as DropDownList;
        DropDownList ddlBMPSource            = fvBMPPlanning.FindControl("ddlBMPSource") as DropDownList;
        DropDownList ddlRevisionDescription  = fvBMPPlanning.FindControl("ddlRevisionDescription") as DropDownList;
        DropDownList ddlPollutantCategory    = fvBMPPlanning.FindControl("ddlPollutantCategory") as DropDownList;
        TextBox      tbBMPNumber             = fvBMPPlanning.FindControl("tbBMPNumber") as TextBox;
        TextBox      tbDescription           = fvBMPPlanning.FindControl("tbDescription") as TextBox;
        TextBox      tbSubIssueStatement     = fvBMPPlanning.FindControl("tbSubIssueStatement") as TextBox;
        DropDownList ddlBMPPractice          = fvBMPPlanning.FindControl("ddlBMPPractice") as DropDownList;
        TextBox      tbUnitsPlanned          = fvBMPPlanning.FindControl("tbUnitsPlanned") as TextBox;
        TextBox      tbPriorPlanningEstimate = fvBMPPlanning.FindControl("tbPriorPlanningEstimate") as TextBox;
        TextBox      tbPlanningEstimate      = fvBMPPlanning.FindControl("tbPlanningEstimate") as TextBox;
        //DropDownList ddlImplementationYear = fvBMPPlanning.FindControl("ddlImplementationYear") as DropDownList;
        TextBox      tbLocation = fvBMPPlanning.FindControl("tbLocation") as TextBox;
        DropDownList ddlCREP    = fvBMPPlanning.FindControl("ddlCREP") as DropDownList;
        //DropDownList ddlNMCPType = fvBMPPlanning.FindControl("ddlNMCPType") as DropDownList;
        DropDownList ddlSAA = fvBMPPlanning.FindControl("ddlSAA") as DropDownList;
        DropDownList ddlSA  = fvBMPPlanning.FindControl("ddlSA") as DropDownList;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                int?iPK_FarmBusiness = null;
                if (!string.IsNullOrEmpty(ddlFarm.SelectedValue))
                {
                    iPK_FarmBusiness = Convert.ToInt32(ddlFarm.SelectedValue);
                }
                else
                {
                    sb.Append("Farm is required. ");
                }

                string sBMPSource = ddlBMPSource.SelectedValue;

                string sPollutant = null;
                if (!string.IsNullOrEmpty(ddlPollutantCategory.SelectedValue))
                {
                    sPollutant = ddlPollutantCategory.SelectedValue;
                }
                else
                {
                    sb.Append("Pollutant is required. ");
                }

                string sBMPNumber = null;
                if (!string.IsNullOrEmpty(tbBMPNumber.Text))
                {
                    sBMPNumber = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbBMPNumber.Text, 24);
                }
                else
                {
                    sb.Append("BMP Number is required. ");
                }

                string sDescription = null;
                if (!string.IsNullOrEmpty(tbDescription.Text))
                {
                    sDescription = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbDescription.Text, 400);
                }
                string  sSubIssueStatement = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbSubIssueStatement.Text, 1000);
                decimal?dPractice          = null;
                if (!string.IsNullOrEmpty(ddlBMPPractice.SelectedValue))
                {
                    dPractice = Convert.ToDecimal(ddlBMPPractice.SelectedValue);
                }
                else
                {
                    sb.Append("Practice is required. ");
                }

                decimal?dUnitsPlanned = null;
                if (!string.IsNullOrEmpty(tbUnitsPlanned.Text))
                {
                    try { dUnitsPlanned = Convert.ToDecimal(tbUnitsPlanned.Text); }
                    catch { }
                }

                decimal?dEstPlanPrior = null;
                if (!string.IsNullOrEmpty(tbPriorPlanningEstimate.Text))
                {
                    try { dEstPlanPrior = Convert.ToDecimal(tbPriorPlanningEstimate.Text); }
                    catch { }
                }
                else
                {
                    sb.Append("Prior Planning Estimate is required. ");
                }

                decimal?dCurrentPlanningEstimate = null;
                if (!string.IsNullOrEmpty(tbPlanningEstimate.Text))
                {
                    try { dCurrentPlanningEstimate = Convert.ToDecimal(tbPlanningEstimate.Text); }
                    catch { sb.Append("Current Planning Estimate must be a number (Decimal). "); }
                }
                else
                {
                    sb.Append("Current Planning Estimate is required. ");
                }

                string sCREP = null;
                if (!string.IsNullOrEmpty(ddlCREP.SelectedValue))
                {
                    sCREP = ddlCREP.SelectedValue;
                }

                string sBMPStatus = "DR";

                //short? shScheduledImplementationYear = null;
                //if (!string.IsNullOrEmpty(ddlImplementationYear.SelectedValue)) shScheduledImplementationYear = Convert.ToInt16(ddlImplementationYear.SelectedValue);
                //else sb.Append("Implementation Year is required. ");

                //string sNMCPType = null;
                //if (!string.IsNullOrEmpty(ddlNMCPType.SelectedValue)) sNMCPType = ddlNMCPType.SelectedValue;

                string sLocation = null;
                if (!string.IsNullOrEmpty(tbLocation.Text))
                {
                    sLocation = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbLocation.Text, 96);
                }

                string sRevisionDescription = null;
                if (!string.IsNullOrEmpty(ddlRevisionDescription.SelectedValue))
                {
                    sRevisionDescription = ddlRevisionDescription.SelectedValue;
                }

                string sSAAssignType = null;
                int?   iPK_SupplementalAgreementTaxParcel = null;
                if (!string.IsNullOrEmpty(ddlSAA.SelectedValue) && !string.IsNullOrEmpty(ddlSA.SelectedValue))
                {
                    sSAAssignType = ddlSAA.SelectedValue;
                    iPK_SupplementalAgreementTaxParcel = Convert.ToInt32(ddlSA.SelectedValue);
                }
                else
                {
                    if ((!string.IsNullOrEmpty(ddlSAA.SelectedValue) && string.IsNullOrEmpty(ddlSA.SelectedValue)) || (string.IsNullOrEmpty(ddlSAA.SelectedValue) && !string.IsNullOrEmpty(ddlSA.SelectedValue)))
                    {
                        sb.Append("Both Supplemental Agreement Assignment and Supplemental Agreement must be defined when attaching a Supplemental Agreement. ");
                    }
                }


                string sfk_BMPSortGroup_code = null;
                //if (!string.IsNullOrEmpty(sfk_BMPSortGroup_code.Text)) sLocation = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbLocation.Text, 96);

                if (string.IsNullOrEmpty(sb.ToString()))
                {
                    iCode = wDataContext.bmp_ag_add_express(iPK_FarmBusiness, sPollutant, sBMPNumber, sDescription, dPractice,
                                                            dUnitsPlanned, dEstPlanPrior, dCurrentPlanningEstimate, sCREP, sBMPStatus, sBMPSource, sLocation, sRevisionDescription,
                                                            sSAAssignType, iPK_SupplementalAgreementTaxParcel, sfk_BMPSortGroup_code, null, null, sSubIssueStatement,
                                                            Session["userName"].ToString(), ref i);
                    if (iCode == 0)
                    {
                        fvBMPPlanning.ChangeMode(FormViewMode.ReadOnly);
                        BindData_BMPPlanning_FormView(Convert.ToInt32(i));
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
                else
                {
                    sb.Insert(0, "The Insert Failed: ");
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
示例#30
0
    protected void fvVenue_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        TextBox      tbLocation   = fvVenue.FindControl("tbLocation") as TextBox;
        TextBox      tbNote       = fvVenue.FindControl("tbNote") as TextBox;
        DropDownList ddlPhone     = fvVenue.FindControl("UC_Communication_EditInsert_Phone").FindControl("ddlNumber") as DropDownList;
        DropDownList ddlFax       = fvVenue.FindControl("UC_Communication_EditInsert_Fax").FindControl("ddlNumber") as DropDownList;
        TextBox      tbEmail      = fvVenue.FindControl("tbEmail") as TextBox;
        HiddenField  hfPropertyPK = fvVenue.FindControl("UC_Property_EditInsert1").FindControl("hfPropertyPK") as HiddenField;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = (from b in wDataContext.eventVenues.Where(w => w.pk_eventVenue == Convert.ToInt32(fvVenue.DataKey.Value)) select b).Single();

            if (!string.IsNullOrEmpty(tbLocation.Text))
            {
                a.location = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbLocation.Text, 48).Trim();
            }
            else
            {
                sb.Append("Location was not updated. This is a required field. ");
            }

            if (!string.IsNullOrEmpty(ddlPhone.SelectedValue))
            {
                a.fk_communication_phone = Convert.ToInt32(ddlPhone.SelectedValue);
            }
            else
            {
                a.fk_communication_phone = null;
            }

            if (!string.IsNullOrEmpty(ddlFax.SelectedValue))
            {
                a.fk_communication_fax = Convert.ToInt32(ddlFax.SelectedValue);
            }
            else
            {
                a.fk_communication_fax = null;
            }

            a.email = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbEmail.Text, 48).Trim();

            a.note = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 255).Trim();

            if (!string.IsNullOrEmpty(hfPropertyPK.Value))
            {
                a.fk_property = Convert.ToInt32(hfPropertyPK.Value);
            }
            else
            {
                a.fk_property = null;
            }

            a.modified    = DateTime.Now;
            a.modified_by = Session["userName"].ToString();

            try
            {
                wDataContext.SubmitChanges();
                fvVenue.ChangeMode(FormViewMode.ReadOnly);
                BindVenue(Convert.ToInt32(fvVenue.DataKey.Value));

                if (!string.IsNullOrEmpty(sb.ToString()))
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }