/// <summary> /// populate the grid with request types /// </summary> protected void LoadGrid() { Affinity.RequestTypeCriteria rtc = new Affinity.RequestTypeCriteria(); //rtc.IsActive = 1; Affinity.RequestTypes requesttypes = new Affinity.RequestTypes(this.phreezer); requesttypes.Query(rtc); oGrid.DataSource = requesttypes; oGrid.DataBind(); }
/// <summary> /// This will reload the request type definitions from the /// xml files in the RequestTypes folder /// </summary> public void ReloadAllDefinitions(string path) { RequestTypes rts = new RequestTypes(this.phreezer); rts.Query(new RequestTypeCriteria()); foreach (RequestType rt in rts) { rt.Definition = File.ReadAllText(path + rt.Code + ".xml"); rt.Update(); } }
/// <summary> /// Returns a collection of request types that are available for /// this order. Will exclude any types for which an order has already been /// submitted /// </summary> /// <returns></returns> public RequestTypes GetAvailableRequestTypes() { // TODO create criteria parameters to run this as a distinct query // first get all the requests for this order and add them to a buffer array Requests rs = this.GetOrderRequests(new RequestCriteria()); ArrayList buff = new ArrayList(); foreach (Request r in rs) { if (!buff.Contains(r.RequestTypeCode)) { buff.Add(r.RequestTypeCode); } } // now get all the request types and add them to a collection if they // do not exist in our buffer array RequestTypes rts = new RequestTypes(this.phreezer); RequestTypeCriteria rtc = new RequestTypeCriteria(); rtc.IsActive = 1; rts.Query(rtc); RequestTypes return_rts = new RequestTypes(this.phreezer); foreach (RequestType rt in rts) { if (!buff.Contains(rt.Code)) { return_rts.Add(rt); } } return(return_rts); }
protected void Page_Load(object sender, EventArgs e) { this.RequirePermission(Affinity.RolePermission.SubmitOrders); string id = NoNull.GetString(Request["id"]); string keyAttribute = NoNull.GetString(Request["key"], "sp_id"); string format = NoNull.GetString(Request["format"], "hash"); string exportformat = "PFT"; if (!format.Equals("entire")) { Affinity.Request r = new Affinity.Request(this.phreezer); r.Load(id); // make sure this user has permission to make updates to this order if (!r.Order.CanRead(this.GetAccount())) { this.Crash(300, "Permission denied."); } IBaseRenderer renderer = null; // depending on the format requested, get the correct renderer object switch (format) { case "entire": break; case "xml": exportformat = "Generic XML"; renderer = new XmlRenderer(r, this.GetSystemSettings()); break; case "rei": exportformat = "REI XML"; renderer = new XmlREIRenderer(r, this.GetSystemSettings()); break; case "change": exportformat = "PFT (Changes Only)"; renderer = new PFTChangeRenderer(r, this.GetSystemSettings()); break; case "TPS": exportformat = "TPS"; renderer = new TPSServicePFTRenderer(r, this.GetSystemSettings()); break; //case "special": // renderer = new XmlSpecialRenderer(r, this.GetSystemSettings()); // break; default: renderer = new PFTRenderer(r, this.GetSystemSettings()); break; } Affinity.ExportLog exportlog = new Affinity.ExportLog(this.phreezer); Affinity.Account account = this.GetAccount(); exportlog.AccountID = account.Id; exportlog.OrderID = r.OrderId; exportlog.RequestID = r.Id; exportlog.ExportFormat = exportformat; exportlog.Insert(); // output the results of the renderer OutputRenderer(renderer, keyAttribute); } else { Affinity.RequestTypes rts = new Affinity.RequestTypes(this.phreezer); Affinity.RequestTypeCriteria rtc = new Affinity.RequestTypeCriteria(); rtc.IsActive = 1; rts.Query(rtc); Object [] renderers = new Object[rts.Count]; IEnumerator i = rts.GetEnumerator(); int j = 0; bool isClerkingServices = false; Affinity.Account account = this.GetAccount(); exportformat = "Entire Order"; while (i.MoveNext()) { Affinity.RequestType rt = (Affinity.RequestType)i.Current; Affinity.Order order = new Affinity.Order(this.phreezer); order.Load(id); Affinity.RequestCriteria rc = new Affinity.RequestCriteria(); rc.RequestTypeCode = rt.Code; order.GetOrderRequests(rc); Affinity.Requests reqs = order.GetOrderRequests(rc); Affinity.Request r = null; if (reqs.Count > 0) { r = (Affinity.Request)reqs[0]; if (rt.Code.Equals("ClerkingRequest")) { isClerkingServices = true; } IBaseRenderer renderer = new PFTRenderer(r, this.GetSystemSettings()); renderers[j] = renderer; j++; } if (r != null) { Affinity.ExportLog exportlog = new Affinity.ExportLog(this.phreezer); exportlog.AccountID = account.Id; exportlog.OrderID = r.OrderId; exportlog.RequestID = r.Id; exportlog.ExportFormat = exportformat; exportlog.Insert(); } } OutputMultiRenderer(renderers, keyAttribute, isClerkingServices); } }