Example #1
0
        private void PerformSearch()
        {
            bool noCriteria = false;

            if (cboClient.Text == "" && txtTicketNo.Text == "" && dteSignatureDate.Text == "" && txtCustomerRef.Text == "" && txtDestination.Text == "")
            {
                noCriteria = true;
            }

            Facade.IPOD facPOD = new Facade.POD();

            DataSet dsPODSearchResults = null;

            if (noCriteria)
            {
                dsPODSearchResults = facPOD.GetAll();
            }
            else
            {
                int      clientId          = cboClient.SelectedValue == "" ? 0 : int.Parse(cboClient.SelectedValue);
                int      loadNo            = txtLoadNo.Text == "" ? 0 : int.Parse(txtLoadNo.Text);
                string   ticketNo          = txtTicketNo.Text == "" ? "" : txtTicketNo.Text;
                string   customerReference = txtCustomerRef.Text == "" ? "" : txtCustomerRef.Text;
                string   destination       = txtDestination.Text == "" ? "" : txtDestination.Text;
                DateTime signatureDate;
                DateTime scannedDate;

                if (dteSignatureDate.SelectedDate.Value == DateTime.MinValue)
                {
                    signatureDate = Convert.ToDateTime(Convert.ToString(SqlDateTime.MinValue));
                }
                else
                {
                    signatureDate = dteSignatureDate.SelectedDate.Value;
                }
                scannedDate = Convert.ToDateTime(Convert.ToString(SqlDateTime.MinValue));
                //dsPODSearchResults = facPOD.GetWithParams(clientId, ticketNo, signatureDate, scannedDate, scannedDateFrom, scannedDateTo, loadNo, customerReference, destination);
            }
            ViewState["PODSearchResults"] = dsPODSearchResults;
            dgPODSearchResults.DataSource = dsPODSearchResults;

            dgPODSearchResults.DataBind();
        }
Example #2
0
        private void GetPODs()
        {
            bool noCriteria = false;

            if (dteDateOfDelivery.DateInput.Text == String.Empty && dteDateOfDeliveryFrom.DateInput.Text == String.Empty && dteDateOfDeliveryTo.DateInput.Text == String.Empty &&
                cboClient.Text == String.Empty && cboClientsCustomer.Text == String.Empty && txtTicketNo.Text == String.Empty &&
                this.orderIdTextbox.Text == String.Empty && this.loadNoTextbox.Text == String.Empty &&
                this.docketNoTextbox.Text == String.Empty && this.customerReferenceTextbox.Text == String.Empty &&
                this.jobIdTextbox.Text == String.Empty && this.trailerRefTextbox.Text == String.Empty)
            {
                noCriteria = true;
            }

            Facade.IPOD facPOD = new Facade.POD();

            if (noCriteria)
            {
                dsPODList = facPOD.GetAll();
            }
            else
            {
                // By POD Filtering
                int      clientId = cboClient.SelectedValue == "" ? 0 : int.Parse(cboClient.SelectedValue);
                int      clientsCustomerId = cboClientsCustomer.SelectedValue == "" ? 0 : int.Parse(cboClientsCustomer.SelectedValue);
                string   ticketNo = txtTicketNo.Text == "" ? "" : txtTicketNo.Text;
                DateTime deliveryDate, deliveryDateFrom, deliveryDateTo;

                if (dteDateOfDelivery.SelectedDate == null || dteDateOfDelivery.SelectedDate.Value == DateTime.MinValue)
                {
                    deliveryDate = Convert.ToDateTime(Convert.ToString(SqlDateTime.MinValue));
                }
                else
                {
                    deliveryDate = dteDateOfDelivery.SelectedDate.Value;
                }

                if (dteDateOfDeliveryFrom.SelectedDate == null || dteDateOfDeliveryFrom.SelectedDate.Value == DateTime.MinValue)
                {
                    deliveryDateFrom = Convert.ToDateTime(Convert.ToString(SqlDateTime.MinValue));
                }
                else
                {
                    deliveryDateFrom = dteDateOfDeliveryFrom.SelectedDate.Value;
                }


                if (dteDateOfDeliveryTo.SelectedDate == null || dteDateOfDeliveryTo.SelectedDate.Value == DateTime.MinValue)
                {
                    deliveryDateTo = Convert.ToDateTime(Convert.ToString(SqlDateTime.MinValue));
                }
                else
                {
                    deliveryDateTo = dteDateOfDeliveryTo.SelectedDate.Value;
                    deliveryDateTo = deliveryDateTo.Add(new TimeSpan(23, 59, 00));
                }

                // By Job Filtering
                string loadNo = this.loadNoTextbox.Text.Trim();
                string docketNo          = this.docketNoTextbox.Text.Trim();
                string customerReference = this.customerReferenceTextbox.Text.Trim();;
                string trailerRef        = this.trailerRefTextbox.Text.Trim();
                int    jobId   = 0;
                int    orderId = 0;

                if (!String.IsNullOrEmpty(this.jobIdTextbox.Text))
                {
                    int.TryParse(this.jobIdTextbox.Text, out jobId);
                }

                if (!String.IsNullOrEmpty(this.orderIdTextbox.Text))
                {
                    int.TryParse(this.orderIdTextbox.Text, out orderId);
                }

                dsPODList = facPOD.GetWithParams(clientId, clientsCustomerId, ticketNo, deliveryDate, deliveryDateFrom,
                                                 deliveryDateTo, loadNo, docketNo, customerReference, trailerRef, jobId, orderId);
            }

            ViewState["C_PODDATA_VS"] = dsPODList;

            if (dsPODList.Tables[0].Rows.Count > 0)
            {
                dgPODList.DataSource = dsPODList;

                dgPODList.DataBind();
                dgPODList.Visible = true;
                lblError.Visible  = false;
            }
            else
            {
                lblError.Visible  = true;
                dgPODList.Visible = false;
            }
        }