protected void btnSave_Click(object sender, EventArgs e) { ExpenseType expense = null; int expenseID = 0; lblMessage.Text = string.Empty; lblMessage.CssClass = string.Empty; expenseID = Convert.ToInt32(ViewState["ExpenseTypeID"]); if (expenseID == 0) { expense = new ExpenseType(); expense.ClientID = this.clientID; expense.IsActive = true; } else { using (ExpenseTypeManager repository = new ExpenseTypeManager()) { expense = repository.Get(expenseID); } } if (expense != null) { expense.ExpenseName = txtExpenseName.Text.Trim(); expense.ExpenseDescription = txtExpenseDescription.Text.Trim(); try { using (ExpenseTypeManager repository = new ExpenseTypeManager()) { expense = repository.Save(expense); } showGridPanel(); // refresh grid bindData(); } catch (Exception ex) { Core.EmailHelper.emailError(ex); showErrorMessage(); } } }
/// <summary> /// Deprecated Method for adding a new object to the ExpenseTypes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToExpenseTypes(ExpenseType expenseType) { base.AddObject("ExpenseTypes", expenseType); }
/// <summary> /// Create a new ExpenseType object. /// </summary> /// <param name="expenseTypeID">Initial value of the ExpenseTypeID property.</param> /// <param name="expenseName">Initial value of the ExpenseName property.</param> /// <param name="clientID">Initial value of the ClientID property.</param> /// <param name="isActive">Initial value of the IsActive property.</param> public static ExpenseType CreateExpenseType(global::System.Int32 expenseTypeID, global::System.String expenseName, global::System.Int32 clientID, global::System.Boolean isActive) { ExpenseType expenseType = new ExpenseType(); expenseType.ExpenseTypeID = expenseTypeID; expenseType.ExpenseName = expenseName; expenseType.ClientID = clientID; expenseType.IsActive = isActive; return expenseType; }