Exemplo n.º 1
0
    protected void fvHR_WACEmployee_Activity_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        PK_ParticipantActivity = Convert.ToInt32(fvHR_WACEmployee_Activity.DataKey.Value);
        TextBox tbDate = fvHR_WACEmployee_Activity.FindControl("AjaxCalendar_Date").FindControl("tb") as TextBox;
        TextBox tbNote = fvHR_WACEmployee_Activity.FindControl("tbNote") as TextBox;

        using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
        {
            try
            {
                var x = wac.participantWAC_activities.Where(w => w.pk_participantWAC_activity == PK_ParticipantActivity).Select(s => s).Single();
                try { x.date = Convert.ToDateTime(tbDate.Text); }
                catch { throw new Exception("Date was not updated. Invalid date. "); }
                if (!string.IsNullOrEmpty(tbNote.Text))
                {
                    x.note = tbNote.Text;
                }
                else
                {
                    x.note = null;
                }
                x.modified    = DateTime.Now;
                x.modified_by = Session["userName"].ToString();
                wac.SubmitChanges();
                fvHR_WACEmployee_Activity.ChangeMode(FormViewMode.ReadOnly);
                BindHR_WACEmployee_Activity();
                OnFormActionCompleted(this, new FormViewEventArgs(FK_ParticipantWAC, "activity"));
            }
            catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
        }
    }
Exemplo n.º 2
0
    protected void fvAg_WFP3_Technician_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        StringBuilder sb = new StringBuilder();
        DropDownList  ddlAg_WFP3_Technician_Type = fvAg_WFP3_Technician.FindControl("ddlAg_WFP3_Technician_Type") as DropDownList;
        DropDownList  ddlTechnician = fvAg_WFP3_Technician.FindControl("ddlTechnician") as DropDownList;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = wDataContext.form_wfp3_teches.Where(w => w.pk_form_wfp3_tech == PK_Wfp3Tech).Select(s => s).Single();
            try
            {
                if (!string.IsNullOrEmpty(ddlAg_WFP3_Technician_Type.SelectedValue) && !string.IsNullOrEmpty(ddlTechnician.SelectedValue))
                {
                    a.fk_designerEngineerType_code = ddlAg_WFP3_Technician_Type.SelectedValue;
                    a.fk_list_designerEngineer     = Convert.ToInt32(ddlTechnician.SelectedValue);
                }
                else
                {
                    sb.Append("Type and Technician were not updated. Type and Technician are required. ");
                }

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

                wDataContext.SubmitChanges();

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

        //Calendar calAgreementDate = fvSA.FindControl("UC_EditCalendar_SA_AgreementDate").FindControl("cal") as Calendar;
        //Calendar calInactiveDate = fvSA.FindControl("UC_EditCalendar_SA_InactiveDate").FindControl("cal") as Calendar;
        CustomControls_AjaxCalendar tbCalAgreementDate = (CustomControls_AjaxCalendar)fvSA.FindControl("tbCalAgreementDate");
        CustomControls_AjaxCalendar tbCalInactiveDate  = (CustomControls_AjaxCalendar)fvSA.FindControl("tbCalInactiveDate");

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = wDataContext.supplementalAgreements.Where(w => w.pk_supplementalAgreement == Convert.ToInt32(fvSA.DataKey.Value)).Select(s => s).Single();
            try
            {
                a.agreement_date = tbCalAgreementDate.CalDateNotNullable;

                //if (calInactiveDate.SelectedDate.Year > 1900) a.inactive_date = calInactiveDate.SelectedDate;
                //else a.inactive_date = null;
                a.inactive_date = tbCalInactiveDate.CalDateNullable;

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

                wDataContext.SubmitChanges();
                fvSA.ChangeMode(FormViewMode.ReadOnly);
                Populate_SA_FormView(Convert.ToInt32(fvSA.DataKey.Value));

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

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

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = wDataContext.supplementalAgreementNotes.Where(w => w.pk_supplementalAgreementNote == Convert.ToInt32(fv.DataKey.Value)).Select(s => s).Single();
            try
            {
                a.note = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbNote.Text, 255);

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

                wDataContext.SubmitChanges();
                fv.ChangeMode(FormViewMode.ReadOnly);
                Populate_SA_Note_FormView(fv, Convert.ToInt32(fv.DataKey.Value));

                if (!string.IsNullOrEmpty(sb.ToString()))
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
Exemplo n.º 5
0
    public void fvHR_WACEmployee_Note_ItemUpdating(object sender, EventArgs e)
    {
        PK_ParticipantNote = Convert.ToInt32(fvHR_WACEmployee_Note.DataKey.Value);
        DropDownList ddlPosition = fvHR_WACEmployee_Note.FindControl("ddlPosition") as DropDownList;
        TextBox      tbNote      = fvHR_WACEmployee_Note.FindControl("tbNote") as TextBox;

        using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
        {
            try
            {
                var x = wac.participantWAC_notes.Where(w => w.pk_participantWAC_note == PK_ParticipantNote).Select(s => s).Single();

                // Position - not required
                if (!string.IsNullOrEmpty(ddlPosition.SelectedValue))
                {
                    x.fk_positionWAC_code = ddlPosition.SelectedValue;
                }
                // Note - required
                if (!string.IsNullOrEmpty(tbNote.Text))
                {
                    x.note = tbNote.Text;
                }
                x.modified    = DateTime.Now;
                x.modified_by = Session["userName"].ToString();
                wac.SubmitChanges();
                fvHR_WACEmployee_Note.ChangeMode(FormViewMode.ReadOnly);
                BindHR_WACEmployee_Note();
                OnFormActionCompleted(this, new FormViewEventArgs(FK_ParticipantWAC, "note"));
            }
            catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
        }
    }
    protected void fv_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        DropDownList ddlYear   = fv.FindControl("ddlYear") as DropDownList;
        DropDownList ddlSource = fv.FindControl("ddlSource") as DropDownList;
        TextBox      tbAmt     = fv.FindControl("tbAmt") as TextBox;

        StringBuilder sb = new StringBuilder();

        try
        {
            using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
            {
                var x = wac.agWorkloadFundings.Where(w => w.pk_agWorkloadFunding == Convert.ToInt32(fv.DataKey.Value)).Select(s => s).Single();

                if (!string.IsNullOrEmpty(ddlYear.SelectedValue))
                {
                    x.year = Convert.ToInt16(ddlYear.SelectedValue);
                }
                else
                {
                    sb.Append("Year is required. ");
                }

                if (!string.IsNullOrEmpty(ddlSource.SelectedValue))
                {
                    x.fk_agWorkloadFunding_code = ddlSource.SelectedValue;
                }
                else
                {
                    sb.Append("Source is required. ");
                }

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

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

                wac.SubmitChanges();
                fv.ChangeMode(FormViewMode.ReadOnly);
                BindWorkloadFunding(Convert.ToInt32(fv.DataKey.Value));

                if (!string.IsNullOrEmpty(sb.ToString()))
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
        }
        catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
    }
Exemplo n.º 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); }
        }
    }
Exemplo n.º 8
0
    protected void fvHR_WACEmployee_ActivityCost_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        FormView     fvHR_WACEmployee_ActivityCost = fvHR_WACEmployee_Activity.FindControl("fvHR_WACEmployee_ActivityCost") as FormView;
        TextBox      tbDate  = fvHR_WACEmployee_ActivityCost.FindControl("AjaxCalendar_Date").FindControl("tb") as TextBox;
        DropDownList ddlItem = fvHR_WACEmployee_ActivityCost.FindControl("ddlItem") as DropDownList;
        TextBox      tbCost  = fvHR_WACEmployee_ActivityCost.FindControl("tbCost") as TextBox;
        TextBox      tbNote  = fvHR_WACEmployee_ActivityCost.FindControl("tbNote") as TextBox;

        using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
        {
            try
            {
                var x = wac.participantWAC_activityCosts.Where(w => w.pk_participantWAC_activityCost ==
                                                               Convert.ToInt32(fvHR_WACEmployee_ActivityCost.DataKey.Value)).Select(s => s).Single();
                try { x.date = Convert.ToDateTime(tbDate.Text); }
                catch { throw new Exception("Date missing or invalid. Date is required."); }

                if (!string.IsNullOrEmpty(ddlItem.SelectedValue))
                {
                    x.fk_trainingCost_code = ddlItem.SelectedValue;
                }
                else
                {
                    throw new Exception("Item is required. ");
                }

                try { x.cost = Convert.ToDecimal(tbCost.Text); }
                catch { throw new Exception("Cost missing or invalid.  Cost is required."); }

                if (!string.IsNullOrEmpty(tbNote.Text))
                {
                    x.note = tbNote.Text;
                }
                else
                {
                    x.note = null;
                }

                x.modified    = DateTime.Now;
                x.modified_by = Session["userName"].ToString();
                wac.SubmitChanges();
                fvHR_WACEmployee_ActivityCost.ChangeMode(FormViewMode.ReadOnly);
                BindHR_WACEmployee_ActivityCost(Convert.ToInt32(fvHR_WACEmployee_ActivityCost.DataKey.Value));
            }
            catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
        }
    }
Exemplo n.º 9
0
    protected void fvCommunication_PhoneNumber_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        TextBox tbAreaCode    = fvCommunication_PhoneNumber.FindControl("tbAreaCode") as TextBox;
        TextBox tbPhoneNumber = fvCommunication_PhoneNumber.FindControl("tbPhoneNumber") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = wDataContext.communications.Where(w => w.pk_communication == Convert.ToInt32(fvCommunication_PhoneNumber.DataKey.Value)).Select(s => s).Single();

            if (!string.IsNullOrEmpty(tbAreaCode.Text))
            {
                a.areacode = WACGlobal_Methods.Format_Global_PhoneNumber_StripToNumbers(tbAreaCode.Text, WACGlobal_Methods.Enum_Number_Type.AREACODE);
            }
            else
            {
                sb.Append("Area Code was not updated. Area Code is required. ");
            }

            if (!string.IsNullOrEmpty(tbPhoneNumber.Text))
            {
                a.number = WACGlobal_Methods.Format_Global_PhoneNumber_StripToNumbers(tbPhoneNumber.Text, WACGlobal_Methods.Enum_Number_Type.PHONENUMBER);
            }
            else
            {
                sb.Append("Phone Number was not updated. Phone Number is required. ");
            }

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

            try
            {
                wDataContext.SubmitChanges();
                fvCommunication_PhoneNumber.ChangeMode(FormViewMode.ReadOnly);
                BindCommunication_PhoneNumber(Convert.ToInt32(fvCommunication_PhoneNumber.DataKey.Value));

                if (!string.IsNullOrEmpty(sb.ToString()))
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
Exemplo n.º 10
0
    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 fvSA_TaxParcel_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        StringBuilder sb = new StringBuilder();

        FormView     fv             = fvSA.FindControl("fvSA_TaxParcel") as FormView;
        DropDownList ddlTaxParcelID = fv.FindControl("ddlTaxParcelID") as DropDownList;
        //Calendar calCancelDate = fv.FindControl("UC_EditCalendar_SA_TaxParcel_CancelDate").FindControl("cal") as Calendar;
        CustomControls_AjaxCalendar tbCalCancelDate = (CustomControls_AjaxCalendar)fv.FindControl("tbCalTaxParcelCancelDate");

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = wDataContext.supplementalAgreementTaxParcels.Where(w => w.pk_supplementalAgreementTaxParcel == Convert.ToInt32(fv.DataKey.Value)).Select(s => s).Single();
            try
            {
                if (!string.IsNullOrEmpty(ddlTaxParcelID.SelectedValue))
                {
                    a.fk_taxParcel = Convert.ToInt32(ddlTaxParcelID.SelectedValue);
                }
                else
                {
                    sb.Append("Tax Parcel ID was not updated. Tax Parcel ID is required. ");
                }

                //if (calCancelDate.SelectedDate.Year > 1900) a.cancel_date = calCancelDate.SelectedDate;
                //else a.cancel_date = null;
                a.cancel_date = tbCalCancelDate.CalDateNullable;

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

                wDataContext.SubmitChanges();
                fv.ChangeMode(FormViewMode.ReadOnly);
                Populate_SA_TaxParcel_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); }
        }
    }
Exemplo n.º 12
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); }
        }
    }
Exemplo n.º 13
0
    protected void fvParticipant_Property_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        DropDownList ddlMaster    = fvParticipant_Property.FindControl("ddlMaster") as DropDownList;
        HiddenField  hfPropertyPK = fvParticipant_Property.FindControl("UC_Property_EditInsert1").FindControl("hfPropertyPK") as HiddenField;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                var a = wDataContext.participantProperties.Where(w => w.pk_participantProperty == Convert.ToInt32(fvParticipant_Property.DataKey.Value)).Select(s => s).Single();

                a.master = ddlMaster.SelectedValue;

                if (!string.IsNullOrEmpty(hfPropertyPK.Value))
                {
                    a.fk_property = Convert.ToInt32(hfPropertyPK.Value);
                }
                else
                {
                    sb.Append("Property was not updated. Property is required. ");
                }

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

                wDataContext.SubmitChanges();
                fvParticipant_Property.ChangeMode(FormViewMode.ReadOnly);
                Participant_Property_BindRecord(Convert.ToInt32(fvParticipant_Property.DataKey.Value));

                if (!string.IsNullOrEmpty(sb.ToString()))
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
Exemplo n.º 14
0
    protected void fvHR_WACEmployee_Phone_ItemUpdating(object sender, EventArgs e)
    {
        PK_ParticipantWAC_Phone = Convert.ToInt32(fvHR_WACEmployee_Phone.DataKey.Value);
        DropDownList    ddl                = fvHR_WACEmployee_Phone.FindControl("ddlPhone") as DropDownList;
        RadioButtonList rblPublicNumber    = fvHR_WACEmployee_Phone.FindControl("rblPublicNumber") as RadioButtonList;
        RadioButtonList rblEmergencyNumber = fvHR_WACEmployee_Phone.FindControl("rblEmergencyNumber") as RadioButtonList;

        using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
        {
            try
            {
                var x = wac.participantWAC_phones.Where(w => w.pk_participantWAC_phone == PK_ParticipantWAC_Phone).Select(s => s).Single();
                if (!string.IsNullOrEmpty(rblPublicNumber.SelectedValue))
                {
                    x.publicUsage = rblPublicNumber.SelectedValue;
                }
                else
                {
                    x.publicUsage = "N";
                }
                if (!string.IsNullOrEmpty(rblEmergencyNumber.SelectedValue))
                {
                    x.emergency = rblEmergencyNumber.SelectedValue;
                }
                else
                {
                    x.emergency = "N";
                }
                x.modified    = DateTime.Now;
                x.modified_by = Session["userName"].ToString();
                wac.SubmitChanges();
                fvHR_WACEmployee_Phone.ChangeMode(FormViewMode.ReadOnly);
                BindHR_WACEmployeePhone();
                OnFormActionCompleted(this, new FormViewEventArgs(FK_ParticipantWAC, "phone"));
            }
            catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
        }
    }
Exemplo n.º 15
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); }
        }
    }
Exemplo n.º 16
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); }
        }
    }
Exemplo n.º 17
0
    protected void fvParticipant_Communication_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        DropDownList ddlType       = fvParticipant_Communication.FindControl("ddlType") as DropDownList;
        DropDownList ddlUsage      = fvParticipant_Communication.FindControl("ddlUsage") as DropDownList;
        TextBox      tbAreaCode    = fvParticipant_Communication.FindControl("tbAreaCode") as TextBox;
        TextBox      tbPhoneNumber = fvParticipant_Communication.FindControl("tbPhoneNumber") as TextBox;
        //DropDownList ddlPhone = fvParticipant_Communication.FindControl("UC_Communication_EditInsert_Phone").FindControl("ddlNumber") as DropDownList;
        TextBox tbExtension = fvParticipant_Communication.FindControl("tbExtension") as TextBox;
        TextBox tbNote      = fvParticipant_Communication.FindControl("tbNote") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                int?i     = null;
                int iCode = 0;
                iCode = wDataContext.communication_add(tbAreaCode.Text, tbPhoneNumber.Text, Session["userName"].ToString(), ref i);
                if (iCode != 0)
                {
                    i = null;
                }

                var a = wDataContext.participantCommunications.Where(w => w.pk_participantCommunication == Convert.ToInt32(fvParticipant_Communication.DataKey.Value)).Select(s => s).Single();

                if (!string.IsNullOrEmpty(ddlType.SelectedValue))
                {
                    a.fk_communicationType_code = ddlType.SelectedValue;
                }
                else
                {
                    sb.Append("Type was not updated. Type is required. ");
                }

                if (!string.IsNullOrEmpty(ddlUsage.SelectedValue))
                {
                    a.fk_communicationUsage_code = ddlUsage.SelectedValue;
                }
                else
                {
                    sb.Append("Usage was not updated. Usage is required. ");
                }

                if (i != null)
                {
                    a.fk_communication = Convert.ToInt32(i);
                }
                else
                {
                    sb.Append("Phone Number was not updated. Bad Phone Number. ");
                }

                //if (!string.IsNullOrEmpty(ddlPhone.SelectedValue)) a.fk_communication = Convert.ToInt32(ddlPhone.SelectedValue);
                //else sb.Append("Phone Number was not updated. Phone Number is required. ");

                a.extension = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbExtension.Text, 8).Trim();

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

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

                wDataContext.SubmitChanges();
                fvParticipant_Communication.ChangeMode(FormViewMode.ReadOnly);
                Participant_Communication_BindRecord(Convert.ToInt32(fvParticipant_Communication.DataKey.Value));

                if (!string.IsNullOrEmpty(sb.ToString()))
                {
                    WACAlert.Show(sb.ToString(), 0);
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }
Exemplo n.º 18
0
    protected void fvAg_WFP3_Specification_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        FormView fv = fvAg_WFP3_Specification;

        DropDownList ddlPractice    = fv.FindControl("ddlPractice") as DropDownList;
        DropDownList ddlBidRequired = fv.FindControl("ddlBidRequired") as DropDownList;
        TextBox      tbSortPosition = fv.FindControl("tbSortPosition") as TextBox;
        TextBox      tbBid          = fv.FindControl("tbBid") as TextBox;
        TextBox      tUnits         = fv.FindControl("tUnits") as TextBox;
        TextBox      tbABC          = fv.FindControl("tbABC") as TextBox;

        StringBuilder sb = new StringBuilder();

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = wDataContext.form_wfp3_specifications.Where(w => w.pk_form_wfp3_specification == Convert.ToInt32(fv.DataKey.Value)).Select(s => s).Single();
            try
            {
                if (!string.IsNullOrEmpty(ddlPractice.SelectedValue))
                {
                    a.fk_bmpPractice_code = Convert.ToDecimal(ddlPractice.SelectedValue);
                }
                else
                {
                    sb.Append("BMP Practice was not updated. BMP Practice is required. ");
                }

                if (!string.IsNullOrEmpty(ddlBidRequired.SelectedValue))
                {
                    a.bid_reqd = ddlBidRequired.SelectedValue;
                }
                else
                {
                    a.bid_reqd = null;
                }

                if (!string.IsNullOrEmpty(tbSortPosition.Text))
                {
                    try { a.sort_position = Convert.ToInt32(tbSortPosition.Text); }
                    catch { sb.Append("List Position was not updated. Must be a number (Integer). "); }
                }
                else
                {
                    a.sort_position = null;
                }

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

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

                if (!string.IsNullOrEmpty(tbABC.Text))
                {
                    try { a.ABC = Convert.ToDecimal(tbABC.Text); }
                    catch { sb.Append("ABC was not updated. ABC must be a number (Decimal)."); }
                }
                else
                {
                    sb.Append("ABC was not updated. ABC 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); }
        }
    }
Exemplo n.º 19
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); }
        }
    }
Exemplo n.º 20
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); }
        }
    }
Exemplo n.º 21
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); }
        }
    }
Exemplo n.º 22
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); }
        }
    }
Exemplo n.º 23
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); }
        }
    }
Exemplo n.º 24
0
    protected void fvHR_WACEmployee_Training_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        PK_ParticipantTraining = Convert.ToInt32(fvHR_WACEmployee_Training.DataKey.Value);
        DropDownList ddlPosition     = fvHR_WACEmployee_Training.FindControl("ddlPosition") as DropDownList;
        DropDownList ddlFiscalYear   = fvHR_WACEmployee_Training.FindControl("ddlFiscalYear") as DropDownList;
        DropDownList ddlTrainingReqd = fvHR_WACEmployee_Training.FindControl("ddlTrainingReqd") as DropDownList;
        TextBox      tbCompDate      = fvHR_WACEmployee_Training.FindControl("AjaxCalendar_CompDate").FindControl("tb") as TextBox;
        TextBox      tbExpDate       = fvHR_WACEmployee_Training.FindControl("AjaxCalendar_ExpDate").FindControl("tb") as TextBox;
        TextBox      tbNote          = fvHR_WACEmployee_Training.FindControl("tbNote") as TextBox;

        using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
        {
            try
            {
                var x = wac.participantWAC_trainings.Where(w => w.pk_participantWAC_training == PK_ParticipantTraining).Select(s => s).Single();
                if (!string.IsNullOrEmpty(ddlPosition.SelectedValue))
                {
                    x.fk_positionWAC_code = ddlPosition.SelectedValue;
                }
                else
                {
                    throw new Exception("Blank or invalid Position. Position is required");
                }
                if (!string.IsNullOrEmpty(ddlFiscalYear.SelectedValue))
                {
                    x.fk_fiscalYear_code = ddlFiscalYear.SelectedValue;
                }
                else
                {
                    throw new Exception("Blank or invalid Fiscal Year.  Fiscal year is required");
                }
                if (!string.IsNullOrEmpty(ddlTrainingReqd.SelectedValue))
                {
                    x.fk_trainingReqd_code = ddlTrainingReqd.SelectedValue;
                }
                else
                {
                    throw new Exception("Blank or invalid Training.  Training is required");
                }
                try { x.completed_date = Convert.ToDateTime(tbCompDate.Text); }
                catch { throw new Exception("Blank or invalid Completion Date. Completion Date is required. "); }
                try { x.expiration_date = Convert.ToDateTime(tbExpDate.Text); }
                catch {}
                if (!string.IsNullOrEmpty(tbNote.Text))
                {
                    x.note = tbNote.Text;
                }
                else
                {
                    x.note = null;
                }
                x.modified    = DateTime.Now;
                x.modified_by = Session["userName"].ToString();
                wac.SubmitChanges();
                fvHR_WACEmployee_Training.ChangeMode(FormViewMode.ReadOnly);
                BindHR_WACEmployee_Training();
                OnFormActionCompleted(this, new FormViewEventArgs(FK_ParticipantWAC, "training"));
            }
            catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
        }
    }
Exemplo n.º 25
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); }
        }
    }
Exemplo n.º 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); }
        }
    }