protected void btnClubSearch_Click(object sender, EventArgs e) { string searchValue = txtClubFilter.Text; Clubs club = new Clubs(); List<Clubs> tblClubs = null; if (ClubSearchType.SelectedValue == "c") searchValue = string.Format("%{0}", searchValue); switch (ClubFilterBy.SelectedValue) { case "Club_Long_Name": tblClubs = club.GetClubsLikeClub_Long_Name(searchValue); break; case "Club_Short_Name": tblClubs = club.GetClubsLikeClub_Short_Name(searchValue); break; default: tblClubs = club.GetClubs(); break; } ClubGridView.DataSource = tblClubs; ClubGridView.DataBind(); txtClubFilter.Text = string.Empty; ClubFilterBy.SelectedIndex = -1; ClubSearchType.SelectedIndex = -1; }
public void willGetACardWithValidParameters() { var validString = "2-C"; var ExpectedCard = new Clubs(2); var ActualCard = CardBuilder.fromString(validString); Assert.AreEqual(ExpectedCard, ActualCard); }
public void willGetACardWithAce() { var validString = "A-C"; var ExpectedCard = new Clubs(Card.ACE); var ActualCard = CardBuilder.fromString(validString); Assert.AreEqual(ExpectedCard, ActualCard); }
protected void btnAddClub_Click(object sender, EventArgs e) { if (ValidateClub()) { MembershipUser userInfo = Membership.GetUser(); Guid user_ID = (Guid)userInfo.ProviderUserKey; Club_Contact_ID = Common.Club_Contact_ID; if (!string.IsNullOrEmpty(Club_Contact_ID)) { Guid person_ID = new Guid(Club_Contact_ID); Clubs club = new Clubs(); club.Club_Long_Name = txtClubLongName.Text; club.Club_Short_Name = txtClubShortName.Text; club.Club_Contact = person_ID; Guid? club_ID = club.Insert_Club(user_ID); if (club_ID != null) { Club_ID = club_ID.ToString(); Common.Club_ID = Club_ID; PopulateClub(); MessageLabel.Text = string.Format("{0} was added successfully", club.Club_Long_Name); divGetPerson.Visible = false; divPersonDetails.Visible = true; divAddClub.Visible = false; divUpdateClub.Visible = true; divNewClub.Visible = true; if (!string.IsNullOrEmpty(btnReturn.PostBackUrl)) DivReturn.Visible = true; } } PopulateClubGridView(); Common.Club_Contact_ID = null; } }
/// ---------- ---------- ---------- ---------- ---------- ---------- /// <name>LoadClubData</name> /// <date>31/01/15</date> /// <summary> /// Loads the club list from the data file and returns it. /// </summary> /// <param name="fileName">file name</param> /// ---------- ---------- ---------- ---------- ---------- ---------- public Clubs LoadClubData(string fileName) { Clubs clubList = new Clubs(); if (!File.Exists(fileName)) { string error = string.Format("Club data file missing, one created - {0}", fileName); Messenger.Default.Send( new HandicapErrorMessage( error)); this.logger.WriteLog(error); this.SaveClubData(fileName, new Clubs()); } try { XDocument reader = XDocument.Load(fileName); XElement rootElement = reader.Root; var myClubList = from Club in rootElement.Elements(c_clubLabel) select new { club = (string)Club.Value }; foreach (var club in myClubList) { clubList.AddNewClub(club.club); } } catch (Exception ex) { this.logger.WriteLog("Error reading club data " + ex.ToString()); } return(clubList); }
public ActionResult Clubpage(int?id) { var userId = User.Identity.GetUserId(); Clubs clubs = context.Clubs.Find(id); if (id == null) { return(RedirectToAction("Index")); } if (clubs == null) { return(HttpNotFound()); } if (clubs.Admin == userId) { return(RedirectToAction("MyClub", new { id = id })); } ViewBag.Posts = context.Posts.ToList().OrderByDescending(s => s.Date); ViewBag.Books = context.Books.ToList(); ViewBag.Users = context.Users.ToList(); ViewBag.Chats = context.Chat.ToList(); return(View(clubs)); }
private bool HasChanges() { bool Changed = false; Guid club_ID = new Guid(Club_ID); Guid person_ID = new Guid(Club_Contact_ID); Clubs club = new Clubs(_connString, club_ID); if (club.Club_Long_Name != txtClubLongName.Text) { Changed = true; } if (club.Club_Short_Name != txtClubShortName.Text) { Changed = true; } if (club.Club_Contact != person_ID) { Changed = true; } return(Changed); }
private static bool clubInDatabase(string eventID) { bool found = false; club = eventID.Substring(11, 3); string ClubsConnect = ConfigurationManager.ConnectionStrings["ClubsConnect"].ToString(); MISGACLUBS cdb = new MISGACLUBS(ClubsConnect); Clubs item = cdb.Clubs.SingleOrDefault(c => c.ClubID.Trim() == club); if (item != null) { found = true; string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB mdb = new MRMISGADB(MRMISGADBConn); Events mixer = mdb.Events.FirstOrDefault(ev => ev.EventID == eventID); if (mixer.Type.ToUpper().Trim() == "HOME") { _lines = fillHomeDescription(item, mixer); } if (mixer.Type.ToUpper().Trim() == "AWAY") { _lines = fillAwayDescription(item, mixer); } // found club in database } else { found = false; _badID[13] = "Club " + club + " NOT found in Clubs database"; _message[1] = "Club " + club + " NOT found in Clubs database"; _lines = _message; // club not in database } return(found); }
private void ListView_SportInSportsSelection(object sender, SelectionChangedEventArgs e) { var item = (sender as ListView).SelectedItem as Sport; if (item != null) { Sports.Remove(item); MemberSports.Add(item); Clubs.Clear(); foreach (Sport s in MemberSports) { foreach (Club c in s.Clubs) { Clubs.Add(c); } } foreach (Club club in MemberClubs) { var filteredClub = Clubs.FirstOrDefault(c => c.Id == club.Id); Clubs.Remove(filteredClub); } } }
// GET: Clubs/Delete/5 public ActionResult Delete(int id) { Clubs clubRemove = _db.Clubs.Find(id); return(View(clubRemove)); }
private void PopulateClub() { Guid club_ID = new Guid(Club_ID); Clubs club = new Clubs(club_ID); txtClubLongName.Text = club.Club_Long_Name; txtClubShortName.Text = club.Club_Short_Name; PopulateClubContact(club.Club_Contact.ToString()); }
private bool HasChanges() { bool Changed=false; Guid club_ID = new Guid(Club_ID); Guid person_ID = new Guid(Club_Contact_ID); Clubs club = new Clubs(club_ID); if(club.Club_Long_Name != txtClubLongName.Text) Changed=true; if(club.Club_Short_Name != txtClubShortName.Text) Changed=true; if(club.Club_Contact != person_ID) Changed=true; return Changed; }
static void Main(string[] args) { Clubs c1 = new Clubs(); c1.Names = "Apator Toruń"; c1.League = "Ekstraliga"; c1.StartYear = "1962"; Players p1 = new Players("Paweł", "Przedpełski"); Players p2 = new Players("Chris", "Holder"); Players p3 = new Players("Jack", "Holder"); Players p4 = new Players("Adrian", "Miedziński"); Clubs c2 = new Clubs("Falubaz Zielona Góra", "Ekstraliga", "1961"); Players p12 = new Players("Patryk", "Dudek"); Players p22 = new Players("Piotr", "Protasiewicz"); Players p32 = new Players("Max", "Fricke"); Players p42 = new Players("Matej", "Zagar"); Clubs c3 = new Clubs("Stal Gorzów", "Ekstraliga", "1947"); Players p13 = new Players("Bartosz", "Zmarzlik"); Players p23 = new Players("Szymon", "Woźniak"); Players p33 = new Players("Martin", "Vaculik"); Players p43 = new Players("Anders", "Thomsen"); Clubs c4 = new Clubs("Wybrzeże Gdańsk", "eWinner 1 Liga", "1945"); Players p14 = new Players("Krystian", "Pieszczek"); Players p24 = new Players("Jakub", "Jamróg"); Players p34 = new Players("Michał", "Gruchalski"); Players p44 = new Players("Viktor", "Kulakov"); Clubs c5 = new Clubs("ROW Rybnik", "eWinner 1 Liga", "1932"); Players p15 = new Players("Rune", "Holta"); Players p25 = new Players("Kacper", "Gomólski"); Players p35 = new Players("Michael", "Jepsen Jensen"); Players p45 = new Players("Viktor", "Trofimov"); c1.OutputInfo(); Console.WriteLine(); p1.OutputInfo(); p2.OutputInfo(); p3.OutputInfo(); p4.OutputInfo(); Console.ReadKey(); Console.WriteLine("-----------------------------------------------"); c2.OutputInfo(); Console.WriteLine(); p12.OutputInfo(); p22.OutputInfo(); p32.OutputInfo(); p42.OutputInfo(); Console.ReadKey(); Console.WriteLine("-----------------------------------------------"); c3.OutputInfo(); Console.WriteLine(); p13.OutputInfo(); p23.OutputInfo(); p33.OutputInfo(); p43.OutputInfo(); Console.ReadKey(); Console.WriteLine("-----------------------------------------------"); c4.OutputInfo(); Console.WriteLine(); p14.OutputInfo(); p24.OutputInfo(); p34.OutputInfo(); p44.OutputInfo(); Console.ReadKey(); Console.WriteLine("-----------------------------------------------"); c5.OutputInfo(); Console.WriteLine(); p15.OutputInfo(); p25.OutputInfo(); p35.OutputInfo(); p45.OutputInfo(); Console.WriteLine("-----------------------------------------------"); Console.ReadKey(); Matches m1 = new Matches(c1.Names, c2.Names); Console.WriteLine("First match:"); m1.ResultOfTheMatch(49, 41); Console.WriteLine("Points of selected players:"); p1.PointsPlayers(13); p3.PointsPlayers(9); p22.PointsPlayers(10); p42.PointsPlayers(7); Console.ReadKey(); Console.WriteLine("-----------------------------------------------"); Matches m2 = new Matches(c1.Names, c3.Names); //Console.WriteLine("Introduce the result."); //Console.Write("First team: "); //int a = Convert.ToInt32(Console.ReadLine()); //Console.Write("Second team: "); //int b = Convert.ToInt32(Console.ReadLine()); //Console.WriteLine(); Console.WriteLine("Second match:"); m2.ResultOfTheMatch(40, 50); Console.WriteLine("Points of selected players:"); p2.PointsPlayers(8); p4.PointsPlayers(9); p13.PointsPlayers(15); p23.PointsPlayers(11); Console.ReadKey(); Console.WriteLine("-----------------------------------------------"); Console.WriteLine("Third match:"); Matches m3 = new Matches(c5.Names, c4.Names); m3.ResultOfTheMatch(52, 38); Console.WriteLine("Points of selected players:"); p15.PointsPlayers(12); p35.PointsPlayers(5); p14.PointsPlayers(11); p44.PointsPlayers(8); Console.ReadKey(); }
protected void BtnCreateSimilar_Click(object sender, EventArgs e) { //Collects current method for error tracking string method = "BtnCreateSimilar_Click"; object[] objPageDetails = { Session["currPage"].ToString(), method }; try { //Retrieves the type of item that is getting added int typeID = Convert.ToInt32(ddlType.SelectedValue); Object o = new Object(); if (typeID == 1) { Clubs club = new Clubs(); //Transfers all info into Club class string[] inventoryInfo = IDU.CallReturnMaxSku(typeID, Convert.ToInt32(ddlLocation.SelectedValue), objPageDetails); club.intInventoryID = Convert.ToInt32(inventoryInfo[1]); club.varSku = inventoryInfo[0].ToString(); club.fltCost = Convert.ToDouble(txtCost.Text); club.intBrandID = Convert.ToInt32(ddlBrand.SelectedValue); club.fltPrice = Convert.ToDouble(txtPrice.Text); club.intQuantity = Convert.ToInt32(txtQuantity.Text); club.intLocationID = Convert.ToInt32(ddlLocation.SelectedValue); club.varTypeOfClub = txtClubType.Text; club.intModelID = Convert.ToInt32(ddlModel.SelectedValue); club.varShaftType = txtShaft.Text; club.varNumberOfClubs = txtNumberofClubs.Text; club.varClubSpecification = txtClubSpec.Text; club.varShaftSpecification = txtShaftSpec.Text; club.varShaftFlexability = txtShaftFlex.Text; club.varClubDexterity = txtDexterity.Text; club.bitIsUsedProduct = chkUsed.Checked; club.varAdditionalInformation = txtComments.Text; club.intItemTypeID = typeID; //stores club as an object o = club as Object; } else if (typeID == 2) { Accessories accessory = new Accessories(); //Transfers all info into Accessory class string[] inventoryInfo = IDU.CallReturnMaxSku(typeID, Convert.ToInt32(ddlLocation.SelectedValue), objPageDetails); accessory.intInventoryID = Convert.ToInt32(inventoryInfo[1]); accessory.varSku = inventoryInfo[0].ToString(); accessory.intBrandID = Convert.ToInt32(ddlBrand.SelectedValue); accessory.fltCost = Convert.ToDouble(txtCost.Text); accessory.fltPrice = Convert.ToDouble(txtPrice.Text); accessory.intQuantity = Convert.ToInt32(txtQuantity.Text); accessory.intLocationID = Convert.ToInt32(ddlLocation.SelectedValue); accessory.intModelID = Convert.ToInt32(ddlModel.SelectedValue); accessory.intItemTypeID = typeID; accessory.varSize = txtNumberofClubs.Text; accessory.varColour = txtShaft.Text; accessory.varTypeOfAccessory = txtClubType.Text; accessory.varAdditionalInformation = txtComments.Text; //stores accessory as an object o = accessory as Object; } else if (typeID == 3) { Clothing clothing = new Clothing(); //Transfers all info into Clothing class string[] inventoryInfo = IDU.CallReturnMaxSku(typeID, Convert.ToInt32(ddlLocation.SelectedValue), objPageDetails); clothing.intInventoryID = Convert.ToInt32(inventoryInfo[1]); clothing.varSku = inventoryInfo[0].ToString(); clothing.intBrandID = Convert.ToInt32(ddlBrand.SelectedValue); clothing.fltCost = Convert.ToDouble(txtCost.Text); clothing.fltPrice = Convert.ToDouble(txtPrice.Text); clothing.intQuantity = Convert.ToInt32(txtQuantity.Text); clothing.intLocationID = Convert.ToInt32(ddlLocation.SelectedValue); clothing.intItemTypeID = typeID; clothing.varSize = txtNumberofClubs.Text; clothing.varColour = txtShaft.Text; clothing.varGender = txtClubSpec.Text; clothing.varStyle = txtClubType.Text; clothing.varAdditionalInformation = txtComments.Text; //stores clothing as an object o = clothing as Object; } var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString()); nameValues.Set("inventory", IDU.AddNewItemToDatabase(o, objPageDetails).ToString()); //Refreshes current page Response.Redirect(Request.Url.AbsolutePath + "?" + nameValues, false); } //Exception catch catch (ThreadAbortException tae) { } catch (Exception ex) { //Log all info into error table ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this); //Display message box MessageBoxCustom.ShowMessage("An Error has occurred and been logged. " + "If you continue to receive this message please contact " + "your system administrator.", this); } }
public Matches(Clubs matches) { names = matches.Names; }
public EditClub(Clubs club) { InitializeComponent(); BindingContext = new VIewModels.EditClubViewModel(club); }
private void PopulateClubGridView() { Clubs club = new Clubs(); List<Clubs> tblClubs = club.GetClubs(); ClubGridView.DataSource = tblClubs; ClubGridView.DataBind(); }
//Finalizing the trade-in item protected void BtnAddTradeIN_Click(object sender, EventArgs e) { string method = "BtnAddTradeIN_Click"; object[] objPageDetails = { Session["currPage"].ToString(), method }; try { CU = (CurrentUser)Session["currentUser"]; //Creating a new club Clubs tradeIN = new Clubs { intInventoryID = inventoryID, varSku = lblSKUDisplay.Text, fltCost = Convert.ToDouble(txtCost.Text), fltPrice = Convert.ToDouble(txtPrice.Text), fltPremiumCharge = 0, intItemTypeID = 1, intBrandID = Convert.ToInt32(ddlBrand.SelectedValue), intModelID = Convert.ToInt32(ddlModel.SelectedValue), intQuantity = Convert.ToInt32(txtQuantity.Text), varTypeOfClub = txtClubType.Text, varShaftType = txtShaft.Text, varClubSpecification = txtClubSpec.Text, varShaftFlexability = txtShaftFlex.Text, varNumberOfClubs = txtNumberofClubs.Text, varShaftSpecification = txtShaftSpec.Text, varClubDexterity = txtDexterity.Text, varAdditionalInformation = txtComments.Text, bitIsUsedProduct = true, intLocationID = CU.location.intLocationID }; //this adds to the temp tradeIncart ItM.CallAddTradeInItemToTempTable(tradeIN, objPageDetails); //change cost and price for cart InvoiceItemsManager IIM = new InvoiceItemsManager(); InvoiceItems selectedTradeIn = new InvoiceItems { intInvoiceID = invoice.intInvoiceID, intInventoryID = tradeIN.intInventoryID, varSku = tradeIN.varSku, intItemQuantity = tradeIN.intQuantity, varItemDescription = ItM.CallReturnBrandlNameFromBrandID(tradeIN.intBrandID, objPageDetails) + " " + ItM.CallReturnModelNameFromModelID(tradeIN.intModelID, objPageDetails) + " " + tradeIN.varClubSpecification + " " + tradeIN.varTypeOfClub + " " + tradeIN.varShaftSpecification + " " + tradeIN.varShaftFlexability + " " + tradeIN.varClubDexterity, fltItemCost = 0, fltItemPrice = tradeIN.fltCost * (-1), fltItemDiscount = 0, fltItemRefund = 0, bitIsDiscountPercent = false, bitIsClubTradeIn = true, intItemTypeID = 1 }; IIM.CallInsertItemIntoSalesCart(selectedTradeIn, invoice.intTransactionTypeID, invoice.dtmInvoiceDate, CU.location.intProvinceID, objPageDetails); //IIM.NewTradeInChangeChargeTaxToFalse(selectedTradeIn, invoice.dtmInvoiceDate, CU.location.intProvinceID, objPageDetails); //Closing the trade in information window string redirect = "<script>window.close('TradeINEntry.aspx');</script>"; Response.Write(redirect); } catch (ThreadAbortException tae) { } catch (Exception ex) { ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this); MessageBoxCustom.ShowMessage("An Error has occurred and been logged. " + "If you continue to receive this message please contact " + "your system administrator.", this); } }
public void ImportNewItem(DataRow row, CurrentUser cu, object[] objPageDetails) { ItemDataUtilities IDU = new ItemDataUtilities(); int inventoryID = 0; int itemTypeID = Convert.ToInt32(row[14]); string sku = row[0].ToString(); Object o = new Object(); inventoryID = IDU.CheckIfSkuAlreadyInDatabase(sku, itemTypeID, objPageDetails); if (inventoryID > 0) { //Check for item in table if (itemTypeID == 1) { Clubs club = new Clubs(); //if item type is club then save as club class club.intInventoryID = inventoryID; club.fltCost = Convert.ToDouble(row[7]); club.intBrandID = Convert.ToInt32(row[1]); club.fltPrice = Convert.ToDouble(row[8]); club.intQuantity = Convert.ToInt32(row[9]); club.intLocationID = Convert.ToInt32(row[15]); club.varTypeOfClub = row[3].ToString(); club.intModelID = Convert.ToInt32(row[2]); club.varShaftType = row[4].ToString(); club.varNumberOfClubs = row[5].ToString(); club.varClubSpecification = row[10].ToString(); club.varShaftSpecification = row[11].ToString(); club.varShaftFlexability = row[12].ToString(); club.varClubDexterity = row[13].ToString(); club.varAdditionalInformation = row[16].ToString(); club.bitIsUsedProduct = Convert.ToBoolean(row[17]); o = club as Object; } else if (itemTypeID == 2) { Accessories accessory = new Accessories(); //if item type is accesory then save as accessory class accessory.intInventoryID = inventoryID; accessory.intBrandID = Convert.ToInt32(row[1]); accessory.fltCost = Convert.ToDouble(row[7]); accessory.fltPrice = Convert.ToDouble(row[8]); accessory.intQuantity = Convert.ToInt32(row[9]); accessory.intLocationID = Convert.ToInt32(row[15]); accessory.varSize = row[5].ToString(); accessory.varColour = row[4].ToString(); accessory.varTypeOfAccessory = row[3].ToString(); accessory.intModelID = Convert.ToInt32(row[2]); accessory.varAdditionalInformation = row[16].ToString(); o = accessory as Object; } else if (itemTypeID == 3) { Clothing clothing = new Clothing(); //if item type is clothing then save as clothing class clothing.intInventoryID = inventoryID; clothing.intBrandID = Convert.ToInt32(row[1]); clothing.fltCost = Convert.ToDouble(row[7]); clothing.fltPrice = Convert.ToDouble(row[8]); clothing.intQuantity = Convert.ToInt32(row[9]); clothing.intLocationID = Convert.ToInt32(row[15]); clothing.varSize = row[5].ToString(); clothing.varColour = row[4].ToString(); clothing.varGender = row[10].ToString(); clothing.varStyle = row[3].ToString(); clothing.varAdditionalInformation = row[16].ToString(); o = clothing as Object; } IDU.UpdateItemInDatabase(o, objPageDetails); } else { if (itemTypeID == 1) { Clubs club = new Clubs(); //Transfers all info into Club class string[] inventoryInfo = IDU.CallReturnMaxSku(itemTypeID, cu.location.intLocationID, objPageDetails); club.intInventoryID = Convert.ToInt32(inventoryInfo[1]); club.varSku = sku; club.fltCost = Convert.ToDouble(row[7]); club.intBrandID = Convert.ToInt32(row[1]); club.fltPrice = Convert.ToDouble(row[8]); club.intQuantity = Convert.ToInt32(row[9]); club.intLocationID = Convert.ToInt32(row[15]); club.varTypeOfClub = row[3].ToString(); club.intModelID = Convert.ToInt32(row[2]); club.varShaftType = row[4].ToString(); club.varNumberOfClubs = row[5].ToString(); club.varClubSpecification = row[10].ToString(); club.varShaftSpecification = row[11].ToString(); club.varShaftFlexability = row[12].ToString(); club.varClubDexterity = row[13].ToString(); club.bitIsUsedProduct = Convert.ToBoolean(row[17]); club.varAdditionalInformation = row[16].ToString(); club.intItemTypeID = itemTypeID; //stores club as an object o = club as Object; } else if (itemTypeID == 2) { Accessories accessory = new Accessories(); //Transfers all info into Accessory class string[] inventoryInfo = IDU.CallReturnMaxSku(itemTypeID, cu.location.intLocationID, objPageDetails); accessory.intInventoryID = Convert.ToInt32(inventoryInfo[1]); accessory.varSku = sku; accessory.intBrandID = Convert.ToInt32(row[1]); accessory.intModelID = Convert.ToInt32(row[2]); accessory.fltCost = Convert.ToDouble(row[7]); accessory.fltPrice = Convert.ToDouble(row[8]); accessory.intQuantity = Convert.ToInt32(row[9]); accessory.intLocationID = Convert.ToInt32(row[15]); accessory.intItemTypeID = itemTypeID; accessory.varSize = row[5].ToString(); accessory.varColour = row[4].ToString(); accessory.varTypeOfAccessory = row[3].ToString(); accessory.varAdditionalInformation = row[16].ToString(); //stores accessory as an object o = accessory as Object; } else if (itemTypeID == 3) { Clothing clothing = new Clothing(); //Transfers all info into Clothing class string[] inventoryInfo = IDU.CallReturnMaxSku(itemTypeID, cu.location.intLocationID, objPageDetails); clothing.intInventoryID = Convert.ToInt32(inventoryInfo[1]); clothing.varSku = sku; clothing.intBrandID = Convert.ToInt32(row[1]); clothing.fltCost = Convert.ToDouble(row[7]); clothing.fltPrice = Convert.ToDouble(row[8]); clothing.intQuantity = Convert.ToInt32(row[9]); clothing.intLocationID = Convert.ToInt32(row[15]); clothing.intItemTypeID = itemTypeID; clothing.varSize = row[5].ToString(); clothing.varColour = row[4].ToString(); clothing.varGender = row[10].ToString(); clothing.varStyle = row[3].ToString(); clothing.varAdditionalInformation = row[16].ToString(); //stores clothing as an object o = clothing as Object; } IDU.AddNewItemToDatabase(o, objPageDetails); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["itemKey"] != null) { if (!IsPostBack) { string itemType = Session["itemType"].ToString(); int itemSKU = Convert.ToInt32(Session["itemKey"].ToString()); lblTypeDisplay.Text = itemType; if (itemType == "Clubs") { c = ssm.singleItemLookUp(itemSKU); lblSKUDisplay.Text = c.sku.ToString(); lblCostDisplay.Text = c.cost.ToString(); lblBrandDisplay.Text = idu.brandType(c.brandID); lblPriceDisplay.Text = c.price.ToString(); lblQuantityDisplay.Text = c.quantity.ToString(); lblPremiumDisplay.Text = c.premium.ToString(); lblClubTypeDisplay.Text = c.clubType.ToString(); lblModelDisplay.Text = idu.modelType(c.modelID); lblShaftDisplay.Text = c.shaft.ToString(); lblNumberofClubsDisplay.Text = c.numberOfClubs.ToString(); lblClubSpecDisplay.Text = c.clubSpec.ToString(); lblShaftSpecDisplay.Text = c.shaftSpec.ToString(); lblShaftFlexDisplay.Text = c.shaftFlex.ToString(); lblDexterityDisplay.Text = c.dexterity.ToString(); chkUsed.Checked = c.used; lblCommentsDisplay.Text = c.comments.ToString(); } else if (itemType == "Accessories") { a = ssm.getAccessory(itemSKU); lblSKUDisplay.Text = a.sku.ToString(); lblCostDisplay.Text = a.cost.ToString(); lblBrandDisplay.Text = idu.brandType(a.brandID); lblPriceDisplay.Text = a.price.ToString(); lblQuantityDisplay.Text = a.quantity.ToString(); txtPremium.Visible = false; lblPremiumDisplay.Visible = false; lblClubType.Text = "Size: "; lblClubTypeDisplay.Text = a.size.ToString(); lblModel.Visible = false; lblModelDisplay.Visible = false; lblShaft.Text = "Colour: "; lblShaftDisplay.Text = a.colour.ToString(); lblNumberofClubs.Visible = false; lblNumberofClubsDisplay.Visible = false; lblClubSpec.Visible = false; lblClubSpecDisplay.Visible = false; lblShaftSpec.Visible = false; lblShaftSpecDisplay.Visible = false; lblShaftFlex.Visible = false; lblShaftFlexDisplay.Visible = false; lblDexterity.Visible = false; lblDexterityDisplay.Visible = false; lblComments.Visible = false; lblCommentsDisplay.Visible = false; chkUsed.Visible = false; } else if (itemType == "Clothing") { cl = ssm.getClothing(itemSKU); lblSKUDisplay.Text = cl.sku.ToString(); lblCostDisplay.Text = cl.cost.ToString(); lblBrandDisplay.Text = idu.brandType(cl.brandID); lblPriceDisplay.Text = cl.price.ToString(); lblQuantityDisplay.Text = cl.quantity.ToString(); txtPremium.Visible = false; lblPremiumDisplay.Visible = false; lblClubType.Text = "Size: "; lblClubTypeDisplay.Text = cl.size.ToString(); lblModel.Visible = false; lblModelDisplay.Visible = false; lblShaft.Text = "Colour: "; lblShaftDisplay.Text = cl.colour.ToString(); lblNumberofClubs.Visible = false; lblNumberofClubsDisplay.Visible = false; lblClubSpec.Text = "Gender: "; lblClubSpecDisplay.Text = cl.gender.ToString(); lblShaftFlex.Text = "Style: "; lblShaftFlexDisplay.Text = cl.style.ToString(); lblShaftSpec.Visible = false; lblShaftSpecDisplay.Visible = false; lblDexterity.Visible = false; lblDexterityDisplay.Visible = false; lblComments.Visible = false; lblCommentsDisplay.Visible = false; chkUsed.Visible = false; } } } else { ddlType.Visible = true; lblTypeDisplay.Visible = false; txtCost.Visible = true; lblCostDisplay.Visible = false; ddlBrand.Visible = true; lblBrandDisplay.Visible = false; txtPrice.Visible = true; lblPriceDisplay.Visible = false; txtQuantity.Visible = true; lblQuantityDisplay.Visible = false; lblPremiumDisplay.Visible = false; lblClubTypeDisplay.Visible = false; lblModelDisplay.Visible = false; lblShaftDisplay.Visible = false; lblNumberofClubsDisplay.Visible = false; lblClubSpecDisplay.Visible = false; lblShaftSpecDisplay.Visible = false; lblShaftFlexDisplay.Visible = false; lblDexterityDisplay.Visible = false; lblCommentsDisplay.Visible = false; //Accessories if (ddlType.SelectedIndex <= 0) { lblPremium.Visible = false; lblPremiumDisplay.Visible = false; lblClubType.Text = "Size: "; txtClubType.Visible = true; lblShaft.Text = "Colour: "; txtShaft.Visible = true; txtClubSpec.Visible = false; txtShaftFlex.Visible = false; chkUsed.Visible = false; lblModel.Visible = false; ddlModel.Visible = false; lblNumberofClubs.Visible = false; txtNumberofClubs.Visible = false; lblClubSpec.Visible = false; lblShaftSpec.Visible = false; txtShaftSpec.Visible = false; lblShaftFlex.Visible = false; lblDexterity.Visible = false; txtDexterity.Visible = false; lblComments.Visible = false; txtComments.Visible = false; } //Clubs else if (ddlType.SelectedIndex == 2) { lblPremium.Visible = true; txtPremium.Visible = true; txtClubType.Visible = true; ddlModel.Visible = true; txtShaft.Visible = true; txtNumberofClubs.Visible = true; txtClubSpec.Visible = true; txtShaftSpec.Visible = true; txtShaftFlex.Visible = true; txtDexterity.Visible = true; txtComments.Visible = true; chkUsed.Enabled = true; lblClubType.Text = "Club Type: "; lblShaft.Text = "Shaft: "; lblClubSpec.Text = "Club Spec: "; lblClubSpec.Visible = true; lblShaftFlex.Text = "Shaft Flex: "; lblShaftFlex.Visible = true; lblModel.Visible = true; lblNumberofClubs.Visible = true; lblShaftSpec.Visible = true; lblDexterity.Visible = true; lblComments.Visible = true; chkUsed.Visible = true; } //Clothing else if (ddlType.SelectedIndex == 1) { lblPremium.Visible = false; lblPremiumDisplay.Visible = false; lblClubType.Text = "Size: "; txtClubType.Visible = true; lblShaft.Text = "Colour: "; txtShaft.Visible = true; lblClubSpec.Text = "Gender: "; lblClubSpec.Visible = true; txtClubSpec.Visible = true; lblShaftFlex.Text = "Style: "; lblShaftFlex.Visible = true; txtShaftFlex.Visible = true; chkUsed.Visible = false; txtPremium.Visible = false; ddlModel.Visible = false; txtNumberofClubs.Visible = false; txtShaftSpec.Visible = false; txtDexterity.Visible = false; txtComments.Visible = false; lblShaftSpec.Visible = false; lblModel.Visible = false; lblNumberofClubs.Visible = false; lblDexterity.Visible = false; lblComments.Visible = false; } btnSaveItem.Visible = false; btnAddItem.Visible = true; pnlDefaultButton.DefaultButton = "btnAddItem"; btnEditItem.Visible = false; btnCancel.Visible = false; btnBackToSearch.Visible = true; } }
/*Add Method to add club*/ public void Add(Club newClub) { Clubs.Add(newClub); Number++; }
public void InsertClub(Club club) { Clubs.Add(club); SaveChanges(); }
// GET: Clubs/Edit/5 public ActionResult Edit(int id) { Clubs clubUpdate = _db.Clubs.Find(id); return(View(clubUpdate)); }
public RedirectToActionResult DeleteClub(int id) { Clubs deleteClub = repository.DeleteClub(id); return(RedirectToAction("ClubDetailsPage")); }
protected void Page_Load(object sender, EventArgs e) { //Collects current method and page for error tracking string method = "Page_Load"; Session["currPage"] = "InventoryAddNew.aspx"; object[] objPageDetails = { Session["currPage"].ToString(), method }; try { //checks if the user has logged in if (Session["currentUser"] == null) { //Go back to Login to log in Response.Redirect("LoginPage.aspx", false); } else { CU = (CurrentUser)Session["currentUser"]; if (CU.employee.intJobID != 0) { //If user is not an admin then disable the edit item button BtnEditItem.Enabled = false; } //Check to see if an item was selected if (Convert.ToInt32(Request.QueryString["inventory"].ToString()) != -10) { if (!IsPostBack) { ItemChangeTracking tempItem = new ItemChangeTracking(); //Grabs a list of objects that match the sku in query string. There should only ever be 1 that is returned List <Object> o = IDU.CallReturnListOfObjectsFromThreeTablesForInventoryAddNew(Convert.ToInt32(Request.QueryString["inventory"].ToString()), objPageDetails, DateTime.Now, CU.location.intProvinceID); ddlBrand.DataSource = IM.CallReturnDropDownForBrand(objPageDetails); ddlBrand.DataBind(); ddlLocation.DataSource = LM.CallReturnLocationDropDown(objPageDetails); ddlLocation.DataBind(); ddlType.DataSource = IM.CallReturnDropDownForItemType(objPageDetails); ddlType.DataBind(); ddlModel.DataSource = IM.CallReturnDropDownForModel(objPageDetails); ddlModel.DataBind(); if (o[0] is Clubs) { //When a club, pass class and populate DropDowns and TextBoxes Clubs club = o[0] as Clubs; ddlType.SelectedValue = club.intItemTypeID.ToString(); lblSKUDisplay.Text = club.varSku.ToString(); txtCost.Text = club.fltCost.ToString(); ddlBrand.SelectedValue = club.intBrandID.ToString(); txtPrice.Text = club.fltPrice.ToString(); txtQuantity.Text = club.intQuantity.ToString(); ddlLocation.SelectedValue = club.intLocationID.ToString(); txtClubType.Text = club.varTypeOfClub.ToString(); ddlModel.SelectedValue = club.intModelID.ToString(); txtShaft.Text = club.varShaftType.ToString(); txtNumberofClubs.Text = club.varNumberOfClubs.ToString(); txtClubSpec.Text = club.varClubSpecification.ToString(); txtShaftSpec.Text = club.varShaftSpecification.ToString(); txtShaftFlex.Text = club.varShaftFlexability.ToString(); txtDexterity.Text = club.varClubDexterity.ToString(); chkUsed.Checked = club.bitIsUsedProduct; txtComments.Text = club.varAdditionalInformation.ToString(); GrdInventoryTaxes.DataSource = club.lstTaxTypePerInventoryItem; GrdInventoryTaxes.DataBind(); tempItem.intInventoryID = club.intInventoryID; tempItem.fltOriginalCost = club.fltCost; tempItem.fltOriginalPrice = club.fltPrice; tempItem.intOriginalQuantity = club.intQuantity; tempItem.varOriginalDescription = "Location ID: " + club.intLocationID.ToString() + "; Brand ID: " + club.intBrandID.ToString() + "; Model ID: " + club.intModelID.ToString() + "; Club Type: " + club.varTypeOfClub.ToString() + "; Shaft: " + club.varShaftType.ToString() + "; Number of Clubs: " + club.varNumberOfClubs.ToString() + "; Club Spec: " + club.varClubSpecification.ToString() + "; Shaft Spec: " + club.varShaftSpecification.ToString() + "; Shaft Flex: " + club.varShaftFlexability.ToString() + "; Dexterity: " + club.varClubDexterity.ToString() + "; Used: " + club.bitIsUsedProduct.ToString() + "; Comments: " + club.varAdditionalInformation.ToString(); } else if (o[0] is Accessories) { //When accessories, pass class and populate DropDowns and TextBoxes Accessories accessory = o[0] as Accessories; ddlType.SelectedValue = accessory.intItemTypeID.ToString(); lblSKUDisplay.Text = accessory.varSku.ToString(); txtCost.Text = accessory.fltCost.ToString(); ddlBrand.SelectedValue = accessory.intBrandID.ToString(); txtPrice.Text = accessory.fltPrice.ToString(); txtQuantity.Text = accessory.intQuantity.ToString(); ddlLocation.SelectedValue = accessory.intLocationID.ToString(); lblClubType.Text = "Accessory Type:"; txtClubType.Text = accessory.varTypeOfAccessory.ToString(); lblNumberofClubs.Text = "Size:"; txtNumberofClubs.Text = accessory.varSize.ToString(); ddlModel.SelectedValue = accessory.intModelID.ToString(); lblShaft.Text = "Colour:"; txtShaft.Text = accessory.varColour.ToString(); txtComments.Text = accessory.varAdditionalInformation.ToString(); lblClubSpec.Visible = false; txtClubSpec.Visible = false; lblShaftSpec.Visible = false; txtShaftSpec.Visible = false; lblShaftFlex.Visible = false; txtShaftFlex.Visible = false; lblDexterity.Visible = false; txtDexterity.Visible = false; chkUsed.Visible = false; GrdInventoryTaxes.DataSource = accessory.lstTaxTypePerInventoryItem; GrdInventoryTaxes.DataBind(); tempItem.intInventoryID = accessory.intInventoryID; tempItem.fltOriginalCost = accessory.fltCost; tempItem.fltOriginalPrice = accessory.fltPrice; tempItem.intOriginalQuantity = accessory.intQuantity; tempItem.varOriginalDescription = "Location ID: " + accessory.intLocationID.ToString() + "; Brand ID: " + accessory.intBrandID.ToString() + "; Model ID: " + accessory.intModelID.ToString() + "; Size: " + accessory.varSize.ToString() + "; Colour: " + accessory.varColour.ToString() + "; Accessory Type: " + accessory.varTypeOfAccessory.ToString() + "; Comments: " + accessory.varAdditionalInformation.ToString(); } else if (o[0] is Clothing) { //When clothing, pass class and populate DropDowns and TextBoxes Clothing clothing = o[0] as Clothing; ddlType.SelectedValue = clothing.intItemTypeID.ToString(); lblSKUDisplay.Text = clothing.varSku.ToString(); txtCost.Text = clothing.fltCost.ToString(); ddlBrand.SelectedValue = clothing.intBrandID.ToString(); txtPrice.Text = clothing.fltPrice.ToString(); txtQuantity.Text = clothing.intQuantity.ToString(); ddlLocation.SelectedValue = clothing.intLocationID.ToString(); txtComments.Text = clothing.varAdditionalInformation.ToString(); lblNumberofClubs.Text = "Size:"; txtNumberofClubs.Text = clothing.varSize.ToString(); lblModel.Visible = false; ddlModel.Visible = false; lblShaft.Text = "Colour:"; txtShaft.Text = clothing.varColour.ToString(); lblShaftFlex.Visible = false; txtShaftFlex.Visible = false; lblClubSpec.Text = "Gender:"; txtClubSpec.Text = clothing.varGender.ToString(); lblClubType.Text = "Style:"; txtClubType.Text = clothing.varStyle.ToString(); lblShaftSpec.Visible = false; txtShaftSpec.Visible = false; lblDexterity.Visible = false; txtDexterity.Visible = false; chkUsed.Visible = false; GrdInventoryTaxes.DataSource = clothing.lstTaxTypePerInventoryItem; GrdInventoryTaxes.DataBind(); tempItem.intInventoryID = clothing.intInventoryID; tempItem.fltOriginalCost = clothing.fltCost; tempItem.fltOriginalPrice = clothing.fltPrice; tempItem.intOriginalQuantity = clothing.intQuantity; tempItem.varOriginalDescription = "Location ID: " + clothing.intLocationID.ToString() + "; Brand ID: " + clothing.intBrandID.ToString() + "; Size: " + clothing.varSize.ToString() + "; Colour: " + clothing.varColour.ToString() + "; Gender: " + clothing.varGender.ToString() + "; Style: " + clothing.varStyle.ToString() + "; Comments: " + clothing.varAdditionalInformation.ToString(); } BtnCreateSimilar.Visible = true; changeItem = tempItem; Session["changer"] = changeItem; } } else { //When no item was selected display drop downs and text boxes ddlType.Enabled = true; txtCost.Enabled = true; ddlBrand.Enabled = true; txtPrice.Enabled = true; txtQuantity.Enabled = true; ddlLocation.Enabled = true; txtClubType.Enabled = true; txtShaft.Enabled = true; txtComments.Enabled = true; BtnCreateSimilar.Visible = false; if (!IsPostBack) { ddlBrand.DataSource = IM.CallReturnDropDownForBrand(objPageDetails); ddlBrand.DataBind(); ddlLocation.DataSource = LM.CallReturnLocationDropDown(objPageDetails); ddlLocation.DataBind(); ddlType.DataSource = IM.CallReturnDropDownForItemType(objPageDetails); ddlType.DataBind(); ddlModel.DataSource = IM.CallReturnDropDownForModel(objPageDetails); ddlModel.DataBind(); ddlLocation.SelectedValue = CU.location.intLocationID.ToString(); ddlType.SelectedValue = "1"; ddlModel.Enabled = true; txtNumberofClubs.Enabled = true; txtClubSpec.Enabled = true; txtShaftSpec.Enabled = true; txtShaftFlex.Enabled = true; txtDexterity.Enabled = true; chkUsed.Enabled = true; } else { //Clubs if (Convert.ToInt32(ddlType.SelectedValue) == 1) { //adjust labels displaying for clubs lblClubType.Text = "Club Type:"; lblModel.Visible = true; ddlModel.Visible = true; ddlModel.Enabled = true; lblShaft.Text = "Shaft:"; lblNumberofClubs.Text = "Number of Clubs:"; lblNumberofClubs.Visible = true; txtNumberofClubs.Visible = true; txtNumberofClubs.Enabled = true; lblClubSpec.Text = "Club Spec:"; lblClubSpec.Visible = true; txtClubSpec.Visible = true; txtClubSpec.Enabled = true; lblShaftSpec.Visible = true; txtShaftSpec.Visible = true; txtShaftSpec.Enabled = true; lblShaftFlex.Text = "Shaft Flex:"; lblShaftFlex.Visible = true; txtShaftFlex.Visible = true; txtShaftFlex.Enabled = true; lblDexterity.Visible = true; txtDexterity.Visible = true; txtDexterity.Enabled = true; chkUsed.Visible = true; chkUsed.Enabled = true; } //Accessories else if (Convert.ToInt32(ddlType.SelectedValue) == 2) { //adjust labels displaying for accessories lblNumberofClubs.Text = "Size:"; lblModel.Visible = true; ddlModel.Visible = true; ddlModel.Enabled = true; lblShaft.Text = "Colour:"; lblClubType.Text = "Accessory Type:"; lblNumberofClubs.Visible = true; txtNumberofClubs.Visible = true; txtNumberofClubs.Enabled = true; lblClubSpec.Visible = false; txtClubSpec.Visible = false; txtClubSpec.Enabled = false; lblShaftSpec.Visible = false; txtShaftSpec.Visible = false; txtShaftSpec.Enabled = false; lblShaftFlex.Visible = false; txtShaftFlex.Visible = false; txtShaftFlex.Enabled = false; lblDexterity.Visible = false; txtDexterity.Visible = false; txtDexterity.Enabled = false; chkUsed.Visible = false; chkUsed.Enabled = false; } //Clothing else if (Convert.ToInt32(ddlType.SelectedValue) == 3) { //adjust labels displaying for clubs lblNumberofClubs.Text = "Size:"; lblModel.Visible = false; ddlModel.Visible = false; ddlModel.Enabled = false; lblShaft.Text = "Colour:"; lblNumberofClubs.Visible = true; txtNumberofClubs.Visible = true; txtNumberofClubs.Enabled = true; lblClubSpec.Text = "Gender:"; lblClubSpec.Visible = true; txtClubSpec.Visible = true; txtClubSpec.Enabled = true; lblShaftSpec.Visible = false; txtShaftSpec.Visible = false; txtShaftSpec.Enabled = false; lblClubType.Text = "Style:"; lblShaftFlex.Visible = false; txtShaftFlex.Visible = false; txtShaftFlex.Enabled = false; lblDexterity.Visible = false; txtDexterity.Visible = false; txtDexterity.Enabled = false; chkUsed.Visible = false; chkUsed.Enabled = false; } } //hides and displays the proper buttons for access BtnSaveItem.Visible = false; BtnAddItem.Visible = true; pnlDefaultButton.DefaultButton = "btnAddItem"; BtnEditItem.Visible = false; BtnCancel.Visible = false; BtnBackToSearch.Visible = true; } } } //Exception catch catch (ThreadAbortException tae) { } catch (Exception ex) { //Log all info into error table ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this); //Display message box MessageBoxCustom.ShowMessage("An Error has occurred and been logged. " + "If you continue to receive this message please contact " + "your system administrator.", this); } }
/// <summary> /// Saves the club list /// </summary> /// <param name="fileName">file name</param> /// <param name="clubList">list of clubs</param> public bool SaveClubData(Clubs clubList) { return(this.clubDataReader.SaveClubData( this.generalIo.ClubGlobalDataFile, clubList)); }
public bool AddClub(ClubModel _club) { Clubs.Add(_club); return(true); }
public void CallAddTradeInItemToTempTable(Clubs tradeIn, object[] objPageDetails) { AddTradeInItemToTempTable(tradeIn, objPageDetails); }
private void GenerateSeedData() { var oversHelper = new OversHelper(); var playerIdentityFinder = new PlayerIdentityFinder(); var playerInMatchStatisticsBuilder = new PlayerInMatchStatisticsBuilder(playerIdentityFinder, oversHelper); var seedDataGenerator = new SeedDataGenerator(oversHelper, new BowlingFiguresCalculator(oversHelper), playerIdentityFinder, new TeamFakerFactory(), new MatchLocationFakerFactory(), new SchoolFakerFactory()); using (var connection = ConnectionFactory.CreateDatabaseConnection()) { connection.Open(); var repo = new SqlServerIntegrationTestsRepository(connection, playerInMatchStatisticsBuilder); repo.CreateUmbracoBaseRecords(); var members = seedDataGenerator.CreateMembers(); foreach (var member in members) { repo.CreateMember(member); } ClubWithMinimalDetails = seedDataGenerator.CreateClubWithMinimalDetails(); repo.CreateClub(ClubWithMinimalDetails); Clubs.Add(ClubWithMinimalDetails); ClubWithOneTeam = seedDataGenerator.CreateClubWithMinimalDetails(); repo.CreateClub(ClubWithOneTeam); Clubs.Add(ClubWithOneTeam); var onlyTeamInClub = seedDataGenerator.CreateTeamWithMinimalDetails("Only team in the club"); ClubWithOneTeam.Teams.Add(onlyTeamInClub); onlyTeamInClub.Club = ClubWithOneTeam; repo.CreateTeam(onlyTeamInClub); Teams.Add(onlyTeamInClub); ClubWithTeamsAndMatchLocation = seedDataGenerator.CreateClubWithTeams(); MatchLocationForClub = seedDataGenerator.CreateMatchLocationWithMinimalDetails(); MatchLocationForClub.PrimaryAddressableObjectName = "Club PAON"; MatchLocationForClub.SecondaryAddressableObjectName = "Club SAON"; MatchLocationForClub.Locality = "Club locality"; MatchLocationForClub.Town = "Club town"; MatchLocationForClub.AdministrativeArea = "Club area"; var teamWithMatchLocation = ClubWithTeamsAndMatchLocation.Teams.First(x => !x.UntilYear.HasValue); teamWithMatchLocation.MatchLocations.Add(MatchLocationForClub); MatchLocationForClub.Teams.Add(teamWithMatchLocation); repo.CreateClub(ClubWithTeamsAndMatchLocation); Clubs.Add(ClubWithTeamsAndMatchLocation); foreach (var team in ClubWithTeamsAndMatchLocation.Teams) { repo.CreateTeam(team); foreach (var matchLocation in team.MatchLocations) { repo.CreateMatchLocation(matchLocation); repo.AddTeamToMatchLocation(team, matchLocation); MatchLocations.Add(matchLocation); } } Teams.AddRange(ClubWithTeamsAndMatchLocation.Teams); TeamWithMinimalDetails = seedDataGenerator.CreateTeamWithMinimalDetails("Team minimal"); repo.CreateTeam(TeamWithMinimalDetails); Teams.Add(TeamWithMinimalDetails); TeamWithFullDetails = seedDataGenerator.CreateTeamWithFullDetails("Team with full details"); repo.CreateTeam(TeamWithFullDetails); Teams.Add(TeamWithFullDetails); foreach (var matchLocation in TeamWithFullDetails.MatchLocations) { repo.CreateMatchLocation(matchLocation); foreach (var team in matchLocation.Teams) { if (team.TeamId != TeamWithFullDetails.TeamId) { repo.CreateTeam(team); Teams.Add(team); } repo.AddTeamToMatchLocation(team, matchLocation); } MatchLocations.Add(matchLocation); } repo.CreateCompetition(TeamWithFullDetails.Seasons[0].Season.Competition); Competitions.Add(TeamWithFullDetails.Seasons[0].Season.Competition); foreach (var season in TeamWithFullDetails.Seasons) { repo.CreateSeason(season.Season, season.Season.Competition.CompetitionId.Value); repo.AddTeamToSeason(season); Seasons.Add(season.Season); } MatchInThePastWithMinimalDetails = seedDataGenerator.CreateMatchInThePastWithMinimalDetails(); repo.CreateMatch(MatchInThePastWithMinimalDetails); Matches.Add(MatchInThePastWithMinimalDetails); MatchListings.Add(MatchInThePastWithMinimalDetails.ToMatchListing()); MatchInTheFutureWithMinimalDetails = seedDataGenerator.CreateMatchInThePastWithMinimalDetails(); MatchInTheFutureWithMinimalDetails.StartTime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTimeOffset.UtcNow.AccurateToTheMinute().AddMonths(1), UkTimeZone()); repo.CreateMatch(MatchInTheFutureWithMinimalDetails); Matches.Add(MatchInTheFutureWithMinimalDetails); MatchListings.Add(MatchInTheFutureWithMinimalDetails.ToMatchListing()); MatchInThePastWithFullDetails = seedDataGenerator.CreateMatchInThePastWithFullDetails(members); repo.CreateMatchLocation(MatchInThePastWithFullDetails.MatchLocation); var playersForMatchInThePastWithFullDetails = playerIdentityFinder.PlayerIdentitiesInMatch(MatchInThePastWithFullDetails); MatchInThePastWithFullDetails.Teams[0].Team.UntilYear = 2020; foreach (var team in MatchInThePastWithFullDetails.Teams) { repo.CreateTeam(team.Team); } foreach (var player in playersForMatchInThePastWithFullDetails) { repo.CreatePlayer(player.Player); repo.CreatePlayerIdentity(player); } repo.CreateCompetition(MatchInThePastWithFullDetails.Season.Competition); repo.CreateSeason(MatchInThePastWithFullDetails.Season, MatchInThePastWithFullDetails.Season.Competition.CompetitionId.Value); repo.CreateMatch(MatchInThePastWithFullDetails); Teams.AddRange(MatchInThePastWithFullDetails.Teams.Select(x => x.Team)); Competitions.Add(MatchInThePastWithFullDetails.Season.Competition); Seasons.Add(MatchInThePastWithFullDetails.Season); MatchLocations.Add(MatchInThePastWithFullDetails.MatchLocation); Matches.Add(MatchInThePastWithFullDetails); MatchListings.Add(MatchInThePastWithFullDetails.ToMatchListing()); PlayerIdentities.AddRange(playerIdentityFinder.PlayerIdentitiesInMatch(MatchInThePastWithFullDetails)); MatchInThePastWithFullDetails.History.AddRange(new[] { new AuditRecord { Action = AuditAction.Create, ActorName = nameof(SqlServerDataSourceFixture), AuditDate = DateTimeOffset.UtcNow.AccurateToTheMinute().AddMonths(-1), EntityUri = MatchInThePastWithFullDetails.EntityUri }, new AuditRecord { Action = AuditAction.Update, ActorName = nameof(SqlServerDataSourceFixture), AuditDate = DateTimeOffset.UtcNow.AccurateToTheMinute(), EntityUri = MatchInThePastWithFullDetails.EntityUri } }); foreach (var audit in MatchInThePastWithFullDetails.History) { repo.CreateAudit(audit); } TournamentInThePastWithMinimalDetails = seedDataGenerator.CreateTournamentInThePastWithMinimalDetails(); repo.CreateTournament(TournamentInThePastWithMinimalDetails); Tournaments.Add(TournamentInThePastWithMinimalDetails); MatchListings.Add(TournamentInThePastWithMinimalDetails.ToMatchListing()); TournamentInTheFutureWithMinimalDetails = seedDataGenerator.CreateTournamentInThePastWithMinimalDetails(); TournamentInTheFutureWithMinimalDetails.StartTime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTimeOffset.UtcNow.AccurateToTheMinute().AddMonths(1), UkTimeZone()); repo.CreateTournament(TournamentInTheFutureWithMinimalDetails); Tournaments.Add(TournamentInTheFutureWithMinimalDetails); MatchListings.Add(TournamentInTheFutureWithMinimalDetails.ToMatchListing()); TournamentInThePastWithFullDetails = seedDataGenerator.CreateTournamentInThePastWithFullDetails(members); Teams.AddRange(TournamentInThePastWithFullDetails.Teams.Select(x => x.Team)); MatchInThePastWithFullDetails.Teams[0].Team.UntilYear = 2020; foreach (var team in TournamentInThePastWithFullDetails.Teams) { repo.CreateTeam(team.Team); } MatchLocations.Add(TournamentInThePastWithFullDetails.TournamentLocation); repo.CreateMatchLocation(TournamentInThePastWithFullDetails.TournamentLocation); repo.CreateTournament(TournamentInThePastWithFullDetails); foreach (var team in TournamentInThePastWithFullDetails.Teams) { repo.AddTeamToTournament(team, TournamentInThePastWithFullDetails); } foreach (var season in TournamentInThePastWithFullDetails.Seasons) { repo.CreateCompetition(season.Competition); Competitions.Add(season.Competition); repo.CreateSeason(season, season.Competition.CompetitionId.Value); repo.AddTournamentToSeason(TournamentInThePastWithFullDetails, season); Seasons.Add(season); } Tournaments.Add(TournamentInThePastWithFullDetails); MatchListings.Add(TournamentInThePastWithFullDetails.ToMatchListing()); for (var i = 0; i < 5; i++) { var tournamentMatch = seedDataGenerator.CreateMatchInThePastWithMinimalDetails(); tournamentMatch.Tournament = TournamentInThePastWithFullDetails; tournamentMatch.StartTime = TournamentInThePastWithFullDetails.StartTime.AddHours(i); tournamentMatch.OrderInTournament = i + 1; repo.CreateMatch(tournamentMatch); Matches.Add(tournamentMatch); TournamentMatchListings.Add(tournamentMatch.ToMatchListing()); } TournamentInThePastWithFullDetails.History.AddRange(new[] { new AuditRecord { Action = AuditAction.Create, ActorName = nameof(SqlServerDataSourceFixture), AuditDate = DateTimeOffset.UtcNow.AccurateToTheMinute().AddMonths(-2), EntityUri = TournamentInThePastWithFullDetails.EntityUri }, new AuditRecord { Action = AuditAction.Update, ActorName = nameof(SqlServerDataSourceFixture), AuditDate = DateTimeOffset.UtcNow.AccurateToTheMinute().AddDays(-7), EntityUri = TournamentInThePastWithFullDetails.EntityUri } }); foreach (var audit in TournamentInThePastWithFullDetails.History) { repo.CreateAudit(audit); } MatchInThePastWithFullDetailsAndTournament = seedDataGenerator.CreateMatchInThePastWithFullDetails(members); MatchInThePastWithFullDetailsAndTournament.Tournament = TournamentInThePastWithMinimalDetails; MatchInThePastWithFullDetailsAndTournament.Season.FromYear = MatchInThePastWithFullDetailsAndTournament.Season.UntilYear = 2018; repo.CreateMatchLocation(MatchInThePastWithFullDetailsAndTournament.MatchLocation); foreach (var team in MatchInThePastWithFullDetailsAndTournament.Teams) { repo.CreateTeam(team.Team); } var playersForMatchInThePastWithFullDetailsAndTournament = playerIdentityFinder.PlayerIdentitiesInMatch(MatchInThePastWithFullDetailsAndTournament); foreach (var player in playersForMatchInThePastWithFullDetailsAndTournament) { repo.CreatePlayer(player.Player); repo.CreatePlayerIdentity(player); } repo.CreateCompetition(MatchInThePastWithFullDetailsAndTournament.Season.Competition); repo.CreateSeason(MatchInThePastWithFullDetailsAndTournament.Season, MatchInThePastWithFullDetailsAndTournament.Season.Competition.CompetitionId.Value); repo.CreateMatch(MatchInThePastWithFullDetailsAndTournament); Teams.AddRange(MatchInThePastWithFullDetailsAndTournament.Teams.Select(x => x.Team)); Competitions.Add(MatchInThePastWithFullDetailsAndTournament.Season.Competition); MatchLocations.Add(MatchInThePastWithFullDetailsAndTournament.MatchLocation); Matches.Add(MatchInThePastWithFullDetailsAndTournament); TournamentMatchListings.Add(MatchInThePastWithFullDetailsAndTournament.ToMatchListing()); Seasons.Add(MatchInThePastWithFullDetailsAndTournament.Season); PlayerIdentities.AddRange(playerIdentityFinder.PlayerIdentitiesInMatch(MatchInThePastWithFullDetailsAndTournament)); CompetitionWithMinimalDetails = seedDataGenerator.CreateCompetitionWithMinimalDetails(); repo.CreateCompetition(CompetitionWithMinimalDetails); Competitions.Add(CompetitionWithMinimalDetails); CompetitionWithFullDetails = seedDataGenerator.CreateCompetitionWithFullDetails(); repo.CreateCompetition(CompetitionWithFullDetails); foreach (var season in CompetitionWithFullDetails.Seasons) { repo.CreateSeason(season, CompetitionWithFullDetails.CompetitionId.Value); Seasons.Add(season); } Competitions.Add(CompetitionWithFullDetails); var competitionForSeason = seedDataGenerator.CreateCompetitionWithMinimalDetails(); competitionForSeason.UntilYear = 2021; SeasonWithMinimalDetails = seedDataGenerator.CreateSeasonWithMinimalDetails(competitionForSeason, 2020, 2020); competitionForSeason.Seasons.Add(SeasonWithMinimalDetails); repo.CreateCompetition(competitionForSeason); repo.CreateSeason(SeasonWithMinimalDetails, competitionForSeason.CompetitionId.Value); Competitions.Add(competitionForSeason); Seasons.Add(SeasonWithMinimalDetails); SeasonWithFullDetails = seedDataGenerator.CreateSeasonWithFullDetails(competitionForSeason, 2021, 2021, seedDataGenerator.CreateTeamWithMinimalDetails("Team 1 in season"), seedDataGenerator.CreateTeamWithMinimalDetails("Team 2 in season")); competitionForSeason.Seasons.Add(SeasonWithFullDetails); Teams.AddRange(SeasonWithFullDetails.Teams.Select(x => x.Team)); foreach (var team in SeasonWithFullDetails.Teams) { repo.CreateTeam(team.Team); } repo.CreateSeason(SeasonWithFullDetails, competitionForSeason.CompetitionId.Value); foreach (var team in SeasonWithFullDetails.Teams) { repo.AddTeamToSeason(team); } Seasons.Add(SeasonWithFullDetails); MatchLocationWithMinimalDetails = seedDataGenerator.CreateMatchLocationWithMinimalDetails(); repo.CreateMatchLocation(MatchLocationWithMinimalDetails); MatchLocations.Add(MatchLocationWithMinimalDetails); MatchLocationWithFullDetails = seedDataGenerator.CreateMatchLocationWithFullDetails(); repo.CreateMatchLocation(MatchLocationWithFullDetails); Teams.AddRange(MatchLocationWithFullDetails.Teams); MatchLocations.Add(MatchLocationWithFullDetails); foreach (var team in Teams.Where(t => t.Club == null || t.Club.ClubId == ClubWithOneTeam.ClubId)) { TeamListings.Add(team.ToTeamListing()); } foreach (var club in Clubs.Where(c => c.Teams.Count == 0 || c.Teams.Count > 1)) { TeamListings.Add(club.ToTeamListing()); } for (var i = 0; i < 30; i++) { var competition = seedDataGenerator.CreateCompetitionWithMinimalDetails(); repo.CreateCompetition(competition); Competitions.Add(competition); var matchLocation = seedDataGenerator.CreateMatchLocationWithMinimalDetails(); repo.CreateMatchLocation(matchLocation); MatchLocations.Add(matchLocation); var match = seedDataGenerator.CreateMatchInThePastWithMinimalDetails(); match.MatchLocation = matchLocation; match.StartTime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTimeOffset.UtcNow.AccurateToTheMinute().AddMonths(i - 15), UkTimeZone()); match.MatchType = i % 2 == 0 ? MatchType.FriendlyMatch : MatchType.LeagueMatch; match.PlayerType = i % 3 == 0 ? PlayerType.Mixed : PlayerType.Ladies; match.Comments = seedDataGenerator.CreateComments(i, members); repo.CreateMatch(match); Matches.Add(match); MatchListings.Add(match.ToMatchListing()); var tournament = seedDataGenerator.CreateTournamentInThePastWithMinimalDetails(); tournament.TournamentLocation = matchLocation; tournament.StartTime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTimeOffset.UtcNow.AccurateToTheMinute().AddMonths(i - 20).AddDays(5), UkTimeZone()); tournament.Comments = seedDataGenerator.CreateComments(i, members); repo.CreateTournament(tournament); Tournaments.Add(tournament); MatchListings.Add(tournament.ToMatchListing()); } } }
private void PopulateClub(string club_ID) { Guid Club_ID = new Guid(club_ID); Clubs club = new Clubs(Club_ID); txtClubLongName.Text = club.Club_Long_Name; divClubList.Visible = false; divClubDetails.Visible = true; }
public void Add(Club club) { Clubs.Add(club); numberOfClubs++; }
public Player(RawPlayerStats stats) { _rawStats = stats; try { Club = Clubs.GetClubFromName(stats.TeamName); } catch (Exception e) { throw new ApplicationException(string.Format("Unable to parse club for player '{0}'", stats.Name), e); } Position = (Enums.Position)Enum.Parse(typeof(Enums.Position), stats.PositionString); switch (stats.AvailabilityStatusString.Trim()) { case "a": AvailabilityStatus = Enums.Status.Available; break; case "i": AvailabilityStatus = Enums.Status.Injured; break; case "d": AvailabilityStatus = Enums.Status.Doubtful; break; case "n": AvailabilityStatus = Enums.Status.Unavailable; break; case "s": AvailabilityStatus = Enums.Status.Suspended; break; case "u": AvailabilityStatus = Enums.Status.Unavailable; break; default: throw new ApplicationException("Unknown status: " + stats.AvailabilityStatusString); } try { GameweekHistory = new PlayerGameweekHistory(Club, stats.GameweekHistory.RawGameweeks); } catch (Exception e) { throw new ApplicationException(string.Format("Unable to parse gameweek history for player '{0}'", stats.Name), e); } try { if (stats.SeasonHistory != null && stats.SeasonHistory.Any()) { PreviousSeasons = new Dictionary <string, PlayerSeasonPerformance>(); foreach (var season in stats.SeasonHistory) { PreviousSeasons.Add(((string)season[0]).Trim(), new PlayerSeasonPerformance(season)); } } } catch (Exception e) { throw new ApplicationException(string.Format("Unable to parse season history for player '{0}'", stats.Name), e); } Fixtures = stats.Fixtures.AllFixtures .Where(f => f[0] != "-") .GroupBy(f => int.Parse(f[1].Split(' ')[1])) // group by gameweek (f[1] in form "Gameweek x") .ToDictionary( grp => grp.Key, grp => grp.Select(f => new Fixture(Club, f)).ToArray() ); }
/// <summary> /// Adds a club in the database. /// </summary> /// <param name="club">The club that is being added.</param> public void AddClub(Clubs club) { olympicGamesDBContext.Clubs.Add(club); olympicGamesDBContext.SaveChanges(); }
public IActionResult UpdateClubPage(Clubs clubResponse) { repository.SaveClub(clubResponse); return(RedirectToAction("ClubDetailsPage")); }
public IActionResult DeleteConfirmed(Clubs clubs) { _repo.DeleteConfirmed(clubs); return(RedirectToAction(nameof(Index))); }
protected void BtnSaveItem_Click(object sender, EventArgs e) { //Collects current method for error tracking string method = "BtnSaveItem_Click"; object[] objPageDetails = { Session["currPage"].ToString(), method }; try { txtCost.Enabled = false; ddlBrand.Enabled = false; txtPrice.Enabled = false; txtQuantity.Enabled = false; ddlLocation.Enabled = false; txtClubType.Enabled = false; txtShaft.Enabled = false; txtComments.Enabled = false; changeItem = (ItemChangeTracking)Session["changer"]; object o = new object(); if (Convert.ToInt32(ddlType.SelectedValue) == 1) { Clubs club = new Clubs { //if item type is club then save as club class intInventoryID = Convert.ToInt32(Request.QueryString["inventory"].ToString()), fltCost = Convert.ToDouble(txtCost.Text), intBrandID = Convert.ToInt32(ddlBrand.SelectedValue), fltPrice = Convert.ToDouble(txtPrice.Text), intQuantity = Convert.ToInt32(txtQuantity.Text), intLocationID = Convert.ToInt32(ddlLocation.SelectedValue), varTypeOfClub = txtClubType.Text, intModelID = Convert.ToInt32(ddlModel.SelectedValue), varShaftType = txtShaft.Text, varNumberOfClubs = txtNumberofClubs.Text, varClubSpecification = txtClubSpec.Text, varShaftSpecification = txtShaftSpec.Text, varShaftFlexability = txtShaftFlex.Text, varClubDexterity = txtDexterity.Text, varAdditionalInformation = txtComments.Text, bitIsUsedProduct = chkUsed.Checked }; o = club as object; changeItem.fltNewCost = club.fltCost; changeItem.fltNewPrice = club.fltPrice; changeItem.intNewQuantity = club.intQuantity; changeItem.varNewDescription = "Location ID: " + club.intLocationID.ToString() + "; Brand ID: " + club.intBrandID.ToString() + "; Model ID: " + club.intModelID.ToString() + "; Club Type: " + club.varTypeOfClub.ToString() + "; Shaft: " + club.varShaftType.ToString() + "; Number " + "of Clubs: " + club.varNumberOfClubs.ToString() + "; Club Spec: " + club.varClubSpecification.ToString() + "; Shaft Spec: " + club.varShaftSpecification.ToString() + "; Shaft Flex: " + club.varShaftFlexability.ToString() + "; Dexterity: " + club.varClubDexterity.ToString() + "; Used: " + club.bitIsUsedProduct.ToString() + "; Comments: " + club.varAdditionalInformation.ToString(); //changes all text boxes and dropdowns to labels ddlModel.Enabled = false; txtNumberofClubs.Enabled = false; txtClubSpec.Enabled = false; txtShaftSpec.Enabled = false; txtShaftFlex.Enabled = false; txtDexterity.Enabled = false; chkUsed.Enabled = false; } else if (Convert.ToInt32(ddlType.SelectedValue) == 2) { Accessories accessory = new Accessories { //if item type is accesory then save as accessory class intInventoryID = Convert.ToInt32(Request.QueryString["inventory"].ToString()), intBrandID = Convert.ToInt32(ddlBrand.SelectedValue), fltCost = Convert.ToDouble(txtCost.Text), fltPrice = Convert.ToDouble(txtPrice.Text), intQuantity = Convert.ToInt32(txtQuantity.Text), intLocationID = Convert.ToInt32(ddlLocation.SelectedValue), varSize = txtNumberofClubs.Text, varColour = txtShaft.Text, varTypeOfAccessory = txtClubType.Text, intModelID = Convert.ToInt32(ddlModel.SelectedValue), varAdditionalInformation = txtComments.Text }; o = accessory as object; changeItem.fltNewCost = accessory.fltCost; changeItem.fltNewPrice = accessory.fltPrice; changeItem.intNewQuantity = accessory.intQuantity; changeItem.varNewDescription = "Location ID: " + accessory.intLocationID.ToString() + "; Brand ID: " + accessory.intBrandID.ToString() + "; Model ID: " + accessory.intModelID.ToString() + "; Size: " + accessory.varSize.ToString() + "; Colour: " + accessory.varColour.ToString() + "; Accessory Type: " + accessory.varTypeOfAccessory.ToString() + "; Comments: " + accessory.varAdditionalInformation.ToString(); //changes all text boxes and dropdowns to labels ddlModel.Enabled = false; txtNumberofClubs.Enabled = false; } else if (Convert.ToInt32(ddlType.SelectedValue) == 3) { Clothing clothing = new Clothing { //if item type is clothing then save as clothing class intInventoryID = Convert.ToInt32(Request.QueryString["inventory"].ToString()), intBrandID = Convert.ToInt32(ddlBrand.SelectedValue), fltCost = Convert.ToDouble(txtCost.Text), fltPrice = Convert.ToDouble(txtPrice.Text), intQuantity = Convert.ToInt32(txtQuantity.Text), intLocationID = Convert.ToInt32(ddlLocation.SelectedValue), varSize = txtNumberofClubs.Text, varColour = txtShaft.Text, varGender = txtClubSpec.Text, varStyle = txtClubType.Text, varAdditionalInformation = txtComments.Text }; o = clothing as object; changeItem.fltNewCost = clothing.fltCost; changeItem.fltNewPrice = clothing.fltPrice; changeItem.intNewQuantity = clothing.intQuantity; changeItem.varNewDescription = "Location ID: " + clothing.intLocationID.ToString() + "; Brand ID: " + clothing.intBrandID.ToString() + "; Size: " + clothing.varSize.ToString() + "; Colour: " + clothing.varColour.ToString() + "; Gender: " + clothing.varGender.ToString() + "; Style: " + clothing.varStyle.ToString() + "; Comments: " + clothing.varAdditionalInformation.ToString(); //changes all text boxes and dropdowns to labels txtClubSpec.Enabled = false; txtNumberofClubs.Enabled = false; } //hides and displays the proper buttons for access BtnSaveItem.Visible = false; BtnEditItem.Visible = true; pnlDefaultButton.DefaultButton = "btnEditItem"; BtnCancel.Visible = false; BtnAddItem.Visible = false; BtnBackToSearch.Visible = true; BtnCreateSimilar.Visible = true; object[] extra = { CU.employee.intEmployeeID, CU.location.intLocationID }; IDU.SaveInventoryChanges(changeItem, extra, objPageDetails); var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString()); nameValues.Set("inventory", IDU.UpdateItemInDatabase(o, objPageDetails).ToString()); //Refreshes current page Response.Redirect(Request.Url.AbsolutePath + "?" + nameValues, false); } //Exception catch catch (ThreadAbortException tae) { } catch (Exception ex) { //Log all info into error table ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this); //Display message box MessageBoxCustom.ShowMessage("An Error has occurred and been logged. " + "If you continue to receive this message please contact " + "your system administrator.", this); } }
protected void btnUpdateClub_Click(object sender, EventArgs e) { if (ValidateClub()) { MembershipUser userInfo = Membership.GetUser(); Guid user_ID = (Guid)userInfo.ProviderUserKey; Club_Contact_ID = Common.Club_Contact_ID; if (!string.IsNullOrEmpty(Club_Contact_ID)) { if (HasChanges()) { Guid club_ID = new Guid(Club_ID); Guid person_ID = new Guid(Club_Contact_ID); Clubs club = new Clubs(club_ID); club.Club_Long_Name = txtClubLongName.Text; club.Club_Short_Name = txtClubShortName.Text; club.Club_Contact = person_ID; club.DeleteClub = false; bool valid = club.Update_Club(club_ID, user_ID); if (valid) { Club_ID = club_ID.ToString(); Common.Club_ID = Club_ID; MessageLabel.Text = string.Format("{0} was updated successfully", club.Club_Long_Name); //ClearEntryFields(); if (!string.IsNullOrEmpty(btnReturn.PostBackUrl)) DivReturn.Visible = true; } } else { MessageLabel.Text = "Update cancelled as no changes have been made."; } } PopulateClubGridView(); Common.Club_Contact_ID = null; } }
/// <returns>[Club => [Player Name => Player Return Date]]</returns> public Dictionary <IClub, Dictionary <string, DateTime> > GetInjuryNews() { var requester = new WebPageRequester(_logger); var url = _INJURYNEWS_PAGE; CookieContainer cookies = null; var response = requester.Get(url, ref cookies); var htmlDoc = new HtmlDocument(); htmlDoc.LoadHtml(response); var contentElement = htmlDoc.GetElementbyId("content"); var injuriesTableBody = contentElement.SelectSingleNode("//table[@class='ffs-ib ffs-ib-full-content ffs-ib-sort']/tbody"); var items = injuriesTableBody.Elements("tr"); // force evaluation var result = new Dictionary <IClub, Dictionary <string, DateTime> >(); foreach (var item in items) { var clubName = item.SelectSingleNode(".//td[@class='team']").GetAttributeValue("title", null); if (clubName == null) { continue; } var allCols = item.SelectNodes("td"); if (allCols.Count < 4) { continue; } var playerName = allCols[0].InnerText.Trim(); if (playerName.Contains('(')) { playerName = playerName.Split('(')[0].Trim(); } var returnDateStr = allCols[3].InnerText.Trim(); DateTime returnDate; if (!DateTime.TryParseExact(returnDateStr, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out returnDate)) { continue; } var club = Clubs.GetClubFromName(clubName); Dictionary <string, DateTime> playerDict; if (!result.TryGetValue(club, out playerDict)) { playerDict = new Dictionary <string, DateTime>(); result.Add(club, playerDict); } if (playerDict.ContainsKey(playerName)) { _logger.WriteErrorMessage(string.Format("Injury news already container entry for {0}({1})", playerName, clubName)); } else { playerDict.Add(playerName, returnDate); } var i = 1; } return(result); }
protected void grdInventorySearched_RowCommand(object sender, GridViewCommandEventArgs e) { bool bolAdded = false; if (Session["ItemsInCart"] != null) { itemsInCart = (List <Cart>)Session["ItemsInCart"]; } int itemKey = Convert.ToInt32(e.CommandArgument.ToString()); if (e.CommandName == "AddItem") { foreach (var cart in itemsInCart) { if (cart.sku == itemKey && !bolAdded) { cart.quantity = cart.quantity + 1; bolAdded = true; } } //int locationID = Convert.ToInt32(lblLocationID.Text); int locationID = 0; //Finding the min and max range for trade ins int[] range = idu.tradeInSkuRange(locationID); //If the itemKey is between or equal to the ranges, do trade in if (itemKey >= range[0] && itemKey < range[1]) { //Trade In Sku to add in SK string redirect = "<script>window.open('TradeINEntry.aspx');</script>"; Response.Write(redirect); } else if (itemsInCart.Count == 0 || !bolAdded) { Clubs c = ssm.singleItemLookUp(itemKey); Clothing cl = ssm.getClothing(itemKey); Accessories ac = ssm.getAccessory(itemKey); if (c.sku != 0) { o = c as Object; } else if (cl.sku != 0) { o = cl as Object; } else if (ac.sku != 0) { o = ac as Object; } itemsInCart.Add(idu.addingToCart(o)); } } Session["ItemsInCart"] = itemsInCart; grdCartItems.DataSource = itemsInCart; grdCartItems.DataBind(); List <Items> nullGrid = new List <Items>(); nullGrid = null; grdInventorySearched.DataSource = nullGrid; grdInventorySearched.DataBind(); lblSubtotalDisplay.Text = "$ " + ssm.returnSubtotalAmount(itemsInCart).ToString("#.00"); }