protected void Button1_Click1(object sender, EventArgs e) { if (lblFieldid.Text.Length > 0) { try { EduFieldsRepository efir = new EduFieldsRepository(); if (efir.FindBytitle(TextBox1.Text) != null) { PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errRepeatTitle, Color.Red); return; } EduField editfield = new EduField(); if ((TextBox1.Text.Length > 0) && (TextBox1.Text != lbltitle.Text)) { editfield.FieldTitle = TextBox1.Text; } editfield.FieldID = lblFieldid.Text.ToInt(); efir.SaveEdufield(editfield); ClearForm(); PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgUpdateSuccessfull, Color.Green); } catch { PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errUpdateFailed, Color.Red); } } }
protected void Button1_Click(object sender, EventArgs e) { EduFieldsRepository edu = new EduFieldsRepository(); if (edu.FindBytitle(TextBox1.Text) != null) { PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDuplicateUsername, Color.Red); return; } bool successfullCreateAccount = true; try { EduField newfield = new EduField(); newfield.FieldTitle = TextBox1.Text.Trim(); EduFieldsRepository efir = new EduFieldsRepository(); efir.SaveEdufield(newfield); ClearForm(); } catch (System.Exception err) { successfullCreateAccount = false; PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailed, Color.Red); } if (successfullCreateAccount) { // ClearForm(); PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgAddSuccessfull, Color.Green); } }