protected void gvExpenseType_Sorting(object sender, GridViewSortEventArgs e) { IQueryable <ExpenseType> expenseTypes = null; bool descending = false; if (ViewState[e.SortExpression] == null) { descending = false; } else { descending = !(bool)ViewState[e.SortExpression]; } ViewState[e.SortExpression] = descending; using (ExpenseTypeManager repository = new ExpenseTypeManager()) { expenseTypes = repository.GetAll(clientID); gvExpenseType.DataSource = expenseTypes.orderByExtension(e.SortExpression, descending); gvExpenseType.DataBind(); } }
private void bindInvoiceExpenses() { List <ExpenseType> expenses = null; int clientID = Core.SessionHelper.getClientId(); using (ExpenseTypeManager repository = new ExpenseTypeManager()) { expenses = repository.GetAll(clientID).ToList(); } Core.CollectionManager.FillCollection(ddlExpenses, "ExpenseTypeID", "ExpenseName", expenses); }
private void bindData() { List <ExpenseType> expenseTypes = null; using (ExpenseTypeManager repository = new ExpenseTypeManager()) { expenseTypes = repository.GetAll(clientID).ToList(); } gvExpenseType.DataSource = expenseTypes; gvExpenseType.DataBind(); }
public void bindData() { clientID = Core.SessionHelper.getClientId(); List <ExpenseType> expenseTypes = null; using (ExpenseTypeManager repository = new ExpenseTypeManager()) { expenseTypes = repository.GetAll(clientID).ToList(); } gvExpenseType.DataSource = expenseTypes; gvExpenseType.DataBind(); }
public void bindData(BusinessRule businessRule) { int clientID = SessionHelper.getClientId(); List <Carrier> carriers = null; List <ExpenseType> expenseTypes = null; // load carriers carriers = CarrierManager.GetCarriers(clientID).ToList(); CollectionManager.FillCollection(ddlCarrier, "CarrierID", "CarrierName", carriers); // load expenses using (ExpenseTypeManager repository = new ExpenseTypeManager()) { expenseTypes = repository.GetAll(clientID).ToList(); } CollectionManager.FillCollection(ddlExpenseType, "ExpenseTypeID", "ExpenseName", expenseTypes); ViewState["businessRuleID"] = businessRule.BusinessRuleID.ToString(); clearFields(); if (businessRule.BusinessRuleID == 0) { // for new rules only. cbxActive.Checked = true; } else { // edit XElement ruleXML = XElement.Parse(businessRule.RuleXML); cbxActive.Checked = businessRule.IsActive; cbxEmailAdjuster.Checked = businessRule.EmailAdjuster; cbxEmailSupervisor.Checked = businessRule.EmailSupervisor; txtDescription.Text = businessRule.Description; using (RuleHelper ruleHelper = new RuleHelper()) { XElement conditionCarrier = ruleHelper.GetElement(ruleXML, "CarrierID"); setValue(ddlCarrier, conditionCarrier.Element("value").Value); XElement conditionAdjuster = ruleHelper.GetElement(ruleXML, "ExpenseTypeID"); setValue(ddlExpenseType, conditionAdjuster.Element("value").Value); } } }