static public ConvertWeightWindow Show( double oldPersonWeight, double newPersonWeight, string [] jumpsNormal, string [] jumpsReactive) { if (ConvertWeightWindowBox == null) { ConvertWeightWindowBox = new ConvertWeightWindow(oldPersonWeight, newPersonWeight, jumpsNormal, jumpsReactive); } ConvertWeightWindowBox.label_old_weight_value.Text = oldPersonWeight.ToString() + " Kg"; ConvertWeightWindowBox.label_new_weight_value.Text = newPersonWeight.ToString() + " Kg"; ConvertWeightWindowBox.convert_weight.Show(); return(ConvertWeightWindowBox); }
protected void on_button_accept_clicked(object o, EventArgs args) { Gtk.TreeIter iter; int jumpID; bool option1; if (store.GetIterFirst(out iter)) { //don't catch 0 value while (store.IterNext(ref iter)) { option1 = (bool)store.GetValue(iter, columnBool1); //only change in database if option is 2 //because option 1 leaves the same percent and changes Kg (and database is in %) if (!option1) { //find the jumpID jumpID = Convert.ToInt32(treeview1.Model.GetValue(iter, 0)); //find weight (100% 80Kg) string weightString = (string)store.GetValue(iter, columnBool2 + 1); //find percent (it's before the '%' sign) string [] myStringFull = weightString.Split(new char[] { '%' }); double percent = Convert.ToDouble(myStringFull[0]); //update DB //see if it's reactive string tableName = "jump"; if ((string)treeview1.Model.GetValue(iter, 1) == reactiveString) { tableName = "jumpRj"; } SqliteJump.UpdateWeight(tableName, jumpID, percent); } } } ConvertWeightWindowBox.convert_weight.Hide(); ConvertWeightWindowBox = null; }
protected void on_delete_event(object o, DeleteEventArgs args) { ConvertWeightWindowBox.convert_weight.Hide(); ConvertWeightWindowBox = null; }
protected void on_button_cancel_clicked(object o, EventArgs args) { ConvertWeightWindowBox.convert_weight.Hide(); ConvertWeightWindowBox = null; }
protected void on_button_accept_clicked(object o, EventArgs args) { Gtk.TreeIter iter; int jumpID; bool option1; if (store.GetIterFirst(out iter)) { //don't catch 0 value while ( store.IterNext(ref iter) ){ option1 = (bool) store.GetValue (iter, columnBool1); //only change in database if option is 2 //because option 1 leaves the same percent and changes Kg (and database is in %) if(! option1) { //find the jumpID jumpID = Convert.ToInt32( treeview1.Model.GetValue(iter, 0) ); //find weight (100% 80Kg) string weightString = (string) store.GetValue (iter, columnBool2 +1 ); //find percent (it's before the '%' sign) string [] myStringFull = weightString.Split(new char[] {'%'}); double percent = Convert.ToDouble(myStringFull[0]); //update DB //see if it's reactive string tableName = "jump"; if ( (string) treeview1.Model.GetValue(iter, 1) == reactiveString ) tableName = "jumpRj"; SqliteJump.UpdateWeight(tableName, jumpID, percent); } } } ConvertWeightWindowBox.convert_weight.Hide(); ConvertWeightWindowBox = null; }
public static ConvertWeightWindow Show( double oldPersonWeight, double newPersonWeight, string [] jumpsNormal, string [] jumpsReactive) { if (ConvertWeightWindowBox == null) { ConvertWeightWindowBox = new ConvertWeightWindow (oldPersonWeight, newPersonWeight, jumpsNormal, jumpsReactive); } ConvertWeightWindowBox.label_old_weight_value.Text = oldPersonWeight.ToString() + " Kg"; ConvertWeightWindowBox.label_new_weight_value.Text = newPersonWeight.ToString() + " Kg"; ConvertWeightWindowBox.convert_weight.Show (); return ConvertWeightWindowBox; }
void on_button_accept_clicked(object o, EventArgs args) { string errorMessage = ""; //Check if person name exists and weight is > 0 string personName = entry1.Text; if(personName == "") errorMessage += "\n" + Catalog.GetString("Please, write the name of the person."); if((double) spinbutton_weight.Value == 0) errorMessage += "\n" + Catalog.GetString("Please, complete the weight of the person."); if(errorMessage.Length > 0) { ErrorWindow.Show(errorMessage); return; } bool personExists; if(adding) personExists = Sqlite.Exists (false, Constants.PersonTable, Util.RemoveTilde(personName)); else personExists = SqlitePerson.ExistsAndItsNotMe (currentPerson.UniqueID, Util.RemoveTilde(personName)); if(personExists) errorMessage += string.Format(Catalog.GetString("Person: '{0}' exists. Please, use another name"), Util.RemoveTildeAndColonAndDot(personName) ); else { //if weight has changed if(!adding && (double) spinbutton_weight.Value != weightIni) { //see if this person has done jumps with weight string [] myJumpsNormal = SqliteJump.SelectJumps(false, currentSession.UniqueID, currentPerson.UniqueID, "withWeight", "", Sqlite.Orders_by.DEFAULT, -1); string [] myJumpsReactive = SqliteJumpRj.SelectJumps(false, currentSession.UniqueID, currentPerson.UniqueID, "withWeight", ""); if(myJumpsNormal.Length > 0 || myJumpsReactive.Length > 0) { //create the convertWeight Window convertWeightWin = ConvertWeightWindow.Show( weightIni, (double) spinbutton_weight.Value, myJumpsNormal, myJumpsReactive); convertWeightWin.Button_accept.Clicked += new EventHandler(on_convertWeightWin_accepted); convertWeightWin.Button_cancel.Clicked += new EventHandler(on_convertWeightWin_cancelled); } else recordChanges(); } else recordChanges(); } if(errorMessage.Length > 0) ErrorWindow.Show(errorMessage); }
void on_button_accept_clicked(object o, EventArgs args) { bool personExists; if(adding) personExists = Sqlite.Exists (Constants.PersonTable, Util.RemoveTilde(entry1.Text)); else personExists = SqlitePerson.ExistsAndItsNotMe (currentPerson.UniqueID, Util.RemoveTilde(entry1.Text)); string errorMessage = ""; if(personExists) errorMessage += string.Format(Catalog.GetString("Person: '{0}' exists. Please, use another name"), Util.RemoveTildeAndColonAndDot(entry1.Text) ); else if (sport.Name == Catalog.GetString(Constants.SportUndefined)) errorMessage += Catalog.GetString("Please select an sport"); //here sport shouldn't be undefined, then check //if it has speciallities and if they are selected else if (sport.HasSpeciallities && UtilGtk.ComboGetActive(combo_speciallities) == Catalog.GetString(Constants.SpeciallityUndefined)) errorMessage += Catalog.GetString("Please select an speciallity"); else if (UtilGtk.ComboGetActive(combo_levels) == Constants.LevelUndefinedID.ToString() + ":" + Catalog.GetString(Constants.LevelUndefined)) errorMessage += Catalog.GetString("Please select a level"); else { //if weight has changed if(!adding && (double) spinbutton_weight.Value != weightIni) { //see if this person has done jumps with weight string [] myJumpsNormal = SqliteJump.SelectJumps(currentSession.UniqueID, currentPerson.UniqueID, "withWeight", ""); string [] myJumpsReactive = SqliteJumpRj.SelectJumps(currentSession.UniqueID, currentPerson.UniqueID, "withWeight", ""); if(myJumpsNormal.Length > 0 || myJumpsReactive.Length > 0) { //create the convertWeight Window convertWeightWin = ConvertWeightWindow.Show( weightIni, (double) spinbutton_weight.Value, myJumpsNormal, myJumpsReactive); convertWeightWin.Button_accept.Clicked += new EventHandler(on_convertWeightWin_accepted); convertWeightWin.Button_cancel.Clicked += new EventHandler(on_convertWeightWin_cancelled); } else recordChanges(); } else recordChanges(); } if(errorMessage.Length > 0) ErrorWindow.Show(errorMessage); }