/// <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; }
/// <summary> /// Returns a collection of Order objects /// </summary> /// <param name="criteria"></param> /// <returns>Orders</returns> public Orders GetInternalStatuss(OrderCriteria criteria) { criteria.InternalStatusCode = this.Code; Orders internalStatuss = new Orders(this.phreezer); internalStatuss.Query(criteria); return(internalStatuss); }
/* ~~~ CONSTRAINTS ~~~ */ /* ~~~ SETS ~~~ */ /// <summary> /// Returns a collection of Order objects /// </summary> /// <param name="criteria"></param> /// <returns>Orders</returns> public Orders GetCustomerStatuss(OrderCriteria criteria) { criteria.CustomerStatusCode = this.Code; Orders customerStatuss = new Orders(this.phreezer); customerStatuss.Query(criteria); return(customerStatuss); }
/// <summary> /// Gets all orders from any other person within my company /// </summary> /// <param name="criteria"></param> /// <returns></returns> public Orders GetCompanyOrders(OrderCriteria criteria) { criteria.CompanyId = this.CompanyId; Orders accountOrders = new Orders(this.phreezer); accountOrders.Query(criteria); return(accountOrders); }
/// <summary> /// Returns a collection of Order objects /// </summary> /// <param name="criteria"></param> /// <param name="filterOriginatorId"></param> /// <returns>Orders</returns> protected Orders GetAccountOrders(OrderCriteria criteria, bool filterOriginatorId) { if (filterOriginatorId) { criteria.OriginatorId = this.Id; } Orders accountOrders = new Orders(this.phreezer); accountOrders.Query(criteria); return(accountOrders); }
/// <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; }
/// <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); }
/* ~~~ SETS ~~~ */ /// <summary> /// Returns a collection of Order objects /// </summary> /// <param name="criteria"></param> /// <returns>Orders</returns> protected Orders GetAccountOrders(OrderCriteria criteria) { return(GetAccountOrders(criteria, true)); }
/// <summary> /// Alias for GetAccountOrders /// </summary> /// <param name="criteria"></param> /// <param name="filterOriginatorId"></param> /// <returns></returns> public Orders GetOrders(OrderCriteria criteria, bool filterOriginatorId) { return(this.GetAccountOrders(criteria, filterOriginatorId)); }
/// <summary> /// Alias for GetAccountOrders /// </summary> /// <param name="criteria"></param> /// <returns></returns> public Orders GetOrders(OrderCriteria criteria) { return(GetOrders(criteria, true)); }