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); }
        }
    }
Esempio n. 2
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); }
        }
    }
Esempio n. 3
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); }
        }
    }
    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); }
        }
    }
Esempio n. 5
0
 private void fvItemInserting(FormView fv)
 {
     try
     {
         CustomControls_AjaxCalendar agreementDate   = (CustomControls_AjaxCalendar)fv.FindControl("tbCalAgreementDate");
         WACPR_TaxParcelPicker       taxParcelPicker = fv.FindControl("WACPR_TaxParcelPicker") as WACPR_TaxParcelPicker;
         sReq.ParmList.Clear();
         List <WACParameter> taxParcelProps = taxParcelPicker.GetContents();
         sReq.ParmList.Add(WACParameter.GetParameter(taxParcelProps, "swis"));
         sReq.ParmList.Add(WACParameter.GetParameter(taxParcelProps, "printKey"));
         sReq.ParmList.Add(new WACParameter("agreement_date", agreementDate.CalDateNotNullable, WACParameter.ParameterType.Property));
         sReq.ServiceRequested = ServiceFactory.ServiceTypes.InsertItem;
         sReq.ServiceFor       = fv;
         ServiceFactory.Instance.ServiceRequest(sReq);
         taxParcelProps = null;
     }
     catch (Exception ex)
     {
         WACAlert.Show(ex.Message, 0);
     }
 }
Esempio n. 6
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); }
        }
    }
Esempio n. 7
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); }
        }
    }
Esempio n. 8
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); }
        }
    }
Esempio n. 9
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); }
        }
    }
Esempio n. 10
0
    public void fvHR_WACEmployee_Position_ItemUpdating(object sender, EventArgs e)
    {
        PK_ParticipantPosition = Convert.ToInt32(fvHR_WACEmployee_Position.DataKey.Value);
        DropDownList ddlPosition = fvHR_WACEmployee_Position.FindControl("ddlPosition") as DropDownList;
        //TextBox tbStartDate = fvHR_WACEmployee_Position.FindControl("AjaxCalendar_StartDate").FindControl("tb") as TextBox;
        CustomControls_AjaxCalendar calStartDate = fvHR_WACEmployee_Position.FindControl("AjaxCalendar_StartDate") as CustomControls_AjaxCalendar;
        //TextBox tbFinishDate = fvHR_WACEmployee_Position.FindControl("AjaxCalendar_FinishDate").FindControl("tb") as TextBox;
        CustomControls_AjaxCalendar calFinishDate = fvHR_WACEmployee_Position.FindControl("AjaxCalendar_FinishDate") as CustomControls_AjaxCalendar;
        TextBox tbStartSalary = fvHR_WACEmployee_Position.FindControl("tbStartSalary") as TextBox;
        TextBox tbNote        = fvHR_WACEmployee_Position.FindControl("tbNote") as TextBox;
        CustomControls_AjaxCalendar calExitInterview = fvHR_WACEmployee_Position.FindControl("calExitInterview") as CustomControls_AjaxCalendar;
        TextBox tbExitInterviewNote = fvHR_WACEmployee_Position.FindControl("tbExitInterviewNote") as TextBox;

        string   fk_positionWAC_code = null;
        DateTime startDate;
        DateTime?finishDate;
        Decimal  startSalary;
        string   note = null;
        DateTime?exitInterviewDate;
        string   exitInterviewNote = null;
        DateTime modified;
        string   modified_by;

        using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
        {
            //var x = wac.participantWAC_positions.Where(w => w.pk_participantWAC_position == PK_ParticipantPosition)
            //    .Select(s => s).Single();
            try
            {
                // Position
                if (!string.IsNullOrEmpty(ddlPosition.SelectedValue))
                {
                    fk_positionWAC_code = ddlPosition.SelectedValue;
                }
                else
                {
                    throw new Exception("Position is a required Field");
                }
                // Start Date
                startDate = calStartDate.CalDateNotNullable;
                if (startDate == null)
                {
                    throw new Exception("Invalid or empty Start Date.");
                }
                // Finish Date - not required
                //try { x.finish_date= Convert.ToDateTime(tbFinishDate.Text); }
                //catch { x.finish_date = null; }
                finishDate = calFinishDate.CalDateNullable;
                // Starting Salary not required
                try { startSalary = Convert.ToDecimal(tbStartSalary.Text); }
                catch { throw new Exception("Invalid or empty Starting Salary."); }
                // Note not required
                if (!string.IsNullOrEmpty(tbNote.Text))
                {
                    note = tbNote.Text;
                }
                exitInterviewDate = calExitInterview.CalDateNullable;
                if (!string.IsNullOrEmpty(tbExitInterviewNote.Text))
                {
                    exitInterviewNote = tbExitInterviewNote.Text;
                }
                modified    = DateTime.Now;
                modified_by = Session["userName"].ToString();
                //wac.SubmitChanges();
                int rCode = wac.participantWAC_position_update(PK_ParticipantPosition, fk_positionWAC_code, startDate, finishDate, startSalary, note, Session["userName"].ToString(),
                                                               exitInterviewDate, exitInterviewNote);
                if (rCode == 0)
                {
                    fvHR_WACEmployee_Position.ChangeMode(FormViewMode.ReadOnly);
                    BindHR_WACEmployee_Position();
                    OnFormActionCompleted(this, new FormViewEventArgs(FK_ParticipantWAC, "position"));
                }
                else
                {
                    throw new Exception("Error occurred updating HR:Position");
                }
                // OnFormActionCompleted(this, new FormViewEventArgs(FK_ParticipantWAC, "position"));
            }
            catch (Exception ex)
            { WACAlert.Show("Error: " + 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 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); }
        }
    }
Esempio n. 13
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);
    }
Esempio n. 14
0
    protected void fvAg_WFP3_ItemUpdating(object sender, EventArgs e)
    {
        StringBuilder sbErrorCollection                      = new StringBuilder();
        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 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 tbCalCertificationDate   = fvAg_WFP3.FindControl("tbCalCertificationDate") as CustomControls_AjaxCalendar;
        CustomControls_AjaxCalendar tbCalPrintDate           = fvAg_WFP3.FindControl("tbCalPrintDate") as CustomControls_AjaxCalendar;
        CustomControls_AjaxCalendar tbCalBidDeadlineDate     = fvAg_WFP3.FindControl("tbCalBidDeadlineDate") as CustomControls_AjaxCalendar;
        TextBox      tbDescription            = fvAg_WFP3.FindControl("tbDescription") as TextBox;
        DropDownList ddlSpecialProvisions     = fvAg_WFP3.FindControl("ddlSpecialProvisions") as DropDownList;
        TextBox      tbSpecialProvisionsCount = fvAg_WFP3.FindControl("tbSpecialProvisionsCount") 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      tbMessage2FreeForm       = fvAg_WFP3.FindControl("tbMessage2FreeForm") as TextBox;
        TextBox      tbNote            = fvAg_WFP3.FindControl("tbNote") as TextBox;
        TextBox      tbProjectLocation = fvAg_WFP3.FindControl("tbProjectLocation") as TextBox;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                var a = wDataContext.form_wfp3s.Where(w => w.pk_form_wfp3 == Convert.ToInt32(fvAg_WFP3.DataKey.Value)).Select(s => s).Single();

                a.description          = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbDescription.Text, 255);
                a.design_date          = tbCalDesignDate.CalDateNullable;
                a.procurementPlan_date = tbCalProcurementPlanDate.CalDateNullable;
                a.outForBid_date       = tbCalOutForBidDate.CalDateNullable;
                a.install_from         = tbCalInstallFromDate.CalDateNullable;
                a.install_to           = tbCalInstallToDate.CalDateNullable;
                a.construction_date    = tbCalConstructionDate.CalDateNullable;
                a.certification_date   = tbCalCertificationDate.CalDateNullable;
                a.print_date           = tbCalPrintDate.CalDateNullable;
                a.bid_deadline_date    = tbCalBidDeadlineDate.CalDateNullable;

                if (!string.IsNullOrEmpty(ddlSpecialProvisions.SelectedValue))
                {
                    a.specialProvisions = ddlSpecialProvisions.SelectedValue;
                }
                else
                {
                    a.specialProvisions = null;
                }

                a.attachedPages_cnt = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbAttachedPages.Text, 4);

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

                if (!string.IsNullOrEmpty(ddlProcurementType.SelectedValue))
                {
                    a.fk_procurementType_code = ddlProcurementType.SelectedValue;
                }
                else
                {
                    sbErrorCollection.Append("Procurement Type is required.");
                }

                a.message2_freeform = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbMessage2FreeForm.Text, 255);

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

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

                if (!string.IsNullOrEmpty(sbErrorCollection.ToString()))
                {
                    WACAlert.Show(sbErrorCollection.ToString(), 0);
                }
                else
                {
                    int iCode = wDataContext.form_wfp3_update(a.pk_form_wfp3, a.description, a.specialProvisions, a.install_from, a.install_to,
                                                              a.print_date, a.bid_deadline_date, a.design_date, a.procurementPlan_date, a.outForBid_date, a.construction_date, a.certification_date,
                                                              a.attachedPages_cnt, a.attachedSpecifications, a.fk_procurementType_code, a.message2_freeform, a.note, a.modified_by);
                    //wDataContext.SubmitChanges();
                    if (iCode != 0)
                    {
                        WACAlert.Show("Update failed", iCode);
                    }
                    fvAg_WFP3.ChangeMode(FormViewMode.ReadOnly);
                    BindAg_WFP3();
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
    }