private void BindCost() { int costId = Request.QueryString["CostId"].ToInt(); if (costId > 0) { Cost costLookup = CostDAL.GetItem(costId); if (costLookup != null) { lblCostId.Text = costLookup.CostId.ToString(); lblGameId.Text = costLookup.GameId.ToString(); lblCostAmount.Text = costLookup.CostAmount.ToString(); } else { lblMessage.Text = "Cost could not be found."; } } else { lblMessage.Text = "Invalid ID. Cost record could not be found."; } }
private void BindCostList() { CostCollection costList = new CostCollection(); costList = CostDAL.GetCollection(); rptCostList.DataSource = costList; rptCostList.DataBind(); }
public static Cost CreateCost(int groupId, int costTypeId, string price, string note) { ValidateCost(price, note); var priceValue = int.Parse(price); var cost = new Cost { GroupId = groupId, CostTypeId = costTypeId, Price = priceValue, Note = note, }; CostDAL.Add(cost); return(cost); }
public static IList <Cost> ListCosts(int groupId, string type = null, string value = null) { bool isNumeric = int.TryParse(value, out int valueInt); bool isDateTime = DateTime.TryParse(value, out DateTime valueDateTime); return(CostDAL.Get( c => c.GroupId == groupId && ( type == null || ( (type == "Id" && isNumeric && c.Id == valueInt) || (type == "CostType" && c.CostType.Name.Contains(value.Trim())) || (type == "Price" && isNumeric && c.Price == valueInt) || (type == "Note" && c.Note.Contains(value.Trim())) ) ), null, new List <Expression <Func <Cost, object> > > { c => c.CostType, c => c.Group } ).ToList()); }
public static List <CostStatistic> GetCostStatisticsByTourId(int tourId, DateTime?startDate, DateTime?endDate) { return(CostDAL.GetCostStatisticsByTourId(tourId, startDate, endDate)); }
public static void RemoveCost(int id) { var cost = CostDAL.GetById(id); CostDAL.Remove(cost); }