protected void Page_Load(object sender, EventArgs e)
        {
            if (_ControlObjectContext == null)
            {
                _ControlObjectContext = new ModelTMSContainer(Session["CustomerConnectString"].ToString(), Session);
            }

            WebUserControlEditOrderMaterials1.ControlObjectContext = _ControlObjectContext;

            if (!IsPostBack)
            {
                URLPopUpControlShowFreightData.Visible = false;

                DropDownListLocations.DataBind();
                DropDownListCustomers.DataBind();
                Common.LimitLocationList(DropDownListLocations.Items, Session, _ControlObjectContext);
                ShowCorrectPanels();
                ShowCorrectCustomer();

                ButtonRefresh_Click(sender, e);
            }


            ShowFreightButton();
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GenerateDescription();
                CalendarControlStart.SelectedDateTime = Common.CurrentClientDateTime(Session);
                CalendarControlEnd.SelectedDateTime   = Common.CurrentClientDateTime(Session).AddDays(1);

                CheckBoxDatesOpenEndDate.Attributes.Add("onclick", "toggle(this,'MainContent_MainContent_WebUserControlRentOut1_CalendarControlEnd_TextBoxDate'); toggle(this,'MainContent_MainContent_WebUserControlRentOut1_CalendarControlEnd_ButtonSetDate');");

                DropDownListCustomers.DataBind();
                DropDownListLocations.DataBind();

                bool CustIdSet = false;
                bool LocIdSet  = false;
                bool DescSet   = false;

                if (Request.Params["CustId"] != null)
                {
                    string   CustId = Request.Params["CustId"].ToString();
                    ListItem li     = DropDownListCustomers.Items.FindByValue(CustId);
                    if (li != null)
                    {
                        li.Selected = true;
                        CustIdSet   = true;
                    }
                }

                if (Request.Params["LocId"] != null)
                {
                    string   LocId = Request.Params["LocId"].ToString();
                    ListItem li    = DropDownListLocations.Items.FindByValue(LocId);
                    if (li != null)
                    {
                        li.Selected = true;
                        LocIdSet    = true;
                    }
                }

                if (Request.Params["Description"] != null)
                {
                    TextBox_Description.Text = Request.Params["Description"].ToString();
                    DescSet = TextBox_Description.Text.Trim() != "";
                }

                if (Request.Params["Identification"] != null)
                {
                    TextBox_DriverId.Text = Request.Params["Identification"].ToString();
                    DescSet = TextBox_Description.Text.Trim() != "";
                }

                if (LocIdSet && CustIdSet && DescSet)
                {
                    CurrentPageNr = 2;
                }
            }
        }
Esempio n. 3
0
    /// <summary>
    /// Author Sonia
    /// Fills the Locations combo
    /// </summary>
    private void FillLocationsCombo()
    {
        // To Fill Locations Combo

        //Following commented as per Task #2394
        //DataSet DataSetLocations = null;
        //DataSetLocations = Streamline.UserBusinessServices.SharedTables.DataSetLocations;
        //Following code added as per Task #2394
        DataTable DataTableStaffLocations = null;

        DataView DataViewLocations = null;

        try
        {
            CommonFunctions.Event_Trap(this);
            DataTableStaffLocations = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).StaffPrescribingLocations;
            //Following changed as per Task #2394
            //DataViewLocations = DataSetLocations.Tables[0].DefaultView;
            DataViewLocations                    = DataTableStaffLocations.DefaultView;
            DataViewLocations.Sort               = "LocationName Asc";
            DropDownListLocations.DataSource     = DataViewLocations;
            DropDownListLocations.DataTextField  = "LocationName";
            DropDownListLocations.DataValueField = "LocationId";
            DropDownListLocations.DataBind();

            DropDownListLocations.Items.Insert(0, new ListItem("........Select Location........", "0"));
            DropDownListLocations.SelectedIndex = 0;
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = CommonFunctions.Event_FormatString("###Source Function Name - FillLocationsCombo(),ParameterCount 0 - ###");
            }
            else
            {
                ex.Data["CustomExceptionInformation"] = CommonFunctions.Event_FormatString(ex.Data["CustomExceptionInformation"].ToString());
            }
            if (ex.Data["DatasetInfo"] == null)
            {
                ex.Data["DatasetInfo"] = null;
            }
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
        }
        finally
        {
            DataViewLocations = null;
            if (DataTableStaffLocations != null)
            {
                DataTableStaffLocations.Dispose();
            }
        }
    }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DropDownListLocations.DataBind();
                DropDownListCustomers.DataBind();

                bool CustIdSet = false;
                bool LocIdSet  = false;

                if (Request.Params["CustId"] != null)
                {
                    string   CustId = Request.Params["CustId"].ToString();
                    ListItem li     = DropDownListCustomers.Items.FindByValue(CustId);
                    if (li != null)
                    {
                        li.Selected = true;
                        CustIdSet   = true;
                    }
                }

                if (Request.Params["LocId"] != null)
                {
                    string   LocId = Request.Params["LocId"].ToString();
                    ListItem li    = DropDownListLocations.Items.FindByValue(LocId);
                    if (li != null)
                    {
                        li.Selected = true;
                        LocIdSet    = true;
                    }
                }

                if (LocIdSet && CustIdSet)
                {
                    PageNr = 2;
                }
            }
        }
        public void LoadFromFreight(Freight frg, bool ForceReload)
        {
            if ((LabelFreightGuid.Text != frg.Id.ToString()) || ForceReload)
            {
                ListItem        li  = null;
                FreightWeighing fgw = null;
                if (frg.FreightWeighing.Count > 0)
                {
                    fgw = frg.FreightWeighing.First <FreightWeighing>();
                }

                LabelOrderNr.Text        = frg.OurReference.ToString();
                TextBox_Description.Text = frg.Description;

                if (frg.FreightDirection == "To warehouse")
                {
                    // switch to purchase order
                    SwitchPurchaseType(InvoiceType.Buy);
                }
                else
                {
                    // switch to sales order
                    SwitchPurchaseType(InvoiceType.Sell);
                }

                // first load the customer, this is required for Freights
                DropDownListCustomers.DataBind();
                li = DropDownListCustomers.Items.FindByValue(frg.FromRelation.Id.ToString());
                if (li != null)
                {
                    li.Selected      = true;
                    LabelCustID.Text = li.Value;
                }

                DropDownListLocations.DataBind();
                li = DropDownListLocations.Items.FindByValue(frg.SourceOrDestinationLocation.Id.ToString());
                if (li != null)
                {
                    li.Selected = true;
                }

                DropDownListCustomerFreights.DataBind();
                li = DropDownListCustomerFreights.Items.FindByValue(frg.Id.ToString());
                if (li != null)
                {
                    li.Selected = true;
                    DropDownListCustomerFreights.SelectedIndex = DropDownListCustomerFreights.Items.IndexOf(li);
                }

                TextBox_YourTruckPlate.Text = frg.YourTruckPlate;
                TextBox_YourDriverName.Text = frg.YourDriverName;

                if (fgw != null)
                {
                    TextBoxFreightID.Text = fgw.Description;
                }

                WebUserControlEditOrderMaterials1.LoadFromFreight(frg);

                LabelFreightGuid.Text = frg.Id.ToString();
            }
        }