private void CheckExceedage() { this.IconWarningExceedage.Visible = false; this.LabelWarningExceedage.Visible = false; if (this.RadioPreattested.Checked && this.DropPreattested.SelectedIndex != 0) { // Compare the preattested amount with the claimed amount. If claimed > attested, show warning that re-attestation is needed. try { decimal claimedAmount = Decimal.Parse(this.TextAmount.Text, NumberStyles.Float, new CultureInfo("sv-SE")); decimal attestedAmount = ExpenseClaim.FromIdentity(Int32.Parse(this.DropPreattested.SelectedValue)).Amount; bool warningVisible = (claimedAmount > attestedAmount); this.LabelWarningExceedage.Visible = warningVisible; this.IconWarningExceedage.Visible = warningVisible; } catch (Exception) { // Ignore exceptions, which will come from a non-selection of preattested claim or an invalid number } } }
protected void ButtonValidate_Click(object sender, EventArgs e) { List <string> identityStrings = new List <string>(); foreach (string indexString in this.GridExpenseClaims.SelectedIndexes) { int index = Int32.Parse(indexString); int claimId = (int)this.GridExpenseClaims.MasterTableView.DataKeyValues[index]["Identity"]; ExpenseClaim claim = ExpenseClaim.FromIdentity(claimId); // Mark as validated if (_authority.HasPermission(Permission.CanDoEconomyTransactions, Organization.PPSEid, -1, Authorization.Flag.ExactOrganization)) { claim.Validate(_currentUser); Activizr.Logic.Support.PWEvents.CreateEvent( EventSource.PirateWeb, EventType.ExpenseValidated, _currentUser.Identity, claim.OrganizationId, 0, claim.ClaimingPersonId, claimId, string.Empty); } } // TODO: Create event, so that expenser is informed. Use 'identityStrings'. this.GridExpenseClaims.Rebind(); }
protected void ButtonInvoice_Click(object sender, EventArgs e) { if (_authority.HasPermission(Permission.CanPayOutMoney, Organization.PPSEid, -1, Authorization.Flag.ExactOrganization)) { foreach (string indexString in this.GridDebts.SelectedIndexes) { // Creating the invoice closes the expense claims. int index = Int32.Parse(indexString); string protoIdentity = (string)this.GridDebts.MasterTableView.DataKeyValues[index]["ProtoIdentity"]; string[] identityStrings = protoIdentity.Split(','); ExpenseClaim template = ExpenseClaim.FromIdentity(Int32.Parse(identityStrings[0])); CultureInfo oldCulture = CultureInfo.CurrentUICulture; Thread.CurrentThread.CurrentUICulture = new CultureInfo(Organization.PPSE.DefaultCountry.Culture); OutboundInvoice invoice = OutboundInvoice.Create(Organization.PPSE, _currentUser, DateTime.Today.AddDays(30), Organization.PPSE.FinancialAccounts.DebtsExpenseClaims, template.Claimer.Name, template.Claimer.Email, template.Claimer.Street + "\r\n" + template.Claimer.PostalCodeAndCity, Organization.PPSE.DefaultCountry.Currency, true, GetLocalResourceObject("InvoiceLiterals.ReclaimedCashAdvance").ToString()); Thread.CurrentThread.CurrentUICulture = oldCulture; foreach (string idString in identityStrings) { int claimId = Int32.Parse(idString); ExpenseClaim claim = ExpenseClaim.FromIdentity(claimId); invoice.AddItem("Exp #" + claim.Identity.ToString() + ": " + claim.Description, -claim.AmountCents); claim.Repaid = true; claim.Open = false; } // Create transaction FinancialTransaction transaction = FinancialTransaction.Create(Organization.PPSEid, DateTime.Now, "Outbound Invoice #" + invoice.Identity + ": " + template.ClaimerCanonical); transaction.AddRow(Organization.PPSE.FinancialAccounts.DebtsExpenseClaims, -invoice.AmountCents, _currentUser); transaction.AddRow(Organization.PPSE.FinancialAccounts.AssetsOutboundInvoices, invoice.AmountCents, _currentUser); transaction.Dependency = invoice; // Create event Activizr.Logic.Support.PWEvents.CreateEvent(EventSource.PirateWeb, EventType.OutboundInvoiceCreated, _currentUser.Identity, 1, 1, 0, invoice.Identity, protoIdentity); } PopulateGrid(); this.GridDebts.Rebind(); } }
static private Int64 GetSumCentsTotal(string prototypeId) { string[] payoutComponents = prototypeId.Split('|'); Int64 amountCentsTotal = 0; foreach (string payoutComponent in payoutComponents) { switch (payoutComponent[0]) { case 'C': amountCentsTotal += ExpenseClaim.FromIdentity(Int32.Parse(payoutComponent.Substring(1))).AmountCents; break; case 'A': // Advance pay-OUT amountCentsTotal += CashAdvance.FromIdentity(Int32.Parse(payoutComponent.Substring(1))).AmountCents; break; case 'a': // Advance pay-BACK amountCentsTotal -= CashAdvance.FromIdentity(Int32.Parse(payoutComponent.Substring(1))).AmountCents; break; default: throw new NotImplementedException(); } } return(amountCentsTotal); }
public TaskExpenseClaim(ExpenseClaim claim) : base( claim.Identity, "Expense Claim #" + claim.Identity, claim.CreatedDateTime, claim.CreatedDateTime.AddDays(14)) { // empty ctor }
private async void LoadDesignData() { var service = Acumatica.Core.Ioc.Container.Default.GetInstance <IExpenseClaimService>(); _model = await service.GetExpenseClaim("12345"); OnPropertyChanged("Model"); }
private static int SortGridItems(ExpenseClaim claim1, ExpenseClaim claim2) { if (claim1.CreatedDateTime == claim2.CreatedDateTime) { return(0); } return(claim2.CreatedDateTime > claim1.CreatedDateTime? 1: -1); }
private static string GetObjectDetails(IHasIdentity identifiableObject) { switch (identifiableObject.GetType().Name) { case "ExpenseClaim": ExpenseClaim claim = (ExpenseClaim)identifiableObject; return("<strong>" + String.Format(Global.Financial_ExpenseClaimLongSpecification, claim.Identity) + ":</strong> " + claim.Organization.Currency.Code + " " + (claim.AmountCents / 100.0).ToString("N2") + ". " + HttpUtility.HtmlEncode(GetValidationDetails(claim.Validations)) + " " + GetDocumentDetails(claim.Documents, claim)); case "CashAdvance": CashAdvance advance = (CashAdvance)identifiableObject; return("<strong>" + String.Format(Global.Financial_CashAdvanceSpecification, advance.Identity) + ":</strong> " + advance.Organization.Currency.Code + " " + (advance.AmountCents / 100.0).ToString("N2") + ". " + HttpUtility.HtmlEncode(GetValidationDetails(advance.Validations))); case "InboundInvoice": InboundInvoice invoice = (InboundInvoice)identifiableObject; return("<strong>" + String.Format(Global.Financial_InboundInvoiceSpecification, invoice.Identity) + ":</strong> " + invoice.Organization.Currency.Code + " " + (invoice.AmountCents / 100.0).ToString("N2") + ". " + GetValidationDetails(invoice.Validations) + " " + GetDocumentDetails(invoice.Documents, invoice)); case "Salary": Salary salary = (Salary)identifiableObject; return("<strong>" + String.Format(Global.Financial_SalaryIdentity, salary.Identity) + ":</strong> " + String.Format(Resources.Pages.Ledgers.InspectLedgers_TxDetail_SalaryDetail, salary.PayrollItem.Organization.Currency.Code, salary.BaseSalaryCents / 100.0, // base salary (salary.GrossSalaryCents - salary.BaseSalaryCents) / 100.0, // before-tax adjustments salary.GrossSalaryCents / 100.0, // before-tax adjusted salary salary.SubtractiveTaxCents / 100.0, // tax deduction (salary.NetSalaryCents + salary.SubtractiveTaxCents - salary.GrossSalaryCents) / 100.0, // after-tax adjustments salary.NetSalaryCents / 100.0) + // actual payout amount " " + GetValidationDetails(salary.Validations)); default: throw new NotImplementedException("Unhandled object type in GetObjectDetails: " + identifiableObject.GetType().Name); } }
private void AddExpenseToDebug(ExpenseClaim claim) { int accountId = Organization.PPSE.FinancialAccounts.DebtsExpenseClaims.Identity; if (!claim.Claimed) { accountId = Organization.PPSE.FinancialAccounts.CostsAllocatedFunds.Identity; } debugLookup[accountId].Expenses -= claim.Amount; }
public static AjaxCallResult ExpensifyRecordsetCommit(string masterGuid) { AuthenticationData authData = GetAuthenticationDataAndCulture(); // Commit all expenses in the recordset try { List <ExpensifyRecord> recordList = (List <ExpensifyRecord>)GuidCache.Get("ExpensifyData-" + masterGuid); string expensifyRaw = (string)GuidCache.Get("ExpensifyRaw-" + masterGuid); ExpenseClaimGroup expenseClaimGroup = ExpenseClaimGroup.Create(authData.CurrentOrganization, authData.CurrentUser, ExpenseClaimGroupType.Expensify, expensifyRaw); foreach (ExpensifyRecord record in recordList) { FinancialAccount budget = FinancialAccount.FromIdentity(record.BudgetId); ExpenseClaim claim = ExpenseClaim.Create(authData.CurrentUser, authData.CurrentOrganization, budget, record.Timestamp, record.CategoryCustom + " / " + record.Description, record.AmountCents, record.VatCents, expenseClaimGroup); record.Documents.SetForeignObjectForAll(claim); // TODO: Log } if (recordList.Count > 1) { return(new AjaxCallResult { Success = true, DisplayMessage = String.Format(Resources.Pages.Financial.FileExpenseClaim_Expensify_SuccessSeveral, recordList.Count) }); } return(new AjaxCallResult { Success = true, DisplayMessage = Resources.Pages.Financial.FileExpenseClaim_Expensify_SuccessOne }); } catch (Exception exc) { return(new AjaxCallResult { Success = false, DisplayMessage = exc.ToString() }); } }
public ExpenseClaim Post([FromBody] ExpenseClaim claim) { // add new claim and return id var claimDate = DateTime.Parse(claim.ClaimDate); return(new ExpenseClaim { Description = claim.Description, Company = claim.Company, Id = new Random().Next(10), ClaimDate = claim.ClaimDate }); }
public ExpenseClaim CreateExpenseClaimFrom(ExpenseClaimInput expenseInput) { var expenseClaimDate = _validator.Validate(expenseInput.Date); _logger.LogInformation("Date has been successfully validated"); var expenseClaim = new ExpenseClaim(expenseInput.CostCentre, expenseInput.Total, expenseInput.PaymentMethod) { Vendor = expenseInput.Vendor, Date = expenseClaimDate, Description = expenseInput.Description }; _logger.LogInformation("Expense Claim successfully created."); return(expenseClaim); }
public async override void LoadState(object navigationParameter, Dictionary <String, Object> viewData) { Exception error = null; try { Loading = true; PageTitle = string.Format("Expense Claim {0}", (string)navigationParameter); if (viewData != null && viewData.ContainsKey("CurrentExpenseClaim")) { _model = (ExpenseClaim)viewData["CurrentExpenseClaim"]; _model.TrackChanges(); var cache = Acumatica.Core.Ioc.Container.Default.GetInstance <IExpenseClaimLineCache>(); if (cache.CurrentLine != null) { if (cache.CurrentLine.HasUnsavedChanges) { this.Model.HasUnsavedChanges = true; } MergeLineFromCache(cache.CurrentLine); cache.CurrentLine = null; } } else { var service = Acumatica.Core.Ioc.Container.Default.GetInstance <IExpenseClaimService>(); _model = await service.GetExpenseClaim(navigationParameter as string); } OnPropertyChanged("Model"); OnPropertyChanged("LinesTotal"); } catch (Exception e) { error = e; } finally { Loading = false; } if (error != null) { await Acumatica.Core.Ioc.Container.Default.GetInstance <IExceptionHandlerService>().HandleExceptionAsync(error); Acumatica.Core.Ioc.Container.Default.GetInstance <Acumatica.Core.Service.INavigationService>().GoBack(); } }
public static OutstandingAccount FromExpenseClaim(ExpenseClaim claim, DateTime dateTimeExpectedClosed) { OutstandingAccount result = new OutstandingAccount { AmountCents = claim.AmountCents, Description = claim.Description, Identity = claim.Identity, Recipient = claim.ClaimerCanonical, CreatedDateTime = claim.CreatedDateTime, ExpectedClosed = dateTimeExpectedClosed }; return(result); }
public async Task <ExpenseClaimResponseDto> Handle(CreateExpenseClaimCommand request, CancellationToken cancellationToken) { var expenseClaim = new ExpenseClaim(); PropertyInfo[] properties = typeof(ExpenseClaim).GetProperties(); foreach (PropertyInfo property in properties) { if (property.CustomAttributes.Count() > 0) { var xmlTag = property.CustomAttributes.First().ConstructorArguments.First().Value.ToString(); property.SetValue(expenseClaim, _xmlProcessor.GetTagContent(xmlTag, request.Message)); } } return(_mapper.Map <ExpenseClaimResponseDto>(expenseClaim)); }
protected void GridExpenses_RowCommand(object sender, GridViewCommandEventArgs e) { switch (e.CommandName) { case "Approve": int currentUserId = Convert.ToInt32(HttpContext.Current.User.Identity.Name); int index = Convert.ToInt32(e.CommandArgument); int expenseId = Convert.ToInt32(this.GridExpenses.DataKeys[index].Value); ExpenseClaim expenseClaim = ExpenseClaim.FromIdentity(expenseId); expenseClaim.CreateEvent(ExpenseEventType.Approved, currentUserId); Activizr.Logic.Support.PWEvents.CreateEvent(EventSource.PirateWeb, EventType.ExpenseChanged, currentUserId, expenseClaim.OrganizationId, expenseClaim.GeographyId, expenseClaim.ClaimingPersonId, expenseClaim.Identity, ExpenseEventType.Approved.ToString()); Repopulate(); break; } }
private string ProcessExpenseClaim() { int year = DateTime.Today.Year; FinancialAccount account = FinancialAccount.FromIdentity(Int32.Parse(this.DropBudgets.SelectedValue)); string expenseName = this.TextDescription.Text; Person claimer = this.ComboClaimPerson.SelectedPerson; Int64 amountCents = (Int64)(Double.Parse(this.TextAmount.Text, NumberStyles.Float, new CultureInfo("sv-SE")) * 100); // Create the expense claim record ExpenseClaim newClaim = ExpenseClaim.Create(claimer, Organization.PPSE, account, DateTime.Today, expenseName, amountCents); newClaim.Claimed = false; newClaim.Attest(_currentUser); return("The claim was created and pre-attested. " + claimer.Canonical + " has it in the list of approved expenses."); }
private void AddExpenseClaimToGroup(string groupTitle, ExpenseClaim claim) { // Check if group exists, if so add item to it foreach (var group in _groups) { if (group.GroupTitle == groupTitle) { group.Items.Insert(0, claim); return; } } // Group does not exist, create it. var newGroup = new ExpenseClaimGroup(groupTitle); newGroup.Items.Add(claim); _groups.Add(newGroup); }
public ProcessResult <TData> Parse <TData>(string inputData) where TData : class { ProcessResult <TData> processResult = new ProcessResult <TData>() { Success = false, CheckResult = DataCheckResult.Undefined }; //Getting xml content from input data string regExpPatternTemplate = @"<{0}>[\s\S]*?<\/{0}>"; string[] xmlTagNames = new string[] { "expense", "vendor", "description", "date" }; StringBuilder sbXml = new StringBuilder(); foreach (string tagName in xmlTagNames) { MatchCollection matches = Regex.Matches(inputData, string.Format(regExpPatternTemplate, tagName)); foreach (Match match in matches) { sbXml.Append(match.Value); } } //Deserializing xml content into ExpenseClaim object string xml = string.Format("<{0}>{1}</{0}>", "ExpenseClaim", sbXml.ToString()); ExpenseClaim expenseClaim = xml.XmlDeserializeFromString <ExpenseClaim>(); processResult.Data = (TData)Convert.ChangeType(expenseClaim, typeof(TData)); if (expenseClaim.Expense.Total == 0) { processResult.CheckResult = DataCheckResult.MandatoryDataAreMissing; return(processResult); } expenseClaim.Expense.CostCentre = expenseClaim.Expense.CostCentre ?? "UNKNOWN"; processResult.Success = true; processResult.CheckResult = DataCheckResult.DataAreWellFormed; return(processResult); }
private void AddExpenseClaimEvent(int parentId, ExpenseClaim claim) { int newId = transactionEvents.Count + 1; transactionEvents.Add(new TransactionEvent(newId, parentId, "Expense Claim #" + claim.Identity.ToString())); transactionEvents.Add( new TransactionEvent(newId + 1, newId, "Description: " + claim.Description)); transactionEvents.Add( new TransactionEvent(newId + 2, newId, "Claimed by " + claim.Claimer.Canonical + " at " + claim.CreatedDateTime.ToString("yyyy-MM-dd HH:mm"))); AddValidations(newId, claim); foreach (Document document in claim.Documents) { AddDocumentEvent(newId, document); } }
static protected IPayable PayableFromRecordId(string recordId) { char recordType = recordId[0]; int itemId = Int32.Parse(recordId.Substring(1)); switch (recordType) { case 'E': // Expense claim return(ExpenseClaim.FromIdentity(itemId)); case 'A': // Cash advance return(CashAdvance.FromIdentity(itemId)); case 'I': // Inbound invoice return(InboundInvoice.FromIdentity(itemId)); default: throw new NotImplementedException("Unknown record type"); } }
protected void GridPayouts_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { ExpenseClaim claim = (ExpenseClaim)e.Item.DataItem; if (claim == null) { return; } /* * Label labelDueDate = (Label)e.Item.FindControl("LabelDueDate"); * if (payout.ExpectedTransactionDate < DateTime.Now) * { * labelDueDate.Text = "ASAP"; * } * else * { * labelDueDate.Text = payout.ExpectedTransactionDate.ToString("yyyy-MM-dd"); * }*/ /* * Controls_v4_DocumentList docList = (Controls_v4_DocumentList) e.Item.FindControl("DocumentListClaim"); * * if (docList != null) * { * docList.Documents = Documents.ForObject(claim); * }*/ Label labelDebt = (Label)e.Item.FindControl("LabelDebt"); labelDebt.Text = (-claim.Amount).ToString("N2"); /*editLink.Attributes["href"] = "InvoiceAdvanceDebtsPartial.aspx?PersonId=" + debt.Person.Identity;*/ /*editLink.Attributes["onclick"] = String.Format("return ShowExpenseClaimForm('{0}','{1}');", * claim.Identity, e.Item.ItemIndex);*/ } }
public void GivenAnExpenseClaimInputThenCreateAnExpenseClaim() { _validator.Setup(x => x.Validate(It.IsAny <string>())) .Returns(new DateTime(2019, 01, 15)); var expectedExpenseClaim = new ExpenseClaim("DEV002", 104.23m, "personal card") { Vendor = "Subway", Description = "Lunch Meeting", Date = new DateTime(2019, 01, 15) }; var expenseInput = new ExpenseClaimInput { CostCentre = "DEV002", Total = 104.23m, PaymentMethod = "personal card", Vendor = "Subway", Description = "Lunch Meeting", Date = "Tuesday 15 January 2019" }; var expenseClaim = _expenseClaimFactory.CreateExpenseClaimFrom(expenseInput); expenseClaim.Should().BeEquivalentTo(expectedExpenseClaim); }
public void GivenAnExpenseClaimEmailWhenProcessingThenReturnTheCompleteClaim() { var expenseClaim = new ExpenseClaim("DEV002", 1024.01m, "personal card") { Date = new DateTime(2017, 04, 27), Description = "development team’s project end celebration dinner", Vendor = "Viaduct Steakhouse" }; _expenseClaimFactory.Setup(x => x.CreateExpenseClaimFrom(It.IsAny <ExpenseClaimInput>())) .Returns(expenseClaim); var expectedExpenseClaimResult = new ExpenseClaimResult { CostCentre = "DEV002", TotalIncludingGst = 1024.01m, TotalExcludingGst = 870.41m, GstAmount = 153.60m, PaymentMethod = "personal card", Description = "development team’s project end celebration dinner", Vendor = "Viaduct Steakhouse", Date = new DateTime(2017, 04, 27) }; var email = @"Hi Yvaine, Please create an expense claim for the below. Relevant details are marked up as requested… <expense><cost_centre>DEV002</cost_centre> <total>1024.01</total><payment_method>personal card</payment_method> </expense> From: Ivan Castle Sent: Friday, 16 February 2018 10:32 AM To: Antoine Lloyd <*****@*****.**> Subject: test Hi Antoine, Please create a reservation at the <vendor>Viaduct Steakhouse</vendor> our <description>development team’s project end celebration dinner</description> on <date>Thursday 27 April 2017</date>. We expect to arrive around 7.15pm. Approximately 12 people but I’ll confirm exact numbers closer to the day. Regards, Ivan"; var expenseClaimResult = _expenseService.Process(email); expenseClaimResult.Should().BeEquivalentTo(expectedExpenseClaimResult); }
protected void Page_Load(object sender, EventArgs e) { _expenseClaim = ExpenseClaim.FromIdentity(Int32.Parse(Request.QueryString["ExpenseClaimId"])); // TODO: Verify authority (economy assistant or claimer) if (!Page.IsPostBack) { this.LabelClaimer.Text = _expenseClaim.ClaimerCanonical; this.LabelClaimDate.Text = _expenseClaim.CreatedDateTime.ToString("yyyy-MM-dd HH:mm"); this.TextDescription.Text = _expenseClaim.Description; this.LabelAttested.Text = _expenseClaim.Attested? "Yes." : "No."; this.LabelValidated.Text = _expenseClaim.Validated? "Yes." : "No."; if (_expenseClaim.AmountCents < 0) { // If the expense amount is negative, include income accounts (donations, etc) this.DropAccounts.Populate(_expenseClaim.Organization, FinancialAccountType.Result); } else { this.DropAccounts.Populate(_expenseClaim.Organization, FinancialAccountType.Cost); } if (_expenseClaim.BudgetId != 0) { this.DropAccounts.SelectedFinancialAccount = _expenseClaim.Budget; } this.DateExpense.SelectedDate = _expenseClaim.ExpenseDate; this.TextAmount.Text = _expenseClaim.Amount.ToString("N2", new CultureInfo("sv-SE")); this.TextDescription.Style[HtmlTextWriterStyle.Width] = "250px"; } // The DocumentList control does not hold state - yet - so must be initialized always this.DocumentList.Documents = Documents.ForObject(_expenseClaim); }
private void ProcessPreattestChange() { bool selectedPreattested = this.RadioPreattested.Checked; if (this.DropPreattested.SelectedIndex == 0) { selectedPreattested = false; } else { ExpenseClaim claim = ExpenseClaim.FromIdentity(Int32.Parse(this.DropPreattested.SelectedValue)); this.LabelPreattestedBudget.Text = claim.Budget.Name; this.LabelDescription.Text = claim.Description; this.TextDescription.Text = claim.Description; } this.DropBudgets.Visible = !selectedPreattested; this.LabelBudgetOwner.Visible = selectedPreattested; this.TextDescription.Visible = !selectedPreattested; this.LabelDescription.Visible = selectedPreattested; this.LabelPreattestedBudget.Visible = selectedPreattested; }
protected void GridExpenseClaims_ItemCreated(object sender, GridItemEventArgs e) { // Set the images for the status indicators. string imageUrlTodo = "~/Images/Public/Fugue/icons-shadowless/minus-small.png"; string imageUrlTick = "~/Images/Public/Fugue/icons-shadowless/tick.png"; string imageUrlFail = "~/Images/Public/Fugue/icons-shadowless/cross-circle-frame.png"; string imageUrlWarn = "~/Images/Public/Fugue/icons-shadowless/exclamation-frame.png"; if (e.Item is GridDataItem) { ExpenseClaim claim = (ExpenseClaim)e.Item.DataItem; if (claim == null) { return; } Image imageClaimed = (Image)e.Item.FindControl("ImageClaimed"); Image imageAttested = (Image)e.Item.FindControl("ImageAttested"); Image imageValidated = (Image)e.Item.FindControl("ImageValidated"); Image imageRepaid = (Image)e.Item.FindControl("ImageRepaid"); imageClaimed.ImageUrl = claim.Claimed ? imageUrlTick : imageUrlTodo; imageAttested.ImageUrl = claim.Attested ? imageUrlTick : imageUrlTodo; imageValidated.ImageUrl = claim.Validated ? imageUrlTick : imageUrlTodo; if (claim.Open == false && claim.Repaid == false) { imageRepaid.ImageUrl = imageUrlFail; } else { imageRepaid.ImageUrl = claim.Repaid ? imageUrlTick : imageUrlTodo; } } }
protected void GridExpenseClaims_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { ExpenseClaim claim = (ExpenseClaim)e.Item.DataItem; if (claim == null) { return; } Controls_v4_DocumentList docList = (Controls_v4_DocumentList)e.Item.FindControl("DocumentListClaim"); if (docList != null) { docList.Documents = Documents.ForObject(claim); } HyperLink editLink = (HyperLink)e.Item.FindControl("LinkEdit"); editLink.Attributes["href"] = "#"; editLink.Attributes["onclick"] = String.Format("return ShowExpenseClaimForm('{0}','{1}');", claim.Identity, e.Item.ItemIndex); } }
public Task <ExpenseClaim> GetExpenseClaim(string refNbr) { return(Task.Factory.StartNew <ExpenseClaim>(() => { var claim = new ExpenseClaim("Sample Expense Claim", "MICG", refNbr, 334.56M, DateTime.Today, "Hold"); claim.Hold = true; claim.Location = "MAIN"; claim.NoteText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris lectus est, pellentesque quis luctus sit amet, hendrerit sed nunc"; claim.AllowEdit = true; var line = new ExpenseClaimLine(); line.ParentRefNbr = refNbr; line.AllowEdit = true; line.Date = DateTime.Today.AddDays(-5); line.RefNbr = "1234"; line.ExpenseId = "DEP"; line.Quantity = 3; line.UnitCost = 100; line.Total = 300; line.EmployeePart = 10; line.Description = "Line 1 Description"; claim.Lines.Add(line); var line2 = new ExpenseClaimLine(); line2.ParentRefNbr = refNbr; line2.AllowEdit = true; line2.Date = DateTime.Today.AddDays(-3); line2.RefNbr = "4567"; line2.ExpenseId = "FUEL"; line2.Total = 34.56M; line2.Description = "Line 2 Description"; claim.Lines.Add(line2); return claim; })); }
public ExpenseClaim Update(ExpenseClaim item) { return(ExpenseClaims.Update(item)); }
private static int SortGridItems (ExpenseClaim claim1, ExpenseClaim claim2) { return DateTime.Compare(claim2.CreatedDateTime, claim1.CreatedDateTime); }