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(); }
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(); } } }
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(); } }
protected void gvExpenseType_RowCommand(object sender, GridViewCommandEventArgs e) { int expenseID = 0; ExpenseType expense = null; if (e.CommandName == "DoEdit") { expenseID = Convert.ToInt32(e.CommandArgument); using (ExpenseTypeManager repository = new ExpenseTypeManager()) { expense = repository.Get(expenseID); } if (expense != null) { showEditPanel(); txtExpenseDescription.Text = expense.ExpenseDescription; txtExpenseName.Text = expense.ExpenseName; txtRateAmount.Value = expense.ExpenseRate; ViewState["ExpenseTypeID"] = expenseID.ToString(); } } else if (e.CommandName == "DoDelete") { try { expenseID = Convert.ToInt32(e.CommandArgument); using (ExpenseTypeManager repository = new ExpenseTypeManager()) { expense = repository.Get(expenseID); if (expense != null) { expense.IsActive = false; expense = repository.Save(expense); // refresh grid bindData(); } } } catch (Exception ex) { Core.EmailHelper.emailError(ex); showErrorMessage(); } } }
protected void fillClaimStatusReview(int clientd) { ClaimManager objClaimManager = new ClaimManager(); List<Carrier> objCarrier = new List<Carrier>(); objCarrier = objClaimManager.GetAllCarrier(clientd); List<ContactList> objContactlist = new List<ContactList>(); List<Contact> listContact = ContactManager.GetAll(clientd).ToList(); List<StatusMaster> statusMasters = null; List<ExpenseType> expenseTypes = null; ContactList objcontact1; foreach (Contact data in listContact) { objcontact1 = new ContactList(); objcontact1.ContactID = data.ContactID; objcontact1.FirstName = data.FirstName; objcontact1.LastName = data.LastName; objcontact1.Email = data.Email; objcontact1.CompanyName = data.CompanyName; objcontact1.IdOf = "c"; objContactlist.Add(objcontact1); } List<AdjusterMaster> listAdjuster = CRM.Data.Account.AdjusterManager.GetAll(clientd).ToList(); foreach (AdjusterMaster data in listAdjuster) { objcontact1 = new ContactList(); objcontact1.ContactID = data.AdjusterId; objcontact1.FirstName = data.FirstName; objcontact1.LastName = data.LastName; objcontact1.Email = data.email; objcontact1.CompanyName = data.CompanyName; objcontact1.IdOf = "a"; objContactlist.Add(objcontact1); } gvSelectRecipients.DataSource = objContactlist.AsQueryable(); gvSelectRecipients.DataBind(); gvSelectRecipientsStatus.DataSource = objContactlist.AsQueryable(); gvSelectRecipientsStatus.DataBind(); gvSelectRecipientsExpense.DataSource = objContactlist.AsQueryable(); gvSelectRecipientsExpense.DataBind(); statusMasters = StatusManager.GetList(clientd); if (statusMasters!=null) { CollectionManager.FillCollection(ddlClaimStatusReview, "StatusId", "StatusName", statusMasters); } if (objCarrier!=null) { CollectionManager.FillCollection(ddlClaimCarrier, "CarrierID", "CarrierName", objCarrier); CollectionManager.FillCollection(ddlExpenseClaimCarrier, "CarrierID", "CarrierName", objCarrier); } Client objClient = ClaimsManager.GetClientByUserId(SessionHelper.getUserId()); if (objClient!=null) { txtAdjusterComapnyName.Text = objClient.BusinessName; txtExpenseAdjusterComapnyName.Text = objClient.BusinessName; } using (ExpenseTypeManager repository = new ExpenseTypeManager()) { expenseTypes = repository.GetAll(clientd).ToList(); } if (expenseTypes!=null) { Core.CollectionManager.FillCollection(ddlExpenseType, "ExpenseTypeID", "ExpenseName", expenseTypes); } }
protected void gvExpense_RowCommand(object sender, GridViewCommandEventArgs e) { ClaimExpense claimExpense = null; int claimID = SessionHelper.getClaimID(); int id = 0; if (e.CommandName == "DoEdit") { id = Convert.ToInt32(e.CommandArgument); using (ClaimExpenseManager repository = new ClaimExpenseManager()) { claimExpense = repository.Get(id); } if (claimExpense != null) { txtExpenseAmount.Value = claimExpense.ExpenseAmount; txtExpenseQty.Value = claimExpense.ExpenseQty; if (claimExpense.ExpenseDate != null) txtExpenseDate.Value = claimExpense.ExpenseDate; txtExpenseDescription.Text = claimExpense.ExpenseDescription; cbxExpenseReimburse.Checked = claimExpense.IsReimbursable; ddlExpenseType.SelectedValue = claimExpense.ExpenseTypeID.ToString(); txtMyComments.Text = claimExpense.InternalComments; //cbIsBillable.Checked = claimExpense.IsBillable.Value; //NEW OC 10/7/2014 // PUT IN PLACE TO GRAB THE NEW RATE IF USER HITS EDIT ExpenseType expense = null; int expenseID = 0; if (ddlExpenseType.SelectedIndex > 0) { expenseID = Convert.ToInt32(ddlExpenseType.SelectedValue); using (ExpenseTypeManager repository = new ExpenseTypeManager()) { expense = repository.Get(expenseID); if (expense != null) { txtExpenseAmount.Value = expense.ExpenseRate; Session["multiplier"] = expense.ExpenseRate; } } } // END NEW OC 10/7/2014 if (claimExpense.AdjusterID != null) { txtExpenseAdjuster.Text = claimExpense.AdjusterMaster.adjusterName; hf_expenseAdjusterID.Value = claimExpense.AdjusterMaster.AdjusterId.ToString(); } showExpenseEditPanel(); ViewState["ClaimExpenseID"] = e.CommandArgument.ToString(); } } else if (e.CommandName == "DoDelete") { id = Convert.ToInt32(e.CommandArgument); try { using (ClaimExpenseManager repository = new ClaimExpenseManager()) { repository.Delete(id); } // refresh grid gvExpense.DataSource = loadExpenses(claimID); gvExpense.DataBind(); } catch (Exception ex) { Core.EmailHelper.emailError(ex); lblMessage.Text = "Unable to delete claim expense."; lblMessage.CssClass = "error"; } } }
protected void ddlExpenseType_SelectedIndexChanged(object sender, EventArgs e) { ExpenseType expense = null; int expenseID = 0; if (ddlExpenseType.SelectedIndex > 0) { expenseID = Convert.ToInt32(ddlExpenseType.SelectedValue); using(ExpenseTypeManager repository = new ExpenseTypeManager()){ expense = repository.Get(expenseID); if (expense != null) { Session["multiplier"] = expense.ExpenseRate; if(Convert.ToDouble(expense.ExpenseRate) == 0.00) { txtExpenseQty.Text = ""; txtExpenseQty.Enabled = false; txtExpenseAmount.Visible = true; lblMyAmount.Text = "Amount"; lblAmount.Text = ""; lblAmount.Visible = false; } else { txtExpenseQty.Enabled = true; lblAmount.Visible = true; lblAmount.Text = "$" + expense.ExpenseRate.ToString(); txtExpenseAmount.Visible = false; lblMyAmount.Text = "Rate"; } // txtExpenseAmount.Value = "";//expense.ExpenseRate; } } } }
public void bindData(int claimID) { masterPage = this.Page.Master.Master as Protected.ClaimRuler; int clientID = SessionHelper.getClientId(); List<ClaimExpense> expenses = null; List<ExpenseType> expenseTypes = null; expenses = loadExpenses(claimID); if(Session["ComingFromAllClaimsExpense"] != null) { pnlEditExpense.Visible = true; } gvExpense.DataSource = expenses; gvExpense.DataBind(); if (Session["ComingFromAllClaimsExpense"] != null)//NEW OC 10/20/2014 ADDED to handle if coming from the all claims screen on the "addNote" button { var proID = Session["CarrierInvoiceID"]; //only thing that changed using (ExpenseTypeManager repository = new ExpenseTypeManager()) { expenseTypes = repository.GetAll2(Convert.ToInt32(proID)).ToList(); //was clientID } Core.CollectionManager.FillCollection(ddlExpenseType, "ExpenseTypeID", "ExpenseName", expenseTypes); Session["ExpenseCount"] = ddlExpenseType.Items.Count; } else { var proID = Session["InvoiceProfileID"]; using (ExpenseTypeManager repository = new ExpenseTypeManager()) { expenseTypes = repository.GetAll2(Convert.ToInt32(proID)).ToList(); //was clientID } Core.CollectionManager.FillCollection(ddlExpenseType, "ExpenseTypeID", "ExpenseName", expenseTypes); Session["ExpenseCount"] = ddlExpenseType.Items.Count; } }
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); }
protected void btnAddExpense_save_Click(object sender, EventArgs e) { CarrierInvoiceProfileFeeItemized item = null; ExpenseType expense = null; //NEW to account for rate pointing to correct place Page.Validate("expense"); if (!Page.IsValid) return; int profileID = Convert.ToInt32(ViewState["profileID"]); int id = Convert.ToInt32(ViewState["ID"]); if (id == 0) { item = new CarrierInvoiceProfileFeeItemized(); item.CarrierInvoiceProfileID = profileID; item.IsActive = true; } else { item = CarrierInvoiceProfileFeeItemizedManager.Get(id); } if (item != null) { item.ExpenseTypeID = Convert.ToInt32(ddlExpenses.SelectedValue); item.ItemDescription = txtExpenseDescription.Text; item.ItemPercentage = txtExpensePercentage.ValueDecimal; item.ItemRate = txtExpenseRate.ValueDecimal; item.AdjusterPayroll = txtExpPayroll.Text == null ? 0 : txtExpPayroll.ValueDecimal; item.AdjusterPayrollFlatFee = txtExpPayrollFee.Text == null ? 0 : txtExpPayrollFee.ValueDecimal; if (ddlConditionalOperator.SelectedIndex > 0) { item.LogicalOperator = Convert.ToInt32(ddlConditionalOperator.SelectedValue); item.LogicalOperatorOperand = txtOperand.ValueDecimal; } else { item.LogicalOperator = null; item.LogicalOperatorOperand = 0; } try { CarrierInvoiceProfileFeeItemizedManager.Save(item); } catch (Exception ex) { Core.EmailHelper.emailError(ex); } //new OC to save the expense rate into the expense type table 10/8/14 try { using (ExpenseTypeManager repository = new ExpenseTypeManager()) { int expenseID = Convert.ToInt32(ddlExpenses.SelectedValue); if (expenseID == 0) { expense = new ExpenseType(); expense.ClientID = Core.SessionHelper.getClientId(); expense.IsActive = true; } else { expense = repository.Get(expenseID); } if (expense != null) { expense.ExpenseRate = txtExpenseRate.ValueDecimal; //txtRateAmount.ValueDecimal; expense = repository.Save(expense); } } } catch (Exception ex) { Core.EmailHelper.emailError(ex); } pnlAddExpense.Visible = false; pnlGrid.Visible = true; bindItems(profileID); } }
private void bindData() { List<ExpenseType> expenseTypes = null; using (ExpenseTypeManager repository = new ExpenseTypeManager()) { expenseTypes = repository.GetAll(clientID).ToList(); } gvExpenseType.DataSource = expenseTypes; gvExpenseType.DataBind(); }