예제 #1
0
        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);
        }
예제 #3
0
        private void bindData()
        {
            List <ExpenseType> expenseTypes = null;

            using (ExpenseTypeManager repository = new ExpenseTypeManager()) {
                expenseTypes = repository.GetAll(clientID).ToList();
            }

            gvExpenseType.DataSource = expenseTypes;
            gvExpenseType.DataBind();
        }
예제 #4
0
        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();
        }
예제 #5
0
        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);
                }
            }
        }