Exemple #1
0
    /// <summary>
    /// populate the grid from this accounts data
    /// </summary>
    /// <param name="se">sort expression</param>
    /// <param name="sd">sort direction</param>
    /// <param name="pi">page index</param>
    protected void LoadGrid(string se, SortDirection sd, int pi)
    {
        Affinity.OrderCriteria oc = new Affinity.OrderCriteria();
        oc.AppendToOrderBy(se, sd == SortDirection.Descending);

        // don't show closed orders unless the box is checked
        oc.HideInternalClosed = (!cbShowClosed.Checked);

        // set the page index after binding
        oGrid.PageIndex = pi;

        // TODO: implment custom paging for performance
        oc.PagingEnabled    = true;
        oc.PageSize         = oGrid.PageSize;
        oc.Page             = oGrid.PageIndex + 1;
        oc.OrderUploadLogId = (cbShowStandard.Checked)? 0 : 1;

        if (txtQuery.Text != "")
        {
            oc.SearchQuery = txtQuery.Text;
            // TODO: implement closed
            //oc.CustomerStatusCode = cbShowClosed.Checked ? "" : "";
            searchFilter = false;
        }

        Affinity.Orders orders = new Affinity.Orders(this.phreezer);
        orders.Query(oc);

        oGrid.DataSource = orders;
        oGrid.DataBind();


        ViewState["lastSE"] = se;
        ViewState["lastSD"] = sd;
    }
Exemple #2
0
    /// <summary>
    /// populate the grid from this accounts data
    /// </summary>
    /// <param name="se">sort expression</param>
    /// <param name="sd">sort direction</param>
    /// <param name="pi">page index</param>
    protected void LoadGrid(string se, SortDirection sd, int pi)
    {
        Affinity.OrderCriteria oc = new Affinity.OrderCriteria();
        oc.AppendToOrderBy(se, sd == SortDirection.Descending);
        oc.HideInactive = (!cbShowInactive.Checked);

        // set the page index after binding
        oGrid.PageIndex = pi;

        // TODO: implment custom paging for performance
        oc.PagingEnabled = true;
        oc.PageSize      = oGrid.PageSize;
        oc.Page          = oGrid.PageIndex + 1;

        if (txtQuery.Text != "")
        {
            oc.SearchQuery = txtQuery.Text;
            // TODO: implement closed
            //oc.CustomerStatusCode = cbShowClosed.Checked ? "" : "";
            searchFilter = false;
        }

        // we can either show the accounts orders, or if they are a manager, we show
        // all from their company
        if (this.GetAccount().Role.HasPermission(Affinity.RolePermission.ModifyOtherEmployeeOrders))
        {
            oGrid.DataSource = this.GetAccount().GetCompanyOrders(oc);
        }
        else
        {
            oGrid.DataSource = this.GetAccount().GetOrders(oc);
        }
        oGrid.DataBind();


        ViewState["lastSE"] = se;
        ViewState["lastSD"] = sd;
    }
Exemple #3
0
        /// <summary>
        /// Returns the most recent previous order with the same PIN or the same address and city (or null if none exist)
        /// </summary>
        /// <param name="anyOrisameOriginatorOnlyginator">true will only include orders from the same originator as this one</param>
        /// <returns>Order || null</returns>
        public Order GetPrevious(bool sameOriginatorOnly)
        {
            Order returnOrder = null;

            OrderCriteria chkorderCriteria = new OrderCriteria();

            chkorderCriteria.AppendToOrderBy("Created", true);
            chkorderCriteria.FindDuplicateOf = this;
            if (sameOriginatorOnly)
            {
                chkorderCriteria.OriginatorId = this.OriginatorId;
            }

            Orders chkorders = new Orders(this.phreezer);

            chkorders.Query(chkorderCriteria);

            if (chkorders.Count > 0)
            {
                returnOrder = (Order)chkorders[0];
            }

            return(returnOrder);
        }