Beispiel #1
0
    protected void FormView1_PreRender(object sender, EventArgs e)
    {
        FormView   oFormView   = default(FormView);
        LinkButton oLinkButton = default(LinkButton);

        //TextBox oTextBox = default(TextBox);

        oFormView = (FormView)sender;
        if (!oFormView.Visible)
        {
            return;
        }
        switch (oFormView.CurrentMode)
        {
        case FormViewMode.Insert:
            // 顯示新增Button
            oLinkButton         = (LinkButton)(oFormView.FindControl("InsertButton"));
            oLinkButton.Visible = true;
            break;

        case FormViewMode.Edit:
            //顯示更新Button
            oLinkButton         = (LinkButton)(oFormView.FindControl("UpdateButton"));
            oLinkButton.Visible = true;
            break;

        case FormViewMode.ReadOnly:
            break;
        }
    }
Beispiel #2
0
    private void BindHR_WACEmployee_TrainingCost(int i)
    {
        using (WACDataClassesDataContext wac = new WACDataClassesDataContext())
        {
            FormView fvHR_WACEmployee_TrainingCost = fvHR_WACEmployee_Training.FindControl("fvHR_WACEmployee_TrainingCost") as FormView;
            var      x = wac.participantWAC_trainingCosts.Where(w => w.pk_participantWAC_trainingCost == i).
                         Select(s => s).OrderByDescending(o => o.created);
            fvHR_WACEmployee_TrainingCost.DataSource   = x;
            fvHR_WACEmployee_TrainingCost.DataKeyNames = new string[] { "pk_participantWAC_trainingCost" };
            fvHR_WACEmployee_TrainingCost.DataBind();

            if (fvHR_WACEmployee_TrainingCost.CurrentMode == FormViewMode.Insert)
            {
                WACGlobal_Methods.PopulateControl_DatabaseLists_TrainingCost_DDL(fvHR_WACEmployee_TrainingCost.FindControl("ddlTrainingCostCode") as DropDownList, null, true);
            }

            if (fvHR_WACEmployee_TrainingCost.CurrentMode == FormViewMode.Edit)
            {
                WACGlobal_Methods.PopulateControl_DatabaseLists_TrainingCost_DDL(fvHR_WACEmployee_TrainingCost.FindControl("ddlTrainingCostCode") as DropDownList, x.Single().fk_trainingCost_code, false);
                if (x.Single().date != null)
                {
                    TextBox tbDate = fvHR_WACEmployee_TrainingCost.FindControl("AjaxCalendar_TrCostDate").FindControl("tb") as TextBox;
                    tbDate.Text = Convert.ToDateTime(x.Single().date).ToShortDateString();
                }
            }
        }
    }
Beispiel #3
0
 /// <summary>
 /// Установить активность компанента CheckBox
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <param name="enable"></param>
 public void SetEnableCheckBox(FormView fv, string Control, bool enable)
 {
     if (fv.FindControl(Control) != null)
     {
         ((CheckBox)fv.FindControl(Control)).Enabled = enable;
     }
 }
Beispiel #4
0
    private void BindAg_WFP3_Specification()
    {
        FormView fv = fvAg_WFP3_Specification;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = wDataContext.form_wfp3_specifications.Where(w => w.pk_form_wfp3_specification == PK_Wfp3Spec).Select(s => s);
            fv.DataKeyNames = new string[] { "pk_form_wfp3_specification" };
            fv.DataSource   = a;
            fv.DataBind();

            if (fv.CurrentMode == FormViewMode.Insert)
            {
                WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_ByWFP3BMP_DDL(fv, "ddlBMP", FK_Wfp3, null);
                WACGlobal_Methods.PopulateControl_DatabaseLists_BMPPractice_DDL(fv.FindControl("ddlPractice") as DropDownList, null, true, true, false);
                WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fv.FindControl("ddlBidRequired") as DropDownList, null, true);
            }

            if (fv.CurrentMode == FormViewMode.Edit)
            {
                WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_ByWFP3BMP_DDL(fv, "ddlBMP", FK_Wfp3, a.Single().fk_form_wfp3_bmp);
                WACGlobal_Methods.PopulateControl_DatabaseLists_BMPPractice_DDL(fv.FindControl("ddlPractice") as DropDownList, a.Single().fk_bmpPractice_code, true, true, false);
                WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fv.FindControl("ddlBidRequired") as DropDownList, a.Single().bid_reqd, true);
            }
        }
    }
Beispiel #5
0
    private void BindAg_WFP3_Bid()
    {
        FormView fv = fvAg_WFP3_Bid;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = from b in wDataContext.form_wfp3_bids.Where(w => w.pk_form_wfp3_bid == PK_Wfp3Bid) select b;
            fv.DataKeyNames = new string[] { "pk_form_wfp3_bid" };
            fv.DataSource   = a;
            fv.DataBind();

            string sRegionWAC = WACGlobal_Methods.SpecialQuery_Agriculture_GetWACRegion_ByFarmBusinessPK(FK_FarmBusiness);

            if (fv.CurrentMode == FormViewMode.Insert)
            {
                WACGlobal_Methods.PopulateControl_Participant_DBView_DDL(fv.FindControl("ddlContractor") as DropDownList, null, new string[] { "C" },
                                                                         null, null, new string[] { sRegionWAC }, null, null, null, false, false, false, false, false, false,
                                                                         WACGlobal_Methods.Enum_Participant_Forms.ALL, true);
            }

            if (fv.CurrentMode == FormViewMode.Edit)
            {
                WACGlobal_Methods.PopulateControl_Participant_DBView_DDL(fv.FindControl("ddlContractor") as DropDownList, a.Single().fk_participant_contractor,
                                                                         new string[] { "C" }, null, null, new string[] { sRegionWAC }, null, null, null, false, false, false, false, false, false,
                                                                         WACGlobal_Methods.Enum_Participant_Forms.ALL, true);
            }
        }
    }
Beispiel #6
0
 /// <summary>
 /// Установить SelectedValue в RadioButtonList
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <param name="value"></param>
 public void SetValueRadioButtonList(FormView fv, string Control, string value)
 {
     if (fv.FindControl(Control) != null)
     {
         ((RadioButtonList)fv.FindControl(Control)).SelectedValue = value;
     }
 }
Beispiel #7
0
 /// <summary>
 /// Установить Text в Literal
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <param name="value"></param>
 public void SetTextLiteral(FormView fv, string Control, string value)
 {
     if (fv.FindControl(Control) != null)
     {
         ((Literal)fv.FindControl(Control)).Text = value;
     }
 }
Beispiel #8
0
 /// <summary>
 /// Установить Checked компонента CheckBox
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <param name="value"></param>
 public void SetCheckedCheckBox(FormView fv, string Control, bool value)
 {
     if (fv.FindControl(Control) != null)
     {
         ((CheckBox)fv.FindControl(Control)).Checked = value;
     }
 }
Beispiel #9
0
 /// <summary>
 /// Установить Text в Button
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <param name="value"></param>
 public void SetEnableButton(FormView fv, string Control, bool enable)
 {
     if (fv.FindControl(Control) != null)
     {
         ((Button)fv.FindControl(Control)).Enabled = enable;
     }
 }
Beispiel #10
0
 /// <summary>
 /// Установить Text в Button
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <param name="value"></param>
 public void SetTextButton(FormView fv, string Control, string value)
 {
     if (fv.FindControl(Control) != null)
     {
         ((Button)fv.FindControl(Control)).Text = value;
     }
 }
    protected void setFormData(FormView fvName, FormViewMode fvMode, Object obj)
    {
        fvName.ChangeMode(fvMode);
        fvName.DataSource = obj;
        fvName.DataBind();

        //set kind ddl
        switch (fvMode)
        {
        case FormViewMode.Insert:
            setDdlList(fvName, "ddlKIDX", "kind", "3");
            setDdlList(fvName, "ddlAsIDX", "asset", "1");
            setDdlList(fvName, "ddlTypeIDX", "materialtype", "1");
            setDdlList(fvName, "ddlUnitIDX", "unit", "1");
            break;

        case FormViewMode.Edit:
            HiddenField typeIDX = (HiddenField)fvName.FindControl("hfTypeIDXE");
            HiddenField unitIDX = (HiddenField)fvName.FindControl("hfUnitIDXE");
            HiddenField kIDX    = (HiddenField)fvName.FindControl("hfKIDXE");
            HiddenField asIDX   = (HiddenField)fvName.FindControl("hfAsIDXE");
            setDdlList(fvName, "ddlKIDXE", "kind", kIDX.Value);
            setDdlList(fvName, "ddlAsIDXE", "asset", asIDX.Value);
            setDdlList(fvName, "ddlTypeIDXE", "materialtype", typeIDX.Value);
            setDdlList(fvName, "ddlUnitIDXE", "unit", unitIDX.Value);
            break;
        }
    }
    private void BindAg_WFP3_Encumbrance()
    {
        FormView fv = fvAg_WFP3_Encumbrance;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = from b in wDataContext.form_wfp3_encumbrances.Where(w => w.pk_form_wfp3_encumbrance == PK_Wfp3Encumbrance) select b;
            fv.DataKeyNames = new string[] { "pk_form_wfp3_encumbrance" };
            fv.DataSource   = a;
            fv.DataBind();

            string sRegionWAC = WACGlobal_Methods.SpecialQuery_Agriculture_GetWACRegion_ByFarmBusinessPK(FK_FarmBusiness);

            if (fv.CurrentMode == FormViewMode.Insert)
            {
                TextBox tbAmount = fv.FindControl("tbAmount") as TextBox;
                try
                {
                    var x = wDataContext.form_wfp3_get_encumbranceAmt_all(FK_Wfp3);
                    tbAmount.Text = x.Single().amt_encumbrance.ToString();
                }
                catch { }
                WACGlobal_Methods.PopulateControl_DatabaseLists_Encumbrance_DDL(fv, "ddlEncumbrance", null);
            }

            if (fv.CurrentMode == FormViewMode.Edit)
            {
                WACGlobal_Methods.PopulateControl_DatabaseLists_Encumbrance_DDL(fv, "ddlEncumbrance", a.Single().fk_encumbrance_code);
                WACGlobal_Methods.PopulateControl_DatabaseLists_EncumbranceType_DDL(fv.FindControl("ddlType") as DropDownList, a.Single().fk_encumbranceType_code, true);
            }
        }
    }
    protected void fmvLE_DataBound(object sender, EventArgs e)
    {
        if (e == null)
        {
            throw new ArgumentNullException("e");
        }

        FormView              fv          = sender as FormView;
        LogbookEntryDisplay   le          = (LogbookEntryDisplay)fv.DataItem;
        Controls_mfbImageList mfbilFlight = (Controls_mfbImageList)fv.FindControl("mfbilFlight");

        mfbilFlight.Key = le.FlightID.ToString(CultureInfo.InvariantCulture);
        mfbilFlight.Refresh();
        mfbGoogleMapManager1.Map.Images = mfbilFlight.Images.ImageArray;

        Controls_mfbVideoEntry ve = (Controls_mfbVideoEntry)fv.FindControl("mfbVideoEntry1");

        ve.Videos.Clear();
        foreach (VideoRef vr in le.Videos)
        {
            ve.Videos.Add(vr);
        }

        Controls_mfbAirportServices aptSvc = (Controls_mfbAirportServices)fv.FindControl("mfbAirportServices1");

        aptSvc.GoogleMapID = mfbGoogleMapManager1.MapID;
        aptSvc.SetAirports(RoutesList.MasterList.GetNormalizedAirports());

        ((Controls_mfbSignature)fv.FindControl("mfbSignature")).Flight = le;
    }
Beispiel #14
0
    protected void chkPayToAdd_DataBound(object sender, EventArgs e)
    {
        try
        {
            RadioButtonList chk = (RadioButtonList)sender;

            FormView frmV = (FormView)chk.NamingContainer;

            if (frmV.DataItem != null)
            {
                string paymode = ((DataRowView)frmV.DataItem)["paymode"].ToString();
                chk.ClearSelection();

                ListItem li = chk.Items.FindByValue(paymode);
                if (li != null)
                {
                    li.Selected = true;
                }
            }

            if (chk.SelectedItem != null)
            {
                if (chk.SelectedItem.Text == "Cheque")
                {
                    //Panel test = (Panel)frmViewAdd.FindControl("PanelBank");
                    HtmlTable table = (HtmlTable)((Panel)frmV.FindControl("PanelBankAdd")).FindControl("tblBankAdd");

                    if (table != null)
                    {
                        table.Attributes.Add("class", "AdvancedSearch");
                    }
                }
                else
                {
                    HtmlTable table = (HtmlTable)frmV.FindControl("PanelBankAdd").FindControl("tblBankAdd");

                    if (table != null)
                    {
                        table.Attributes.Add("class", "hidden");
                    }
                }
            }
            else
            {
                //Panel test = (Panel)frmViewAdd.FindControl("PanelBank");
                //test.Visible = false;
                HtmlTable table = (HtmlTable)frmV.FindControl("PanelBankAdd").FindControl("tblBankAdd");

                if (table != null)
                {
                    table.Attributes.Add("class", "hidden");
                }
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
    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); }
        }
    }
Beispiel #16
0
 /// <summary>
 /// Получить ссылку на Literal
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <returns></returns>
 public Literal GetLiteral(FormView fv, string Control)
 {
     if (fv.FindControl(Control) != null)
     {
         return((Literal)fv.FindControl(Control));
     }
     return(null);
 }
Beispiel #17
0
 /// <summary>
 /// Получить ссылку на RegularExpressionValidator
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <returns></returns>
 public RegularExpressionValidator GetRegularExpressionValidator(FormView fv, string Control)
 {
     if (fv.FindControl(Control) != null)
     {
         return((RegularExpressionValidator)fv.FindControl(Control));
     }
     return(null);
 }
Beispiel #18
0
 /// <summary>
 /// Получить ссылку на Button
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <returns></returns>
 public Button GetButton(FormView fv, string Control)
 {
     if (fv.FindControl(Control) != null)
     {
         return((Button)fv.FindControl(Control));
     }
     return(null);
 }
Beispiel #19
0
 /// <summary>
 /// Получить ссылку на RadioButtonList
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <returns></returns>
 public RadioButtonList GetRadioButtonList(FormView fv, string Control)
 {
     if (fv.FindControl(Control) != null)
     {
         return((RadioButtonList)fv.FindControl(Control));
     }
     return(null);
 }
Beispiel #20
0
 /// <summary>
 /// Получить ссылку на RequiredFieldValidator
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <returns></returns>
 public RequiredFieldValidator GetRequiredFieldValidator(FormView fv, string Control)
 {
     if (fv.FindControl(Control) != null)
     {
         return((RequiredFieldValidator)fv.FindControl(Control));
     }
     return(null);
 }
Beispiel #21
0
 /// <summary>
 /// Получить ссылку на комонент TextBox
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <returns></returns>
 public TextBox GetTextBox(FormView fv, string Control)
 {
     if (fv.FindControl(Control) != null)
     {
         return((TextBox)fv.FindControl(Control));
     }
     return(null);
 }
Beispiel #22
0
 /// <summary>
 /// Получить ссылку на DropDownList
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <returns></returns>
 public DropDownList GetDropDownList(FormView fv, string Control)
 {
     if (fv.FindControl(Control) != null)
     {
         return((DropDownList)fv.FindControl(Control));
     }
     return(null);
 }
Beispiel #23
0
 /// <summary>
 /// Получает активный компанет TextBox
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <returns></returns>
 public bool GetEnableTextBox(FormView fv, string Control)
 {
     if (fv.FindControl(Control) != null)
     {
         return(((TextBox)fv.FindControl(Control)).Enabled);
     }
     return(false);
 }
Beispiel #24
0
 /// <summary>
 /// Получить ссылку на CheckBox
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <returns></returns>
 public CheckBox GetCheckBox(FormView fv, string Control)
 {
     if (fv.FindControl(Control) != null)
     {
         return((CheckBox)fv.FindControl(Control));
     }
     return(null);
 }
Beispiel #25
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); }
        }
    }
Beispiel #26
0
    private void fvItemInserting(FormView fv)
    {
        TextBox               tbFarmName       = fv.FindControl("tbFarmName") as TextBox;
        DropDownList          ddlProgramWAC    = fv.FindControl("ddlProgramWAC") as DropDownList;
        DropDownList          ddlFarmSize      = fv.FindControl("ddlFarmSize") as DropDownList;
        DropDownList          ddlBasin         = fv.FindControl("ddlBasin") as DropDownList;
        DropDownList          ddlSoldFarm      = fv.FindControl("ddlSoldFarm") as DropDownList;
        CheckBox              cbGenerateFarmID = fv.FindControl("cbGenerateFarmID") as CheckBox;
        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"));
        WACUserInputUtilityControl wcc = (WACUserInputUtilityControl)fv.FindControl("WACPT_ParticipantAlphaPicker");
        WACParameter wp = WACParameter.GetParameter(wcc.GetContents(), "pk_participant");

        wp.ParmName = "fk_participantOperator";
        wcc         = (WACUserInputUtilityControl)fv.FindControl("WACPT_ParticipantAlphaPicker_Owner");
        wp          = WACParameter.GetParameter(wcc.GetContents(), "pk_participant");
        wp.ParmName = "fk_participantOwner";
        sReq.ParmList.Add(wp);
        sReq.ParmList.Add(new WACParameter("farm_name", tbFarmName.Text, WACParameter.ParameterType.Property));
        sReq.ParmList.Add(new WACParameter("fk_programWAC_code", ddlProgramWAC.SelectedValue, WACParameter.ParameterType.Property));
        sReq.ParmList.Add(new WACParameter("fk_farmSize_code", ddlFarmSize.SelectedValue, WACParameter.ParameterType.Property));
        sReq.ParmList.Add(new WACParameter("fk_basin_code", ddlBasin.SelectedValue, WACParameter.ParameterType.Property));
        sReq.ParmList.Add(new WACParameter("sold_farm", ddlSoldFarm.SelectedValue, WACParameter.ParameterType.Property));
        sReq.ParmList.Add(new WACParameter("GenerateID", cbGenerateFarmID.Checked ? "Y" : "N", WACParameter.ParameterType.Property));
        sReq.ServiceRequested = ServiceFactory.ServiceTypes.InsertItem;
        sReq.ServiceFor       = fv;
        ServiceFactory.Instance.ServiceRequest(sReq);
        taxParcelProps = null;
    }
Beispiel #27
0
    private void fvItemInserting(FormView fv)
    {
        TextBox tbNote = fv.FindControl("tbNote") as TextBox;
        WACUserInputUtilityControl wcc = (WACUserInputUtilityControl)fv.FindControl("WACPR_TaxParcelPicker");

        sReq.ParmList = wcc.GetContents();
        sReq.ParmList.Add(new WACParameter("note", tbNote.Text, WACParameter.ParameterType.Property));
        sReq.ServiceFor       = fv;
        sReq.ServiceRequested = ServiceFactory.ServiceTypes.InsertItem;
        ServiceFactory.Instance.ServiceRequest(sReq);
    }
Beispiel #28
0
 /// <summary>
 /// Установить свойство Text в компоненте TextBox
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public void SetTextTextBox(FormView fv, string Control, string value)
 {
     if (fv.FindControl(Control) != null)
     {
         TextBox tb = ((TextBox)fv.FindControl(Control));
         if (tb != null)
         {
             tb.Text = value;
         }
     }
 }
Beispiel #29
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fv"></param>
 /// <param name="Control"></param>
 /// <returns></returns>
 public bool GetCheckedCheckBox(FormView fv, string Control)
 {
     if (fv.FindControl(Control) != null)
     {
         CheckBox cb = (CheckBox)fv.FindControl(Control);
         if (cb != null)
         {
             return(cb.Checked);
         }
     }
     return(false);
 }
Beispiel #30
0
    private void fvItemUpdating(FormView fv, object pk_taxParcelOwner)
    {
        TextBox tbNote = fv.FindControl("tbNote") as TextBox;
        WACUserInputUtilityControl wcc = (WACUserInputUtilityControl)fv.FindControl("WACUT_YesNoChooser");

        sReq.ParmList = wcc.GetContents();
        sReq.ParmList.Add(new WACParameter("pk_taxParcelOwner", pk_taxParcelOwner));
        sReq.ParmList.Add(new WACParameter("note", tbNote.Text, WACParameter.ParameterType.Property));
        sReq.ServiceRequested = ServiceFactory.ServiceTypes.UpdateItem;
        sReq.ServiceFor       = fv;
        ServiceFactory.Instance.ServiceRequest(sReq);
    }
 public static void SetTypes(int id, FormView FormView1, String dlID)
 {
     CheckBoxList list = (CheckBoxList)FormView1.FindControl(dlID);
     foreach (ListItem item in list.Items)
     {
         if (item.Value == id + "")
         {
             item.Selected = true;
             break;
         }
     }
 }
    public static void StoreRolesInViewState(FormView fv, String ID,StateBag ViewState,String ViewStateKey)
    {
        List<int> roles = new List<int>();

        CheckBoxList list = (CheckBoxList)fv.FindControl(ID);
        foreach (ListItem item in list.Items)
        {
            if (item.Selected)
            {
                roles.Add(int.Parse(item.Value));
            }
        }
        ViewState[ViewStateKey] = roles;
    }
 protected void setDdlList(FormView fvName, string ddlName, string cText, string dSelect)
 {
     DropDownList ddlList = (DropDownList)fvName.FindControl(ddlName);
     DataMaster dLocal = new DataMaster();
     dLocal = serviceMaster.ActionDataMaster(cText, dLocal, 21);
     switch(cText)
     {
       case "kind":
           ddlList.DataSource = dLocal.KindList;
           ddlList.DataTextField = "KName";
           ddlList.DataValueField = "KIDX";
           break;
       case "asset":
           ddlList.DataSource = dLocal.AssetList;
           ddlList.DataTextField = "AsName";
           ddlList.DataValueField = "AsIDX";
           break;
       case "materialtype":
           ddlList.DataSource = dLocal.MaterialTypeList;
           ddlList.DataTextField = "TypeName";
           ddlList.DataValueField = "TypeIDX";
           break;
       case "unit":
           ddlList.DataSource = dLocal.UnitList;
           ddlList.DataTextField = "UnitName";
           ddlList.DataValueField = "UnitIDX";
           break;
     }
     ddlList.DataBind();
     //ddlList.Items.Insert(0, new ListItem("-- Select Kind --", "0"));
     ddlList.SelectedValue = dSelect;
 }
    protected void setFormData(FormView fvName, FormViewMode fvMode, Object obj)
    {
        fvName.ChangeMode(fvMode);
        fvName.DataSource = obj;
        fvName.DataBind();

        //set kind ddl
        switch (fvMode)
        {
            case FormViewMode.Insert:
                setDdlList(fvName, "ddlKIDX", "kind", "3");
                setDdlList(fvName, "ddlAsIDX", "asset", "1");
                setDdlList(fvName, "ddlTypeIDX", "materialtype", "1");
                setDdlList(fvName, "ddlUnitIDX", "unit", "1");
                break;
            case FormViewMode.Edit:
                HiddenField typeIDX = (HiddenField)fvName.FindControl("hfTypeIDXE");
                HiddenField unitIDX = (HiddenField)fvName.FindControl("hfUnitIDXE");
                HiddenField kIDX = (HiddenField)fvName.FindControl("hfKIDXE");
                HiddenField asIDX = (HiddenField)fvName.FindControl("hfAsIDXE");
                setDdlList(fvName, "ddlKIDXE", "kind", kIDX.Value);
                setDdlList(fvName, "ddlAsIDXE", "asset", asIDX.Value);
                setDdlList(fvName, "ddlTypeIDXE", "materialtype", typeIDX.Value);
                setDdlList(fvName, "ddlUnitIDXE", "unit", unitIDX.Value);
                break;
        }
    }
    protected void setFormData(FormView fvName, FormViewMode fvMode, Object obj)
    {
        fvName.ChangeMode(fvMode);
        fvName.DataSource = obj;
        fvName.DataBind();

        //set data
        switch (fvMode)
        {
            case FormViewMode.Insert:
                break;
            case FormViewMode.Edit:
                Label lblTypeIDXE = (Label)fvName.FindControl("lblTypeIDXE");
                TextBox tbName = (TextBox)fvTypeList.FindControl("tbName");
                TextBox tbDesc = (TextBox)fvTypeList.FindControl("tbDesc");
                DropDownList ddlStatusE = (DropDownList)fvName.FindControl("ddlStatusE");
                switch (matType)
                {
                    case "kind":
                        DetailKindList[] tmpK = (DetailKindList[])obj;
                        lblTypeIDXE.Text = tmpK[0].KIDX.ToString();
                        tbName.Text = tmpK[0].KName;
                        tbDesc.Text = tmpK[0].KDesc;
                        ddlStatusE.SelectedValue = tmpK[0].KStatus.ToString();
                        break;
                    case "asset":
                        DetailAssetList[] tmpA = (DetailAssetList[])obj;
                        lblTypeIDXE.Text = tmpA[0].AsIDX.ToString();
                        tbName.Text = tmpA[0].AsName;
                        tbDesc.Text = tmpA[0].AsDesc;
                        ddlStatusE.SelectedValue = tmpA[0].AsStatus.ToString();
                        break;
                }
                break;
        }
    }
Beispiel #36
0
    private void SetDefaultValue(FormView frmView)
    {
        if (frmView.CurrentMode == FormViewMode.Edit || frmView.CurrentMode == FormViewMode.Insert)
        {
            AssetUtility Util = new AssetUtility();
            string currDate = DateTime.Now.ToString();

            TextBox UpdatedByTxb = frmView.FindControl("UpdatedByTxb") as TextBox;
            TextBox UpdatedAtTxb = frmView.FindControl("UpdatedAtTxb") as TextBox;
            TextBox TimeOfRecordingADocumentTxb = frmView.FindControl("TimeOfRecordingADocumentTxb") as TextBox;

            UpdatedByTxb.Text = Util.GetUserFullLogin().ToString();
            UpdatedAtTxb.Text = currDate;
            if (frmView.CurrentMode == FormViewMode.Insert) {
                TextBox CreatedByTxb = frmView.FindControl("CreatedByTxb") as TextBox;
                TextBox CreatedAtTxb = frmView.FindControl("CreatedAtTxb") as TextBox;
                CreatedByTxb.Text = Util.GetUserFullLogin().ToString();
                CreatedAtTxb.Text = currDate;
                TimeOfRecordingADocumentTxb.Text = currDate;
            }
        }
    }
Beispiel #37
0
 public static String GetTextBoxValue(FormView fv, String ID)
 {
     TextBox tb = (TextBox)fv.FindControl(ID);
     return tb.Text;
 }
Beispiel #38
0
 public static void SetTextBoxValue(FormView fv, String ID, String value)
 {
     TextBox tb = (TextBox)fv.FindControl(ID);
     tb.Text = value;
 }
Beispiel #39
0
 public static String GetDropDownListSelectedValue(FormView fv, String ID)
 {
     DropDownList dl = (DropDownList)fv.FindControl(ID);
     return dl.SelectedValue;
 }
 protected void setDdlMCodeList(FormView fvName, string ddlName)
 {
     DropDownList ddlList = (DropDownList)fvName.FindControl(ddlName);
     DataMaster dLocal = new DataMaster();
     dLocal = serviceMaster.ActionDataMaster("materialreg", dLocal, 22);
     ddlList.DataSource = dLocal.MaterialRegisterList;
     ddlList.DataTextField = "CMCode";
     ddlList.DataValueField = "RegIDX";
     ddlList.DataBind();
     ddlList.Items.Insert(0, new ListItem("-- Mat. Code | S/N --", "-1"));
 }
    protected void setDdlSiteList(FormView fvName, string ddlName, int selectType)
    {
        DropDownList ddlList = (DropDownList)fvName.FindControl(ddlName);
        DataMaster dLocal = new DataMaster();
        dLocal = serviceMaster.ActionDataMaster("site", dLocal, 22);

        switch (selectType)
        {
            case 1: //bangping only
                var linq1 = from s
                            in dLocal.SiteList
                            where s.SiteCode.Contains("1031") || s.SiteCode.Contains("1032") || s.SiteCode.Contains("1033")
                            select s;
                ddlList.DataSource = linq1.ToList();
                break;
            case 2: //exception bangping
                var linq2 = from s
                            in dLocal.SiteList
                            where !s.SiteCode.Contains("1031") && !s.SiteCode.Contains("1032") && !s.SiteCode.Contains("1033")
                            select s;
                ddlList.DataSource = linq2.ToList();
                break;
        }
        //ddlList.DataSource = linqData.ToList(); //dLocal.SiteList;
        ddlList.DataTextField = "SiteCodeName";
        ddlList.DataValueField = "SiteIDX";
        ddlList.DataBind();
        ddlList.Items.Insert(0, new ListItem("-- Project --", "-1"));

        if (selectType == 1) //default for bangping
        {
            ddlList.SelectedIndex = 1;
        }
    }
Beispiel #42
0
 public static void SetDropDownListValue(FormView fv, String ID, String value)
 {
     DropDownList dl = (DropDownList)fv.FindControl(ID);
     dl.SelectedValue = value;
 }
    protected void setFormData(FormView fvName, FormViewMode fvMode, Object obj)
    {
        fvName.ChangeMode(fvMode);
        fvName.DataSource = obj;
        fvName.DataBind();

        //set kind ddl
        switch (fvMode)
        {
            case FormViewMode.Insert:
                switch (recStatus)
                {
                    case 100000:
                        setDdlSiteList(fvName, "ddlFromSiteList", 1);
                        setDdlSiteList(fvName, "ddlToSiteList", 2);
                        //create order no.
                        var culture = new System.Globalization.CultureInfo("en-US");
                        string curYear = DateTime.Now.ToString("yy", culture);
                        string curMonth = DateTime.Now.ToString("MM");
                        var orderNum = "001";
                        //get max of order no.
                        DataMaster dataTempGv = (DataMaster)ViewState["dataRecord"];
                        if (dataTempGv.MaterialRecordList != null)
                        {
                            var tData = dataTempGv.MaterialRecordList;
                            try{
                                var linqMaxOrder = (from m in tData
                                                where m.RecNo.StartsWith(curYear + curMonth) && m.RecStatus == 100000
                                                orderby m.RecNo descending
                                                select m.RecNo).FirstOrDefault();//m.RecNo).Max(); //.FirstOrDefault();

                            orderNum = (int.Parse(linqMaxOrder.Substring(4)) + 1).ToString("D3");
                            } catch {
                                orderNum = "001";
                            }

                            //litTest.Text = HttpUtility.HtmlDecode(funcWeb.ConvertObjectToXml(dataTempGv));
                        }

                        TextBox tbOrderNo = (TextBox)fvName.FindControl("tbOrderNo");
                        tbOrderNo.Text = curYear + curMonth + orderNum;
                        tbOrderNo.ReadOnly = true;
                        break;
                    case 800000:
                        setDdlSiteList(fvName, "ddlFromSiteList", 2);
                        setDdlSiteList(fvName, "ddlToSiteList", 1);
                        break;
                }
                //One way to fix this is to modify our LINQ to XML query so that we indicate that YearsAtCompany is a nullable integer.  We can do this by changing the explicit cast to be (int?) instead of (int)
                ////read only selected date
                //TextBox tbOrderCreate = (TextBox)fvName.FindControl("tbOrderCreate");
                //tbOrderCreate.Attributes.Add("readonly", "readonly");
                //material code
                setDdlMCodeList(fvName, "ddlMCode");
                break;
            case FormViewMode.Edit:
                if (ViewState["vsItemLists"] != null)
                {
                    GridView gvMaterialItemList = (GridView)fvName.FindControl("gvMaterialItemList");
                    gvMaterialItemList.DataSource = ((DataMaster)ViewState["vsItemLists"]).MaterialRecordItemList;
                    gvMaterialItemList.DataBind();
                }
                break;
        }
    }
 //method checks if the package dates are viable for given formview
 //if dates are not valid, they are highlighted in red
 private static bool CheckDates(FormView currentForm)
 {
     //declare a bool to keep track if the dates are valid
     //presume dates are valid, set it to true
     bool validDates = true;
     //get the Start Date from the formview
     string date = ((Label)currentForm.FindControl("PkgStartDateLabel")).Text;
     //get today's date and save into today variable
     DateTime startDate = Convert.ToDateTime(date);
     DateTime today = DateTime.Today;
     //comapre dates
     int result = DateTime.Compare(startDate, today);
     if (result < 0) //startDate is earlier than today
     //highlight the date red
     {
         Label lbl = (Label)currentForm.FindControl("PkgStartDateLabel");
         //assign css class that has font set to red
         lbl.CssClass = "changeFont";
         validDates = false;
     }
     date = ((Label)currentForm.FindControl("PkgEndDateLabel")).Text;
     DateTime endDate = Convert.ToDateTime(date);
     result = DateTime.Compare(endDate, today);
     if (result < 0) //endDate is earlier than today
     //highlight the date red
     {
         Label lbl = (Label)currentForm.FindControl("PkgEndDateLabel");
         //assign css class that has font set to red
         lbl.CssClass = "changeFont";
         validDates = false;
     }
     return validDates;
 }