示例#1
0
    protected void fvProperty_ItemDeleting(object sender, FormViewDeleteEventArgs e)
    {
        if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "D", "GlobalData", "GlobalData", "msgDelete"))
        {
            string sDeleteCheck = WACGlobal_Methods.DatabaseFunction_Global_CheckForeignKeyAssignment(Convert.ToInt32(fvProperty.DataKey.Value), "PROPERTY");

            if (string.IsNullOrEmpty(sDeleteCheck))
            {
                int iCode = 0;
                using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
                {
                    try
                    {
                        iCode = wDataContext.property_delete(Convert.ToInt32(fvProperty.DataKey.Value), Session["userName"].ToString());
                        if (iCode == 0)
                        {
                            lbProperty_Close_Click(null, null);
                        }
                        else
                        {
                            WACAlert.Show("Error Returned from Database.", iCode);
                        }
                    }
                    catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
                }
            }
            else
            {
                WACAlert.Show(sDeleteCheck, 0);
            }
        }
    }
示例#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); }
        }
    }
示例#3
0
    protected void lbDelete_Click(object sender, EventArgs e)
    {
        LinkButton lb = (LinkButton)sender;

        if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "D", "GlobalData", "GlobalData", "msgDelete"))
        {
            int iCode = 0;
            using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
            {
                try
                {
                    iCode = wDataContext.participantType_delete(Convert.ToInt32(lb.CommandArgument), Session["userName"].ToString());
                    if (iCode == 0)
                    {
                        object[] oArgs = new object[] { Convert.ToInt32(hfPK_Participant.Value) };
                        Page.GetType().InvokeMember("InvokedMethod_ControlGroup_RebindRecord", System.Reflection.BindingFlags.InvokeMethod, null, this.Page, oArgs);
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
                catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
            }
        }
    }
    protected void fvSA_Note_ItemDeleting(object sender, FormViewDeleteEventArgs e)
    {
        FormView fv = fvSA.FindControl("fvSA_Note") as FormView;

        if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "D", "A", "supplementalAgreementNote", "msgDelete"))
        {
            int iCode = 0;
            using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
            {
                try
                {
                    iCode = wDataContext.supplementalAgreementNote_delete(Convert.ToInt32(fv.DataKey.Value), Session["userName"].ToString());
                    if (iCode == 0)
                    {
                        lbSA_Note_Close_Click(null, null);
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
                catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
            }
        }
    }
示例#5
0
    protected void fvHR_WACEmployee_ActivityCost_ItemDeleting(object sender, FormViewDeleteEventArgs e)
    {
        int iCode = 0;

        using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
        {
            try
            {
                FormView fvHR_WACEmployee_ActivityCost = fvHR_WACEmployee_Activity.FindControl("fvHR_WACEmployee_ActivityCost") as FormView;
                iCode = wac.participantWAC_activityCost_delete(Convert.ToInt32(fvHR_WACEmployee_ActivityCost.DataKey.Value), Session["userName"].ToString());
                if (iCode == 0)
                {
                    fvHR_WACEmployee_ActivityCost.ChangeMode(FormViewMode.ReadOnly);
                    fvHR_WACEmployee_Activity.ChangeMode(FormViewMode.ReadOnly);
                    BindHR_WACEmployee_Activity();
                    //lbHR_WACEmployees_ActivityCost_Close_Click(null, null);
                }
                else
                {
                    WACAlert.Show("Error Returned from Database.", iCode);
                }
            }
            catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
        }
    }
    protected void lbBMPPlanning_ImplementationYears_Delete_Click(object sender, EventArgs e)
    {
        bool b = WACGlobal_Methods.Security_UserObjectCustom(Session["userID"], WACGlobal_Methods.Enum_Security_UserObjectCustom.A_PLAN);

        if (b)
        {
            LinkButton lb = (LinkButton)sender;

            int iCode = 0;
            using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
            {
                try
                {
                    iCode = wDataContext.bmp_ag_implementation_delete(Convert.ToInt32(lb.CommandArgument), Session["userName"].ToString());
                    if (iCode == 0)
                    {
                        BindData_BMPPlanning_FormView(Convert.ToInt32(fvBMPPlanning.DataKey.Value));
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
                catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
            }
        }
        else
        {
            WACAlert.Show("You do not have permission to insert into the BMP Planning Implementation Year table.", 0);
        }
    }
示例#7
0
 protected void lbVenue_EventVenueType_Delete_Click(object sender, EventArgs e)
 {
     if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "D", "GlobalData", "GlobalData", "msgDelete"))
     {
         LinkButton lb    = (LinkButton)sender;
         int        i     = Convert.ToInt32(lb.CommandArgument);
         int        iCode = 0;
         using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
         {
             try
             {
                 iCode = wDataContext.eventVenueType_delete(i);
                 if (iCode == 0)
                 {
                     BindVenue(Convert.ToInt32(fvVenue.DataKey.Value));
                 }
                 else
                 {
                     WACAlert.Show("Error Returned from Database.", iCode);
                 }
             }
             catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
         }
     }
 }
示例#8
0
 private void checkDependencies(FormView fv, List <WACParameter> parms, WACDataProvider dp, MasterDetailDataObject ds)
 {
     ListSource   = ds;
     DataProvider = dp;
     try
     {
         if (fv == null)
         {
             throw new Exception("Null FormView in FormViewModel");
         }
         if (ListSource == null)
         {
             throw new Exception("Null ListSource in FormViewModel: " + fv.ID);
         }
         if (parms == null)
         {
             throw new Exception("Null Key list in FormViewModel: " + fv.ID);
         }
         if (DataProvider == null)
         {
             throw new Exception("Null DataProvider in FormViewModel: " + fv.ID);
         }
     }
     catch (Exception ex)
     {
         WACAlert.Show(ex.Message, 0);
     }
 }
示例#9
0
        public bool Update <T>(List <WACParameter> parms, WACValidator.UpdateValidateDelegate <T> vDel)
        {
            bool result = false;
            T    item   = default(T);

            parms.Add(new WACParameter("modified_by", UserName));
            parms.Add(new WACParameter("modified", DateTime.Now));
            try
            {
                item = vDel(parms, (T)ListSource.GetCurrentItem());
                ListSource.RemoveItemFromViewlist <T>(item);
                ((IWACDataProvider <T>)DataProvider).Update(item);
                ListSource.SetCurrentItem <T>(item, ((IWACDataProvider <T>)DataProvider).GetPrimaryKey);
                result = true;
            }
            catch (WACEX_ValidationException wex)
            {
                WACAlert.Show("Update failed, validation error: " + wex.ErrorText + " In " + this.ToString() + ".Update", 0);
            }
            catch (WACEX_GeneralDatabaseException gex)
            {
                WACAlert.Show("Update failed: " + gex.ErrorText + " In " + this.ToString() + ".Update", gex.ErrorCode);
            }
            catch (Exception ex)
            {
                WACAlert.Show("Update failed: " + ex.Message + " In " + this.ToString() + ".Update", 0);
            }
            return(result);
        }
    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); }
        }
    }
示例#11
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); }
        }
    }
示例#12
0
    public void fvHR_WACEmployee_Position_ItemDeleting(object sender, EventArgs e)
    {
        int iCode = 0;

        PK_ParticipantPosition = Convert.ToInt32(fvHR_WACEmployee_Position.DataKey.Value);
        using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
        {
            try
            {
                iCode = wac.participantWAC_position_delete(PK_ParticipantPosition,
                                                           Session["userName"].ToString());
                if (iCode == 0)
                {
                    fvHR_WACEmployee_Position.ChangeMode(FormViewMode.ReadOnly);
                    BindHR_WACEmployee_Position();
                }
                else
                {
                    WACAlert.Show("Error Returned from Database.", iCode);
                }
                OnFormActionCompleted(this, new FormViewEventArgs(FK_ParticipantWAC, "position"));
            }
            catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
        }
    }
    private void ExpressInsert(string sType)
    {
        object[] oArgs = new object[] { -1 };
        try
        {
            switch (sType)
            {
            case "ORGANIZATION":
                Page.GetType().InvokeMember("Organization_ViewEditInsertWindow", System.Reflection.BindingFlags.InvokeMethod, null, this.Page, oArgs);
                break;

            case "PARTICIPANT":
                Page.GetType().InvokeMember("Participant_ViewEditInsertWindow", System.Reflection.BindingFlags.InvokeMethod, null, this.Page, oArgs);
                break;

            case "PROPERTY":
                Page.GetType().InvokeMember("Property_ViewEditInsertWindow", System.Reflection.BindingFlags.InvokeMethod, null, this.Page, oArgs);
                break;

            case "GLOBAL":
                Page.GetType().InvokeMember("InvokedMethod_Insert_Global", System.Reflection.BindingFlags.InvokeMethod, null, this.Page, null);
                break;
            }
        }
        catch { WACAlert.Show(sType + " not implemented on this page.", 0); }
    }
示例#14
0
    protected void fvList_Ag_BMPPractice_ItemDeleting(object sender, FormViewDeleteEventArgs e)
    {
        bool b = WACGlobal_Methods.Security_UserObjectCustom(Session["userID"], WACGlobal_Methods.Enum_Security_UserObjectCustom.A_ABC);

        if (b)
        {
            int iCode = 0;
            using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
            {
                try
                {
                    iCode = wDataContext.list_bmpPractice_delete(Convert.ToDecimal(fvList_Ag_BMPPractice.DataKey.Value), Session["userName"].ToString());
                    if (iCode == 0)
                    {
                        lbList_Ag_BMPPracticePopUp_Close_Click(null, null);
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
                catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
            }
        }
        else
        {
            WACAlert.Show("You do not have permission to delete BMP Practice data.", 0);
        }

        //if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "D", "GlobalData", "GlobalData", "msgDelete"))
        //{

        //}
    }
示例#15
0
 protected void ddlInsert_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "I", "GlobalData", "GlobalData", "msgInsert"))
     {
         if (!string.IsNullOrEmpty(ddlInsert.SelectedValue))
         {
             int?i     = null;
             int iCode = 0;
             try
             {
                 using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
                 {
                     iCode = wac.participantType_add(Convert.ToInt32(hfPK_Participant.Value), ddlInsert.SelectedValue, Session["userName"].ToString(), ref i);
                     if (iCode == 0)
                     {
                         object[] oArgs = new object[] { Convert.ToInt32(hfPK_Participant.Value) };
                         Page.GetType().InvokeMember("InvokedMethod_ControlGroup_RebindRecord", System.Reflection.BindingFlags.InvokeMethod, null, this.Page, oArgs);
                     }
                     else
                     {
                         WACAlert.Show("Error Returned from Database.", iCode);
                     }
                 }
             }
             catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
         }
     }
 }
示例#16
0
    protected void fvHR_WACEmployee_Activity_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        int?    i      = null;
        int     iCode  = 0;
        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
            {
                DateTime?dtDate = null;
                try { dtDate = Convert.ToDateTime(tbDate.Text); }
                catch { throw new Exception("Date is required / Invalid date format. "); }
                string sNote = null;
                if (!string.IsNullOrEmpty(tbNote.Text))
                {
                    sNote = tbNote.Text;
                }
                iCode = wac.participantWAC_activity_add(FK_ParticipantWAC, dtDate, sNote, Session["userName"].ToString(), ref i);
                if (iCode == 0)
                {
                    PK_ParticipantActivity = (Int32)i;
                    fvHR_WACEmployee_Activity.ChangeMode(FormViewMode.ReadOnly);
                    BindHR_WACEmployee_Activity();
                }
                else
                {
                    WACAlert.Show("Error Returned from Database.", iCode);
                }
                OnFormActionCompleted(this, new FormViewEventArgs(FK_ParticipantWAC, "activity"));
            }
            catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
        }
    }
示例#17
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); }
        }
    }
示例#18
0
    protected void fvOrganization_Note_ItemDeleting(object sender, FormViewDeleteEventArgs e)
    {
        //if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "D", "GlobalData", "GlobalData", "msgDelete"))
        //{
        int iCode = 0;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            try
            {
                if (WACGlobal_Methods.Security_UserCanModifyDeleteNote(Session["userName"], "organizationNote", Convert.ToInt32(fvOrganization_Note.DataKey.Value)))
                {
                    iCode = wDataContext.organizationNote_delete(Convert.ToInt32(fvOrganization_Note.DataKey.Value), Session["userName"].ToString());
                    if (iCode == 0)
                    {
                        lbOrganization_Note_Close_Click(null, null);
                    }
                    else
                    {
                        WACAlert.Show("Error Returned from Database.", iCode);
                    }
                }
            }
            catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
        }
        //}
    }
示例#19
0
 public override IList GetFilteredList(List <WACParameter> parms)
 {
     try
     {
         IList <TaxParcel> x = GetList() as IList <TaxParcel>;
         PrimaryKeyVerify(ref parms);
         string _partialPrintKey = WACParameter.GetParameterValue(parms, "partialPrintKey") as string;
         string _participant     = WACParameter.GetParameterValue(parms, "participant") as string;
         if (!string.IsNullOrEmpty(_partialPrintKey))
         {
             var a = x.Where(w => w.taxParcelID.StartsWith(_partialPrintKey)).OrderBy(o => o.taxParcelID).Select(s => s);
             return(a.ToList <WAC_DataObjects.TaxParcel>());
         }
         else if (!string.IsNullOrEmpty(_participant))
         {
             var a = x.Where(w => !string.IsNullOrEmpty(w.ownerStr_dnd) && w.ownerStr_dnd.Contains(_participant)).OrderBy(o => o.taxParcelID).Select(s => s);
             return(a.ToList <WAC_DataObjects.TaxParcel>());
         }
         else
         {
             return(x.Where <TaxParcel>(FuncWhere <TaxParcel>(parms)).ToList());
         }
     }
     catch (Exception e) { WACAlert.Show(e.Message, 0); }
     return(null);
 }
示例#20
0
        public bool Insert <T>(List <WACParameter> parms, WACValidator.InsertValidateDelegate <T> vDel)
        {
            bool result = false;
            T    item   = default(T);

            parms.Add(new WACParameter("created_by", UserName, WACParameter.ParameterType.Property));
            try
            {
                item = vDel(parms);
                item = ((IWACDataProvider <T>)DataProvider).Insert(item);
                ListSource.SetCurrentItem <T>(item, ((IWACDataProvider <T>)DataProvider).GetPrimaryKey);
                ListSource.VList.Clear();
                result = true;
            }
            catch (WACEX_ValidationException wex)
            {
                WACAlert.Show("Insert failed, validation error: " + wex.ErrorText + " In " + this.ToString() + ".Insert", 0);
            }
            catch (WACEX_GeneralDatabaseException gex)
            {
                WACAlert.Show("Insert failed: " + gex.ErrorText + " In " + this.ToString() + ".Insert", gex.ErrorCode);
            }
            catch (Exception ex)
            {
                WACAlert.Show("Insert failed: " + ex.Message + " In " + this.ToString() + ".Insert", 0);
            }
            return(result);
        }
示例#21
0
 protected void ddlVenue_EventVenueType_Add_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (WACGlobal_Methods.Security_UserCanPerformAction(Session["userID"], "I", "GlobalData", "GlobalData", "msgInsert"))
     {
         DropDownList ddl = (DropDownList)sender;
         if (!string.IsNullOrEmpty(ddl.SelectedValue))
         {
             int?i     = null;
             int iCode = 0;
             using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
             {
                 try
                 {
                     iCode = wDataContext.eventVenueType_add(Convert.ToInt32(fvVenue.DataKey.Value), ddl.SelectedValue, ref i);
                     if (iCode == 0)
                     {
                         BindVenue(Convert.ToInt32(fvVenue.DataKey.Value));
                     }
                     else
                     {
                         WACAlert.Show("Error Returned from Database.", iCode);
                     }
                 }
                 catch (Exception ex) { WACAlert.Show(ex.Message, 0); }
             }
         }
     }
 }
    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); }
        }
    }
示例#23
0
    protected void fvOrganization_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        int?i     = null;
        int iCode = 0;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            TextBox tbOrg = fvOrganization.FindControl("tbOrg") as TextBox;
            try
            {
                string sOrg = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbOrg.Text, 96).Trim();

                iCode = wDataContext.organization_add(sOrg, Session["userName"].ToString(), ref i);
                if (iCode == 0)
                {
                    fvOrganization.ChangeMode(FormViewMode.ReadOnly);
                    BindOrganization(Convert.ToInt32(i));
                }
                else
                {
                    WACAlert.Show("Error Returned from Database.", iCode);
                }
            }
            catch (Exception ex) { WACAlert.Show("Error: " + ex.Message, 0); }
        }
    }
示例#24
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); }
        }
    }
示例#25
0
 public void Organization_ViewEditInsertWindow(object oPK_Organization)
 {
     try
     {
         UC_Express_Organization1.LoadFormView_Organization(Convert.ToInt32(oPK_Organization));
     }
     catch { WACAlert.Show("Could not open Organization Window.", 0); }
 }
示例#26
0
 public void Participant_ViewEditInsertWindow(object oPK_Participant)
 {
     try
     {
         UC_Express_Participant1.LoadFormView_Participant(Convert.ToInt32(oPK_Participant));
     }
     catch { WACAlert.Show("Could not open Participant Window.", 0); }
 }
示例#27
0
 public void Property_ViewEditInsertWindow(object oPK_Property)
 {
     try
     {
         //UC_Express_Property1.LoadFormView_Property(Convert.ToInt32(oPK_Property));
     }
     catch { WACAlert.Show("Could not open Property Window.", 0); }
 }
示例#28
0
    protected void fvHR_WACEmployee_ActivityCost_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        int?i     = null;
        int iCode = 0;

        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
            {
                int iFK_participantWAC_activity = Convert.ToInt32(fvHR_WACEmployee_Activity.DataKey.Value);

                DateTime?dtDate = null;
                try { dtDate = Convert.ToDateTime(tbDate.Text); }
                catch { throw new Exception("Date is required. / Invalid date format. "); }

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

                decimal?dCost = null;
                try { dCost = Convert.ToDecimal(tbCost.Text); }
                catch { throw new Exception("Cost is required. / Invalid decimal format. "); }

                string sNote = null;
                if (!string.IsNullOrEmpty(tbNote.Text))
                {
                    sNote = tbNote.Text;
                }

                iCode = wac.participantWAC_activityCost_add(iFK_participantWAC_activity, sFK_trainingCost, dtDate, dCost, sNote, Session["userName"].ToString(), ref i);
                if (iCode == 0)
                {
                    fvHR_WACEmployee_ActivityCost.ChangeMode(FormViewMode.ReadOnly);
                    fvHR_WACEmployee_Activity.ChangeMode(FormViewMode.ReadOnly);
                    BindHR_WACEmployee_Activity();
                    //fvHR_WACEmployee_ActivityCost.ChangeMode(FormViewMode.ReadOnly);
                    //BindHR_WACEmployee_ActivityCost(iFK_participantWAC_activity);
                }
                else
                {
                    WACAlert.Show("Error Returned from Database.", iCode);
                }
            }
            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); }
    }
示例#30
0
 public void BindFormView(FormView fv, List <WACParameter> parms, MasterDetailDataObject.ItemGetterDelegate _getItem)
 {
     try
     {
         fv.DataKeyNames = ListSource.DataKeyNames;
         fv.DataSource   = ListSource.GetSingleItemList(parms, _getItem);
         fv.DataBind();
     }
     catch (Exception ex) { WACAlert.Show(ex.Message + " In " + this.ToString() + ".BindFormView", 0); }
 }