protected void RunningOrdersGridView_RowUpdating(object sender, GridViewUpdateEventArgs e) { MembershipUser userInfo = Membership.GetUser(); Guid user_ID = (Guid)userInfo.ProviderUserKey; Guid dog_Class_ID = new Guid(RunningOrdersGridView.DataKeys[e.RowIndex].Values[1].ToString()); DogClasses dogClass = new DogClasses(_connString, dog_Class_ID); TextBox txtRunningOrder = (TextBox)RunningOrdersGridView.Rows[e.RowIndex].FindControl("txtRunningOrder"); if (string.IsNullOrEmpty(txtRunningOrder.Text) || txtRunningOrder.Text == "0") { dogClass.Running_Order = null; } else { short test; short.TryParse(txtRunningOrder.Text, out test); if (test > 0) { dogClass.Running_Order = short.Parse(txtRunningOrder.Text); } else { dogClass.Running_Order = null; } } dogClass.Update_Dog_Class(dog_Class_ID, user_ID); RunningOrdersGridView.EditIndex = -1; FillRunningOrdersGrid(RunningOrdersGridView, true); }
private bool DeleteDogClass(Guid entrant_ID, Guid user_ID) { bool deletedOK = false; List <DogClasses> tblDogClasses; DogClasses dogClasses = new DogClasses(_connString); tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID); foreach (DogClasses row in tblDogClasses) { bool dogFound = false; for (int i = 0; i < Common.MyDogList.Count; i++) { if (Common.MyDogList[i].Dog_ID == row.Dog_ID) { dogFound = true; } } if (!dogFound) { DogClasses dc = new DogClasses(_connString, (Guid)row.Dog_Class_ID); dc.DeleteDogClass = true; deletedOK = dc.Update_Dog_Class((Guid)row.Dog_Class_ID, user_ID); } } return(deletedOK); }
private void PopulateListBoxes() { List <DogClasses> tblDogClasses; DogClasses dogClasses = new DogClasses(_connString); Guid entrant_ID = new Guid(Entrant_ID); tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID); List <Dogs> dogs = new List <Dogs>(); foreach (DogClasses row in tblDogClasses) { Dogs dog = new Dogs(_connString, (Guid)row.Dog_ID); Dogs dg = dogs.Find(delegate(Dogs d) { return(d.Dog_ID == row.Dog_ID); }); if (dg == null) { dogs.Add(dog); } } lstDogs.DataSource = dogs; lstDogs.DataBind(); if (!string.IsNullOrEmpty(Show_ID)) { Guid show_ID = new Guid(Show_ID); ShowEntryClasses showEntryClasses = new ShowEntryClasses(_connString); List <ShowEntryClasses> tblShowEntryClasses = showEntryClasses.GetShow_Entry_ClassesByShow_ID(show_ID); lstClasses.DataSource = tblShowEntryClasses; lstClasses.DataBind(); } }
private bool ValidEntry() { bool valid = true; Guid show_ID = new Guid(Show_ID); Shows show = new Shows(_connString, show_ID); List <DogClasses> tblDogClasses; DogClasses dogClasses = new DogClasses(_connString); Guid entrant_ID = new Guid(Entrant_ID); tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID); short dogClassCount = 0; if (string.IsNullOrEmpty(Handler_ID) && lstClasses.SelectedItem.Text != "NFC") { MessageLabel.Text = "You must select the Handler."; valid = false; } if (!string.IsNullOrEmpty(Dog_ID) && lstClasses.SelectedItem.Text != "NFC") { Guid dog_ID = new Guid(Dog_ID); Dogs dog = new Dogs(_connString, dog_ID); if (!IsCorrectClassGender(dog)) { MessageLabel.Text = "This dog is the wrong gender for this class."; valid = false; } } foreach (DogClasses row in tblDogClasses) { if (!row.IsShow_Entry_Class_IDNull && row.Show_Entry_Class_ID != new Guid() && Dog_ID == row.Dog_ID.ToString()) { if (Show_Entry_Class_ID == row.Show_Entry_Class_ID.ToString()) { MessageLabel.Text = string.Format("You have already entered this dog in {0}.", GetClassName((Guid)row.Show_Entry_Class_ID)); valid = false; } else if (lstClasses.SelectedItem.Text == "NFC" && GetClassName((Guid)row.Show_Entry_Class_ID) != "NFC") { MessageLabel.Text = "This dog is already entered in other classes, so cannot be NFC"; valid = false; } else if (GetClassName((Guid)row.Show_Entry_Class_ID) == "NFC") { MessageLabel.Text = "This dog is entered NFC so cannot be entered in other classes."; valid = false; } if (valid) { dogClassCount += 1; if (dogClassCount >= show.MaxClassesPerDog) { MessageLabel.Text = string.Format("There is a maximum of {0} classes per dog for this show.", show.MaxClassesPerDog.ToString()); valid = false; } } } } return(valid); }
private void EditFinalClass() { cboNewValue = new ComboBox(); cboNewValue.Width = panel1.Width; panel1.Controls.Add(cboNewValue); dog = new Dogs(_connString, new Guid(_dogID)); dogClass = new DogClasses(_connString, new Guid(_dogClassID)); ShowFinalClasses sfc = new ShowFinalClasses(_connString); List <ShowFinalClasses> sfcList = sfc.GetShow_Final_ClassesByShow_Entry_Class_ID((Guid)dogClass.Show_Entry_Class_ID); if (sfcList.Count == 0) { this.DialogResult = System.Windows.Forms.DialogResult.Abort; } else { foreach (ShowFinalClasses showFinalClass in sfcList) { ComboBoxItem item = new ComboBoxItem(); item.Text = showFinalClass.Show_Final_Class_Description; item.Value = showFinalClass.Show_Final_Class_ID; cboNewValue.Items.Add(item); if (dogClass.Show_Final_Class_ID == showFinalClass.Show_Final_Class_ID) { lblCurrentValue.Text = showFinalClass.Show_Final_Class_Description;; lblCurrentValue.Visible = true; } } } }
private void PopulateDogClassGridView() { List <DogClasses> tblDogClasses; DogClasses dogClasses = new DogClasses(_connString); Guid entrant_ID = new Guid(Entrant_ID); tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID); List <DogClasses> dogClassList = new List <DogClasses>(); foreach (DogClasses row in tblDogClasses) { if (row.Show_Entry_Class_ID != null && row.Show_Entry_Class_ID != new Guid()) { DogClasses dogClass = new DogClasses(_connString, (Guid)row.Dog_Class_ID); Dogs dog = new Dogs(_connString, (Guid)row.Dog_ID); dogClass.Dog_Class_ID = row.Dog_Class_ID; dogClass.Dog_KC_Name = dog.Dog_KC_Name; ShowEntryClasses showEntryClass = new ShowEntryClasses(_connString, (Guid)row.Show_Entry_Class_ID); ClassNames className = new ClassNames(_connString, Int32.Parse(showEntryClass.Class_Name_ID.ToString())); dogClass.Class_Name_Description = string.Format("{0} : {1}", showEntryClass.Class_No, className.Description); if (!row.IsHandler_IDNull && row.Handler_ID != new Guid()) { People handler = new People(_connString, (Guid)row.Handler_ID); dogClass.Handler_Name = string.Format("{0} {1}", handler.Person_Forename, handler.Person_Surname); } dogClassList.Add(dogClass); } } if (dogClassList != null) { DogClassGridView.DataSource = dogClassList; DogClassGridView.DataBind(); } }
private bool DogAlreadyEntered() { bool ret = false; if (Is_Dam_Or_Sire) { return(ret); } DogClasses dogClasses = new DogClasses(_connString); List <DogClasses> tblDog_Classes; Guid show_ID = new Guid(Show_ID); Guid dog_ID = new Guid(Dog_ID); tblDog_Classes = dogClasses.GetDog_ClassesByDog_ID(show_ID, dog_ID); if (tblDog_Classes != null && tblDog_Classes.Count > 0) { foreach (DogClasses row in tblDog_Classes) { if (!row.IsEntrant_IDNull && row.Entrant_ID != new Guid()) { if (string.IsNullOrEmpty(Common.Entrant_ID) || Common.Entrant_ID != row.Entrant_ID.ToString()) { Guid entrant_ID = new Guid(row.Entrant_ID.ToString()); Entrants entrant = new Entrants(_connString, entrant_ID); if (Common.Show_ID == entrant.Show_ID.ToString()) { Common.ExistingEntrant_ID = entrant_ID.ToString(); ret = true; } } } } } return(ret); }
private bool InsertDogClass(Guid entrant_ID, Guid user_ID) { bool insertOK = true; for (int i = 0; i < Common.MyDogList.Count; i++) { bool dogFound = false; List <DogClasses> tblDogClasses; DogClasses dogClasses = new DogClasses(_connString); tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID); foreach (DogClasses row in tblDogClasses) { if (Common.MyDogList[i].Dog_ID == row.Dog_ID) { dogFound = true; } } if (!dogFound) { DogClasses dogClass = new DogClasses(_connString); dogClass.Entrant_ID = entrant_ID; dogClass.Dog_ID = Common.MyDogList[i].Dog_ID; Guid?dog_Class_ID = dogClass.Insert_Dog_Class(user_ID); if (dog_Class_ID == null) { insertOK = false; } } } return(insertOK); }
private void EditSpecialRequest() { txtNewValue = new TextBox(); panel1.Controls.Add(txtNewValue); dogClass = new DogClasses(_connString, new Guid(_dogClassID)); lblCurrentValue.Text = dogClass.Special_Request; lblCurrentValue.Visible = true; txtNewValue.Text = dogClass.Special_Request; }
private short HasDogChanges() { bool Changed = false; short del = Constants.DATA_NO_CHANGE; short ins = Constants.DATA_NO_CHANGE; List <DogClasses> tblDogClasses; DogClasses dogClasses = new DogClasses(_connString); Guid entrant_ID = new Guid(Entrant_ID); tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID); foreach (DogClasses dogClassesRow in tblDogClasses) { bool foundDog = false; for (int i = 0; i < Common.MyDogList.Count; i++) { if (Common.MyDogList[i].Dog_ID == dogClassesRow.Dog_ID) { //Dog in table still exists in list foundDog = true; } } if (!foundDog) { //Dog in table no longer exists in list (deleted) Changed = true; } } if (Changed) { del = Constants.DATA_DELETED; } Changed = false; for (int i = 0; i < Common.MyDogList.Count; i++) { bool foundDog = false; foreach (DogClasses dogClassesRow in tblDogClasses) { if (Common.MyDogList[i].Dog_ID == dogClassesRow.Dog_ID) { //Dog in List already exists in table foundDog = true; } } if (!foundDog) { //Dog in list does not exist in table (inserted) Changed = true; } } if (Changed) { ins = Constants.DATA_INSERTED; } return(del += ins); }
private void EditPreferredPart() { numNewValue = new NumericUpDown(); numNewValue.Minimum = 0; panel1.Controls.Add(numNewValue); dogClass = new DogClasses(_connString, new Guid(_dogClassID)); lblCurrentValue.Text = dogClass.Preferred_Part.ToString(); lblCurrentValue.Visible = true; numNewValue.Value = dogClass.Preferred_Part; }
private void EditRunningOrder() { numNewValue = new NumericUpDown(); numNewValue.Minimum = 0; panel1.Controls.Add(numNewValue); dogClass = new DogClasses(_connString, new Guid(_dogClassID)); lblCurrentValue.Text = dogClass.Running_Order.ToString(); lblCurrentValue.Visible = true; numNewValue.Value = (decimal)dogClass.Running_Order; }
private void PopulateDogList(Guid entrant_ID) { if (Common.MyDogList == null) { List <DogClasses> tblDogClasses; DogClasses dogClasses = new DogClasses(_connString); tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID); foreach (DogClasses dogClassesRow in tblDogClasses) { AddDogToList(dogClassesRow.Dog_ID.ToString()); } } }
protected void NoSpecialRequestGridView_RowUpdating(object sender, GridViewUpdateEventArgs e) { MembershipUser userInfo = Membership.GetUser(); Guid user_ID = (Guid)userInfo.ProviderUserKey; Guid dog_Class_ID = new Guid(NoSpecialRequestGridView.DataKeys[e.RowIndex].Values[1].ToString()); DogClasses dogClass = new DogClasses(_connString, dog_Class_ID); DropDownList ddlNewPart = (DropDownList)NoSpecialRequestGridView.Rows[e.RowIndex].FindControl("ddlNewPart"); Guid newShowFinalClassID = new Guid(ddlNewPart.SelectedValue); dogClass.Show_Final_Class_ID = newShowFinalClassID; dogClass.Update_Dog_Class(dog_Class_ID, user_ID); NoSpecialRequestGridView.EditIndex = -1; FillSpecialRequestGrid(NoSpecialRequestGridView, false); }
protected void OwnersDogsClassesGridView_RowUpdating(object sender, GridViewUpdateEventArgs e) { MembershipUser userInfo = Membership.GetUser(); Guid user_ID = (Guid)userInfo.ProviderUserKey; Guid dog_Class_ID = new Guid(OwnersDogsClassesGridView.DataKeys[e.RowIndex].Values[0].ToString()); DogClasses dogClass = new DogClasses(_connString, dog_Class_ID); DropDownList ddlNewHandler = (DropDownList)OwnersDogsClassesGridView.Rows[e.RowIndex].FindControl("ddlNewHandler"); Guid newHandler_ID = new Guid(ddlNewHandler.SelectedValue); dogClass.Handler_ID = newHandler_ID; dogClass.Update_Dog_Class(dog_Class_ID, user_ID); OwnersDogsClassesGridView.EditIndex = -1; PopulateOwnersDogsClassesGridView(); }
protected void DogClassGridView_RowDeleting(object sender, GridViewDeleteEventArgs e) { MembershipUser userInfo = Membership.GetUser(); Guid user_ID = (Guid)userInfo.ProviderUserKey; string dc_id = DogClassGridView.DataKeys[e.RowIndex]["Dog_Class_ID"].ToString(); Guid dog_Class_ID = new Guid(dc_id); DogClasses dogClasses = new DogClasses(_connString, dog_Class_ID); dogClasses.DeleteDogClass = true; if (dogClasses.Update_Dog_Class(dog_Class_ID, user_ID)) { PopulateDogClassGridView(); } }
protected void DogGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string Dog_ID = ((HiddenField)e.Row.FindControl("hdnID")).Value; GridView gvClasses = e.Row.FindControl("ClassGridView") as GridView; List <DogClasses> tblDog_Classes; DogClasses dogClasses = new DogClasses(_connString); if (!string.IsNullOrEmpty(Entrant_ID) && !string.IsNullOrEmpty(Dog_ID)) { Guid entrant_ID = new Guid(Entrant_ID); Guid dog_ID = new Guid(Dog_ID); tblDog_Classes = dogClasses.GetDog_ClassesByEntrant_ID_Dog_ID(entrant_ID, dog_ID); if (tblDog_Classes != null && tblDog_Classes.Count > 0) { List <DogClasses> dogClassList = new List <DogClasses>(); foreach (DogClasses row in tblDog_Classes) { if (!row.IsShow_Entry_Class_IDNull && row.Show_Entry_Class_ID != new Guid()) { DogClasses dogClass = new DogClasses(_connString, (Guid)row.Dog_Class_ID); Dogs dog = new Dogs(_connString, (Guid)row.Dog_ID); dogClass.Dog_Class_ID = row.Dog_Class_ID; dogClass.Dog_KC_Name = dog.Dog_KC_Name; ShowEntryClasses showEntryClass = new ShowEntryClasses(_connString, (Guid)row.Show_Entry_Class_ID); ClassNames className = new ClassNames(_connString, Int32.Parse(showEntryClass.Class_Name_ID.ToString())); dogClass.Class_Name_Description = string.Format("{0} : {1}", showEntryClass.Class_No, className.Description); if (!row.IsHandler_IDNull && row.Handler_ID != new Guid()) { People handler = new People(_connString, (Guid)row.Handler_ID); dogClass.Handler_Name = string.Format("{0} {1}", handler.Person_Forename, handler.Person_Surname); } dogClassList.Add(dogClass); } } if (dogClassList != null) { gvClasses.DataSource = dogClassList; gvClasses.DataBind(); } } } } }
protected void EntryGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { EntryGridRowIndex = e.Row.RowIndex; Entrant_ID = EntryGridView.DataKeys[EntryGridRowIndex].Value.ToString(); if (!string.IsNullOrEmpty(Entrant_ID)) { Guid entrant_ID = new Guid(Entrant_ID); GridView gvDogs = e.Row.FindControl("DogGridView") as GridView; GridView gvOwners = e.Row.FindControl("OwnerGridView") as GridView; List <DogClasses> tblDog_Classes; DogClasses dogClasses = new DogClasses(_connString); tblDog_Classes = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID, ExclNFC); if (tblDog_Classes != null && tblDog_Classes.Count > 0) { DogOwnerList dogOwnerList = new DogOwnerList(); DogList dogList = new DogList(); foreach (DogClasses dogClassRow in tblDog_Classes) { Dogs dog = new Dogs(_connString, (Guid)dogClassRow.Dog_ID); dogList.AddDog(dog); List <DogOwners> lnkDog_Owners; DogOwners dogOwner = new DogOwners(_connString); lnkDog_Owners = dogOwner.GetDogOwnersByDog_ID((Guid)dogClassRow.Dog_ID); if (lnkDog_Owners != null && lnkDog_Owners.Count > 0) { foreach (DogOwners dogOwnerRow in lnkDog_Owners) { People person = new People(_connString, dogOwnerRow.Owner_ID); dogOwnerList.AddOwner(person); } gvOwners.DataSource = dogOwnerList.MyDogOwnerList; gvOwners.DataBind(); } dogList.SortDogList(); gvDogs.DataSource = dogList.MyDogList; gvDogs.DataBind(); } } } } }
private void cboClassParts_SelectedIndexChanged(object sender, EventArgs e) { //No of part requests is greater than the number in the part int classPart = 0; int requiredCount = 0; int actualCount = 0; ShowFinalClasses showFinalClasses = new ShowFinalClasses(_connString, new Guid((cboClassParts.SelectedItem as ComboBoxItem).Value.ToString())); FinalClassNames finalClassNames = new FinalClassNames(_connString, showFinalClasses.Show_Final_Class_No); requiredCount = (int)finalClassNames.Entries; DogClasses dogClasses = new DogClasses(_connString); List <DogClasses> dogClassList = dogClasses.GetDog_ClassesByShow_Entry_Class_ID((Guid)showFinalClasses.Show_Entry_Class_ID); int.TryParse(showFinalClasses.Show_Final_Class_Description.Substring(showFinalClasses.Show_Final_Class_Description.Length - 1), out classPart); if (classPart > 0) { foreach (DogClasses dogClass in dogClassList) { if (dogClass.Preferred_Part == classPart) { actualCount++; } } } lblRequiredCount.Text = requiredCount.ToString(); lblActualCount.Text = actualCount.ToString(); if (actualCount > requiredCount) { lblActualCount.ForeColor = Color.Red; lblRequiredCount.ForeColor = Color.Red; } else { lblActualCount.ForeColor = Color.Lime; lblRequiredCount.ForeColor = Color.Lime; } }
private void PopulateEntrants() { _entrantData.Columns.Clear(); DataColumn dcFullName = new DataColumn("FullName"); DataColumn dcEntrantID = new DataColumn("EntrantID"); _entrantData.Columns.Add(dcFullName); _entrantData.Columns.Add(dcEntrantID); object[] dataRow = new object[2]; string connString = Utils.ConnectionString(); Entrants entrants = new Entrants(connString); List <Entrants> entrantList = entrants.GetEntrantsByShow_ID(_show_ID, true); foreach (Entrants entrant in entrantList) { _prev_Owner_ID = new Guid(); DogClasses dc = new DogClasses(connString); List <DogClasses> dcList = dc.GetDog_ClassesByEntrant_ID((Guid)entrant.Entrant_ID); foreach (DogClasses dogClass in dcList) { DogOwners dogOwners = new DogOwners(connString); List <DogOwners> doList = dogOwners.GetDogOwnersByDog_ID((Guid)dogClass.Dog_ID); foreach (DogOwners owner in doList) { if (owner.Owner_ID != _prev_Owner_ID) { People person = new People(connString, (Guid)owner.Owner_ID); dataRow[0] = person.Person_FullName; dataRow[1] = entrant.Entrant_ID; _entrantData.Rows.Add(dataRow); } _prev_Owner_ID = owner.Owner_ID; } } } selectEntrant.PeopleData = _entrantData; }
private void PopulateDogList() { List <DogClasses> tblDog_Classes; DogClasses dogClasses = new DogClasses(_connString); Guid entrant_ID = new Guid(Entrant_ID); DogList dogList = new DogList(); tblDog_Classes = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID); if (tblDog_Classes != null && tblDog_Classes.Count > 0) { DogOwnerList dogOwnerList = new DogOwnerList(); foreach (DogClasses dogClassRow in tblDog_Classes) { Dogs dog = new Dogs(_connString, (Guid)dogClassRow.Dog_ID); dogList.AddDog(dog); } } if (dogList != null) { Common.MyDogList = dogList.MyDogList; } }
private bool UpdateRingNumber(Guid show_ID, Guid dog_ID, short ring_No) { MembershipUser userInfo = Membership.GetUser(); Guid user_ID = (Guid)userInfo.ProviderUserKey; bool success = false; List <DogClasses> dogClassList = new List <DogClasses>(); DogClasses dogClasses = new DogClasses(_connString); dogClassList = dogClasses.GetDog_ClassesByDog_ID(show_ID, dog_ID); foreach (DogClasses row in dogClassList) { if (row.Show_Entry_Class_ID != new Guid()) { Guid dog_Class_ID = new Guid(row.Dog_Class_ID.ToString()); DogClasses dogClass = new DogClasses(_connString, dog_Class_ID); if (ring_No == 0) { dogClass.Ring_No = null; } else { dogClass.Ring_No = ring_No; } success = dogClass.Update_Dog_Class(dog_Class_ID, user_ID); } else { success = true; } if (!success) { return(false); } } return(success); }
protected void RunningOrdersGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Guid dog_Class_ID = new Guid(RunningOrdersGridView.DataKeys[e.Row.RowIndex].Values[1].ToString()); DogClasses dogClass = new DogClasses(_connString, dog_Class_ID); string strRunningOrder = "0"; if (dogClass.Running_Order != null) { strRunningOrder = dogClass.Running_Order.ToString(); } Label lblRunningOrder = (Label)e.Row.FindControl("lblRunningOrder"); if (lblRunningOrder != null) { lblRunningOrder.Text = strRunningOrder; } TextBox txtRunningOrder = (TextBox)e.Row.FindControl("txtRunningOrder"); if (txtRunningOrder != null) { txtRunningOrder.Text = strRunningOrder; } } }
private void EditHandler() { selectPerson = new SelectPerson(); panel1.Height = selectPerson.MaxHeight; panel1.Controls.Add(selectPerson); selectPerson.Caption = "Handler"; dogClass = new DogClasses(_connString, new Guid(_dogClassID)); People handlers = new People(_connString); List <People> handlerList = handlers.GetPeople(); if (handlerList.Count == 0) { this.DialogResult = System.Windows.Forms.DialogResult.Abort; } else { DataTable handlerData = new DataTable(); DataColumn dcFullName = new DataColumn("FullName"); DataColumn dcPersonID = new DataColumn("EntrantID"); handlerData.Columns.Add(dcFullName); handlerData.Columns.Add(dcPersonID); object[] dataRow = new object[2]; foreach (People handler in handlerList) { dataRow[0] = handler.Person_FullName; dataRow[1] = handler.Person_ID; if (dogClass.Handler_ID == handler.Person_ID) { lblCurrentValue.Text = handler.Person_FullName; lblCurrentValue.Visible = true; } handlerData.Rows.Add(dataRow); } selectPerson.PeopleData = handlerData; PositionControls(); } }
private void EditEntryClass() { cboNewValue = new ComboBox(); cboNewValue.Width = panel1.Width; panel1.Controls.Add(cboNewValue); dog = new Dogs(_connString, new Guid(_dogID)); dogClass = new DogClasses(_connString, new Guid(_dogClassID)); ShowEntryClasses sec = new ShowEntryClasses(_connString); List <ShowEntryClasses> secList = sec.GetShow_Entry_ClassesByShow_ID(new Guid(_showID)); foreach (ShowEntryClasses showEntryClass in secList) { ClassNames cn = new ClassNames(_connString, (int)showEntryClass.Class_Name_ID); ComboBoxItem item = new ComboBoxItem(); item.Text = cn.Description; item.Value = showEntryClass.Show_Entry_Class_ID; cboNewValue.Items.Add(item); if (dogClass.Show_Entry_Class_ID == showEntryClass.Show_Entry_Class_ID) { lblCurrentValue.Text = cn.Description; lblCurrentValue.Visible = true; } } }
private void PopulateOwnerList(Guid entrant_ID) { bool foundOwner = false; List <DogClasses> tblDogClasses; DogClasses dogClasses = new DogClasses(_connString); tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID); foreach (DogClasses dogClassesRow in tblDogClasses) { Guid dog_ID = new Guid(dogClassesRow.Dog_ID.ToString()); List <DogOwners> lnkDogOwners; DogOwners dogOwners = new DogOwners(_connString); lnkDogOwners = dogOwners.GetDogOwnersByDog_ID(dog_ID); foreach (DogOwners row in lnkDogOwners) { AddOwnerToList(row.Owner_ID.ToString()); foundOwner = true; } } if (foundOwner) { divOwnerList.Visible = true; } }
protected void btnAddCompetitor_Click(object sender, EventArgs e) { SaveFormFields(); StoreCommon(); if (ValidEntry()) { MembershipUser userInfo = Membership.GetUser(); Guid user_ID = (Guid)userInfo.ProviderUserKey; Entrants entrant = new Entrants(_connString); Guid show_ID = new Guid(Show_ID); entrant.Show_ID = show_ID; if (Catalogue) { entrant.Catalogue = Catalogue; } if (Overnight_Camping) { entrant.Overnight_Camping = Overnight_Camping; } if (!string.IsNullOrEmpty(Overpayment)) { entrant.Overpayment = decimal.Parse(Overpayment); } if (!string.IsNullOrEmpty(Underpayment)) { entrant.Underpayment = decimal.Parse(Underpayment); } if (Offer_Of_Help) { entrant.Offer_Of_Help = Offer_Of_Help; } if (!string.IsNullOrEmpty(Help_Details)) { entrant.Help_Details = Help_Details; } if (Withold_Address) { entrant.Withold_Address = Withold_Address; } if (Send_Running_Order) { entrant.Send_Running_Order = Send_Running_Order; } if (!string.IsNullOrEmpty(Entry_Date)) { if (entrant.Entry_Date.ToString() != Entry_Date && !string.IsNullOrEmpty(Entry_Date)) { entrant.Entry_Date = DateTime.Parse(Entry_Date); } } Guid?entrant_ID = entrant.Insert_Entrant(user_ID); if (entrant_ID != null) { Entrant_ID = entrant_ID.ToString(); Common.Entrant_ID = Entrant_ID; bool insertFailed = false; for (int i = 0; i < Common.MyDogList.Count; i++) { DogClasses dogClass = new DogClasses(_connString); dogClass.Entrant_ID = entrant_ID; dogClass.Dog_ID = Common.MyDogList[i].Dog_ID; Guid?dog_Class_ID = dogClass.Insert_Dog_Class(user_ID); if (dog_Class_ID == null) { insertFailed = true; } } if (!insertFailed) { string returnChars = Common.AppendReturnChars(Request.QueryString, "coc"); Server.Transfer("~/Competitors/AddDogToClasses.aspx?" + returnChars); } else { MessageLabel.Text = "Dog_Classes Insert Failed!"; } } else { MessageLabel.Text = "Entrants Insert Failed!"; } } }
public void SendEntryEmail(int ShowId, int UserId, String userRefNo) { Shows show = new Shows(ShowId); User currentUser = new User(UserId); // // if entered show, send email saying entered show String htmlContents = readTemplate("EnteredShow", "html", show, userRefNo); String plainContents = readTemplate("EnteredShow", "txt", show, userRefNo); MailMessage mm = new MailMessage(); String Classes_entered_html = "<table>"; String Classes_entered_plain = ""; List<ShowClasses> classList = ShowClasses.GetAllClassesForShow(ShowId); List<Dogs> dogList = Dogs.GetAllDogsForHandler(UserId, show.ShowDate); var multiClasses = TeamPairsManager.GetTeamPairClasses(ShowId); var multiTeams = TeamPairsManager.GetTeamPairsForShow(ShowId, multiClasses); foreach (Dogs d in dogList) { DogClasses dogClasses = new DogClasses(d.ID, ShowId); dogClasses.getDogsClasses(ShowId); if (d.Grade != 0) { bool dogEntered = false; foreach (ShowClasses cls in classList) { int clsIndex = dogClasses.Classlist.IndexOf(cls.ID); if (clsIndex > -1) { if (!dogEntered) { Classes_entered_html += String.Format("<tr style='font-weight:bold;'><td colspan='3'><b>{0} ({1}) {2} </b></td></tr>", d.PetName, d.Grade,(dogClasses.Lho == 0 ? "": "Entered lower height option")); Classes_entered_plain += String.Format("{1}{0}{1}--------------------------------{1} ({2}) {3}", d.PetName, Environment.NewLine, d.Grade, (dogClasses.Lho == 0 ? "" : "Entered lower height option")); } Classes_entered_html += "<tr>"; Classes_entered_html += String.Format("<td style='width:25px'></td><td>{0}</td><td>{1} {2} {3} {4} {5}</td>", cls.ClassNo, cls.NormalName(withClassNo:false)); Classes_entered_plain += String.Format("{0} - {1} {2} {3} {4} {5} {6}", cls.ClassNo, cls.NormalName(withClassNo:false), Environment.NewLine); Classes_entered_html += "</tr>"; dogEntered = true; } } } } foreach (var team in multiTeams.Where( t => t.UserId == UserId )) { if (team.Team) { Classes_entered_html += string.Format(@" <tr style='height:25px' ><td colspan='3'></td><tr> <td>Team Name<br>{0}</td> <td colspan='2'>Captain<br/>{1}</td> </tr>", team.TeamDetails.TeamName.Replace("'", "'"), team.TeamDetails.Captain.Replace("'", "'")); Classes_entered_plain += string.Format(@"Team Name:{0} Team Captain:{1}{2}", team.TeamDetails.TeamName.Replace("'", "'"), team.TeamDetails.Captain.Replace("'", "'"), Environment.NewLine); foreach (var member in team.Members) { Classes_entered_html += string.Format( @" <tr> <td> {0}</td> <td colspan='2'>{1}</td> </tr><tr> ", member.HandlerName.Replace("'", "'"), member.DogName.Replace("'", "'")); Classes_entered_plain += string.Format( @" {0}, {1}{2}", member.HandlerName.Replace("'", "'"), member.DogName.Replace("'", "'"), Environment.NewLine); } } } Classes_entered_html += " </table>"; Classes_entered_plain += Environment.NewLine; htmlContents = htmlContents.Replace("[CLOSING_DATE]", show.ClosingDate.ToString("ddd, dd MMM yyyy")); plainContents = plainContents.Replace("[CLOSING_DATE]", show.ClosingDate.ToString("ddd, dd MMM yyyy")); htmlContents = htmlContents.Replace("[CLASSES_ENTERED]", Classes_entered_html); plainContents = plainContents.Replace("[CLASSES_ENTERED]", Classes_entered_plain); string campingdetails_html = ""; string campingdetails_plain = ""; var usershowid = Convert.ToInt32(userRefNo); var uc = new UserCamping(usershowid); if (uc.ID > -1) { campingdetails_html = string.Format("<h3>Camping Details</h3><div>Party Name: <b>{0}</b><br>{1}</div>", uc.PitchDetails[0].PartyName, uc.PitchDetails[0].CampingDays); campingdetails_plain = string.Format("Party Name: {0}\n\r{1}", uc.PitchDetails[0].PartyName, uc.PitchDetails[0].CampingDays); } htmlContents = htmlContents.Replace("[CAMPING_DETAILS]", campingdetails_html); plainContents = plainContents.Replace("[CAMPING_DETAILS]", campingdetails_plain); string helpingdetails_html = ""; string helpingdetails_plain = ""; var helpersList = Helpers.HelperForShow(ShowId, UserId); if (helpersList.Count > 0) { helpingdetails_html += "<div id='helperdetails' class='infoText'><h3>Helping Details</h3>"; helpingdetails_plain = "Helper Details"; foreach (Helpers helper in helpersList) { String judge = ""; if (helper.JudgeID > -1) { Judge j = new Judge(helper.JudgeID); judge = "Judge: " + j.Name; } String ring = ""; if (helper.RingNo > 0) { ring = "Ring No:" + helper.RingNo.ToString(); } helpingdetails_html += String.Format("<div >{0:ddd dd MMM} - {1} {2} {3}</div>", helper.HelpDate, helper.expandJob(), judge, ring); helpingdetails_plain += String.Format("{0:ddd dd MMM} - {1} {2} {3}", helper.HelpDate, helper.expandJob(), judge, ring); } helpingdetails_html += "</div>"; helpingdetails_html += "\n"; } htmlContents = htmlContents.Replace("[HELPING_DETAILS]", helpingdetails_html); plainContents = plainContents.Replace("[HELPING_DETAILS]", helpingdetails_html); Decimal totals = 0; String table = CreateTotalsSummaryEmail(ShowId, UserId, ref totals); //htmlContents = htmlContents.Replace("[PAYMENT_NOTE]", table); AlternateView htmlView = AlternateView.CreateAlternateViewFromString(htmlContents, null, MediaTypeNames.Text.Html); LinkedResource logoImage = new LinkedResource(HttpContext.Current.Server.MapPath("~/Assets/logo.gif"), MediaTypeNames.Image.Gif); logoImage.ContentId = "LogoImage"; //htmlView.LinkedResources.Add(logoImage); AlternateView plainView = AlternateView.CreateAlternateViewFromString(plainContents, null, MediaTypeNames.Text.Plain); mm.AlternateViews.Add(plainView); mm.AlternateViews.Add(htmlView); SmtpClient client = new SmtpClient(); mm.From = new MailAddress("*****@*****.**", "First Place Processing"); mm.To.Add(new MailAddress(currentUser.EmailAddress, currentUser.Name)); mm.Subject = String.Format("Entry Confirmation {0} ({1:dd MMM yyyy})", show.ShowName, show.ShowDate); try { client.Send(mm); } catch (Exception e) { AppException.LogError("Error SendEntry:" + e.Message + "-" + e.StackTrace); } }
private void PopulateDogClassesGrid(string entrantID) { string connString = Utils.ConnectionString(); Guid entrant_ID = new Guid(entrantID); DogClasses dogClasses = new DogClasses(connString); List <DogClasses> dcList = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID); DataTable dt = new DataTable(); DataColumn dcDogClassID = new DataColumn("DogClassID"); DataColumn dcEntrantID = new DataColumn("EntrantID"); DataColumn dcDogID = new DataColumn("DogID"); DataColumn dcKCName = new DataColumn("KCName"); DataColumn dcBreed = new DataColumn("Breed"); DataColumn dcGender = new DataColumn("Gender"); DataColumn dcRegNo = new DataColumn("RegNo"); DataColumn dcDOB = new DataColumn("DOB"); DataColumn dcMeritPoints = new DataColumn("MeritPoints"); DataColumn dcBreeder = new DataColumn("Breeder"); DataColumn dcSire = new DataColumn("Sire"); DataColumn dcDam = new DataColumn("Dam"); DataColumn dcEntryClassName = new DataColumn("EntryClassName"); DataColumn dcPreferredPart = new DataColumn("PreferredPart"); DataColumn dcFinalClassName = new DataColumn("FinalClassName"); DataColumn dcHandler = new DataColumn("Handler"); DataColumn dcRingNo = new DataColumn("RingNo"); DataColumn dcRunningOrder = new DataColumn("RunningOrder"); DataColumn dcSpecialRequest = new DataColumn("SpecialRequest"); dt.Columns.Add(dcDogClassID); dt.Columns.Add(dcEntrantID); dt.Columns.Add(dcDogID); dt.Columns.Add(dcKCName); dt.Columns.Add(dcBreed); dt.Columns.Add(dcGender); dt.Columns.Add(dcRegNo); dt.Columns.Add(dcDOB); dt.Columns.Add(dcMeritPoints); dt.Columns.Add(dcBreeder); dt.Columns.Add(dcSire); dt.Columns.Add(dcDam); dt.Columns.Add(dcEntryClassName); dt.Columns.Add(dcPreferredPart); dt.Columns.Add(dcFinalClassName); dt.Columns.Add(dcHandler); dt.Columns.Add(dcRingNo); dt.Columns.Add(dcRunningOrder); dt.Columns.Add(dcSpecialRequest); object[] dogRow = new object[19]; foreach (DogClasses dc in dcList) { Dogs dog = new Dogs(connString, (Guid)dc.Dog_ID); ShowEntryClasses sec = new ShowEntryClasses(connString, (Guid)dc.Show_Entry_Class_ID); ClassNames cn = new ClassNames(connString, (int)sec.Class_Name_ID); DogBreeds db = new DogBreeds(connString, (int)dog.Dog_Breed_ID); DogGender dg = new DogGender(connString, (int)dog.Dog_Gender_ID); dogRow[0] = dc.Dog_Class_ID; dogRow[1] = entrant_ID; dogRow[2] = dog.Dog_ID; dogRow[3] = dog.Dog_KC_Name; dogRow[4] = db.Description; dogRow[5] = dg.Description; dogRow[6] = dog.Reg_No; DateTime DOB = (DateTime)dog.Date_Of_Birth; dogRow[7] = string.Format("{0}/{1}/{2}", DOB.Day, DOB.Month, DOB.Year); dogRow[8] = dog.Merit_Points; dogRow[9] = dog.Breeder; dogRow[10] = dog.Sire; dogRow[11] = dog.Dam; dogRow[12] = string.Concat(sec.Class_No, " - ", cn.Class_Name_Description); dogRow[13] = dc.Preferred_Part.ToString(); if (dc.Show_Final_Class_ID != null && dc.Show_Final_Class_ID != new Guid()) { ShowFinalClasses sfc = new ShowFinalClasses(connString, (Guid)dc.Show_Final_Class_ID); dogRow[14] = sfc.Show_Final_Class_Description; } else { dogRow[14] = "Not Yet Assigned"; } People handler = new People(connString, (Guid)dc.Handler_ID); dogRow[15] = handler.Person_FullName; dogRow[16] = string.IsNullOrWhiteSpace(dc.Ring_No.ToString()) ? "Not Yet Assigned" : dc.Ring_No.ToString(); dogRow[17] = string.IsNullOrWhiteSpace(dc.Running_Order.ToString()) ? "Not Yet Assigned" : dc.Running_Order.ToString(); dogRow[18] = dc.Special_Request; dt.Rows.Add(dogRow); } dgvDogClasses.DataSource = dt; dgvDogClasses.Columns["DogClassID"].Visible = false; dgvDogClasses.Columns["EntrantID"].Visible = false; dgvDogClasses.Columns["DogID"].Visible = false; //dgvDogClasses.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; //dgvDogClasses.AutoSize = true; }
public static DogClassBonuses GetClassBonus(DogClasses dogClass) { var classBonus = new DogClassBonuses(); switch (dogClass) { case DogClasses.Guardian: classBonus.DefenseScaling = 1.2F; classBonus.HealthScaling = 1.2F; classBonus.AtkPowerScaling = 1.0F; classBonus.PrayerScaling = 0.9F; classBonus.WillScaling = 0.9F; classBonus.IntelligenceScaling = 0.8F; break; case DogClasses.Champion: classBonus.DefenseScaling = 1.1F; classBonus.HealthScaling = 1.3F; classBonus.AtkPowerScaling = 1.1F; classBonus.PrayerScaling = 0.7F; classBonus.WillScaling = 0.8F; classBonus.IntelligenceScaling = 0.6F; break; case DogClasses.Paladin: classBonus.DefenseScaling = 1.1F; classBonus.HealthScaling = 1.1F; classBonus.AtkPowerScaling = 0.7F; classBonus.PrayerScaling = 1.4F; classBonus.WillScaling = 1.1F; classBonus.IntelligenceScaling = 0.4F; break; case DogClasses.Assassin: classBonus.DefenseScaling = 0.4F; classBonus.HealthScaling = 0.5F; classBonus.AtkPowerScaling = 2.1F; classBonus.PrayerScaling = 0.5F; classBonus.WillScaling = 0.5F; classBonus.IntelligenceScaling = 0.4F; break; case DogClasses.Warlock: classBonus.DefenseScaling = 1.3F; classBonus.HealthScaling = 1.3F; classBonus.AtkPowerScaling = 0.6F; classBonus.PrayerScaling = 0.1F; classBonus.WillScaling = 1.3F; classBonus.IntelligenceScaling = 1.4F; break; case DogClasses.Elementalist: classBonus.DefenseScaling = 0.8F; classBonus.HealthScaling = 1F; classBonus.AtkPowerScaling = 0.5F; classBonus.PrayerScaling = 1F; classBonus.WillScaling = 1.5F; classBonus.IntelligenceScaling = 2.0F; break; } return(classBonus); }
protected void btnUpdateCompetitor_Click(object sender, EventArgs e) { SaveFormFields(); StoreCommon(); if (ValidEntry()) { MembershipUser userInfo = Membership.GetUser(); Guid user_ID = (Guid)userInfo.ProviderUserKey; Guid entrant_ID = new Guid(Entrant_ID); bool EntrantChanges = false; bool EntrantSuccess = false; bool DogChanges = false; bool DogSuccess = false; if (HasEntrantChanges()) { EntrantChanges = true; Entrants entrant = new Entrants(_connString); Guid show_ID = new Guid(Show_ID); entrant.Show_ID = show_ID; if (Catalogue) { entrant.Catalogue = Catalogue; } if (Overnight_Camping) { entrant.Overnight_Camping = Overnight_Camping; } if (!string.IsNullOrEmpty(Overpayment)) { entrant.Overpayment = decimal.Parse(Overpayment); } if (!string.IsNullOrEmpty(Underpayment)) { entrant.Underpayment = decimal.Parse(Underpayment); } if (Offer_Of_Help) { entrant.Offer_Of_Help = Offer_Of_Help; } if (!string.IsNullOrEmpty(Help_Details)) { entrant.Help_Details = Help_Details; } if (Withold_Address) { entrant.Withold_Address = Withold_Address; } if (Send_Running_Order) { entrant.Send_Running_Order = Send_Running_Order; } if (!string.IsNullOrEmpty(Entry_Date)) { if (entrant.Entry_Date.ToString() != Entry_Date && !string.IsNullOrEmpty(Entry_Date)) { entrant.Entry_Date = DateTime.Parse(Entry_Date); } } EntrantSuccess = entrant.Update_Entrant(entrant_ID, user_ID); } else { EntrantSuccess = true; } List <DogClasses> tblDogClasses; DogClasses dogClasses = new DogClasses(_connString); tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID); bool insertOK = true; bool deleteOK = true; switch (HasDogChanges()) { case Constants.DATA_NO_CHANGE: DogSuccess = true; break; case Constants.DATA_INSERTED: DogChanges = true; insertOK = InsertDogClass(entrant_ID, user_ID); if (insertOK) { DogSuccess = true; } else { MessageLabel.Text = "Insert_Dog_Class Failed"; } break; case Constants.DATA_DELETED: DogChanges = true; deleteOK = DeleteDogClass(entrant_ID, user_ID); if (deleteOK) { DogSuccess = true; } else { MessageLabel.Text = "Delete_Dog_Class Failed"; } break; case Constants.DATA_INSERTED_AND_DELETED: DogChanges = true; insertOK = InsertDogClass(entrant_ID, user_ID); deleteOK = DeleteDogClass(entrant_ID, user_ID); if (insertOK && deleteOK) { DogSuccess = true; } else { MessageLabel.Text = string.Empty; if (!insertOK) { MessageLabel.Text = "Insert_Dog_Class Failed"; } if (!deleteOK) { MessageLabel.Text += "Delete_Dog_Class Failed"; } } break; default: break; } if (EntrantChanges && !EntrantSuccess) { MessageLabel.Text = "Update_Entrant Failed!"; } if (DogChanges && !DogSuccess) { MessageLabel.Text += " Error with Dog Changes!"; } if (!EntrantChanges && !DogChanges) { string returnChars = Common.AppendReturnChars(Request.QueryString, "coc"); Server.Transfer("~/Competitors/AddDogToClasses.aspx?" + returnChars); } if (EntrantSuccess && DogSuccess) { string returnChars = Common.AppendReturnChars(Request.QueryString, "coc"); Server.Transfer("~/Competitors/AddDogToClasses.aspx?" + returnChars); } } }