private List <vw_InvoiceApprovalQueue> getInvoicesFromQueue() { int clientID = SessionHelper.getClientId(); int roleID = SessionHelper.getUserRoleId(); IQueryable <vw_InvoiceApprovalQueue> invoices = null; List <vw_InvoiceApprovalQueue> filterInvoices = null; List <SecRoleInvoiceApprovalPermission> rules = null; // load invoices invoices = InvoiceManager.GetInvoiceApprovalQueue(clientID); SecRoleModule accountingList = null; accountingList = SecRoleModuleManager.GetByRoleIdAccounting(roleID);//NEW OC 10/14/14 added to show invoices depending on role manager(not by client only) if (roleID == (int)UserRole.Client || accountingList.ViewPermission == true) { //InvoiceType invoiceType = null; // foreach(vw_InvoiceApprovalQueue ipq in invoices) // { // int typeID = Convert.ToInt32( ipq.InvoiceTypeID); // invoiceType = InvoiceTypeManager.GetByID(typeID); // string invoiceTypeDescription = invoiceType.InvoiceTypes; // Label lblInv = (Label)gvInvoiceQ.FindControl("lblInvoiceType") as Label; // lblInv.Text = invoiceTypeDescription; // //Session["invoiceTypeDescription"] = invoiceType.InvoiceTypes; // } // load all invoices for client filterInvoices = invoices.ToList(); } else { filterInvoices = new List <vw_InvoiceApprovalQueue>(); // get invoice approval rules for role rules = InvoiceApprovalRuleManager.GetAll(roleID); // enforce approval rules if (rules != null && rules.Count > 0) { foreach (SecRoleInvoiceApprovalPermission rule in rules) { foreach (vw_InvoiceApprovalQueue invoiceq in invoices) { if (invoiceq.TotalAmount >= rule.AmountFrom && invoiceq.TotalAmount <= rule.AmountTo) { filterInvoices.Add(invoiceq); } } } } } return(filterInvoices); }
private void bindPermissions(int roleID) { List <SecRoleInvoiceApprovalPermission> rules = null; rules = InvoiceApprovalRuleManager.GetAll(roleID); gvInvoiceApprovalRules.DataSource = rules; gvInvoiceApprovalRules.DataBind(); }
protected void doBind() { List <SecRoleInvoiceApprovalPermission> invoiceApprovalRules = null; IQueryable <Invoice> invoices = InvoiceManager.GetInvoicesForApproval(clientID); // load approval lmits for role invoiceApprovalRules = InvoiceApprovalRuleManager.GetAll(roleID); ViewState["InvoiceApprovalRules"] = invoiceApprovalRules; gvInvoice.DataSource = invoices.ToList(); gvInvoice.DataBind(); }