private void button1_Click(object sender, EventArgs e) { MyError.NewRecord(); if (textBox1.Text == "") { MyError.Set(textBox1, "!!!"); } else { MyError.Clear(textBox1); } if (textBox2.Text == "") { MyError.Set(textBox2, "!!!"); } else { MyError.Clear(textBox2); } if (MyError.CheckAll()) { MyDialog.Msg(""); } }
bool Check() { MyError.NewRecord(); if (textBox1.Text.Trim() == "") { MyError.Set(textBox1, "名称不可为空。"); } else if (textBox1.Text.Trim().Length > 30) { MyError.Set(textBox1, "名称字数太长。"); } else if (Operation && M.DuplicateLabelGroupName(textBox1.Text.Trim(), LocationID))//新增时,检查是否重名 { MyError.Set(textBox1, "名称重复。"); } else if (!Operation && row["GroupName"].ToString() != textBox1.Text.Trim() && M.DuplicateLabelGroupName(textBox1.Text.Trim(), LocationID))//修改时,名称有变,检查是否重名 { MyError.Set(textBox1, "名称重复。"); } else { MyError.Clear(textBox1); } return(MyError.CheckAll()); }
public static MyError CreateParsingError(LogMessage syntaxError, string path) { MyError.ErrorType errorType; //CHAPUZ MAXIMO PARA VER SI ES ERROR LEXICO var lexicErrorSubString = "Invalid character"; if (syntaxError.Message.Substring(0, lexicErrorSubString.Length).Equals(lexicErrorSubString)) { errorType = MyError.ErrorType.Lexic; } else { errorType = MyError.ErrorType.Syntactic; } var error = new MyError(syntaxError.Message); error.Set(syntaxError.Location.Line, syntaxError.Location.Column, path, errorType, MyError.ErrorLevel.Fatal); AddError(error); return(error); }
/// <summary> /// Setea los valores de locacion al error y lo agrega a la lista de errores /// </summary> /// <returns>El error despues de ser editado</returns> public static MyError Create(AstNode node, MyError error) { error.Set(node.Span.Location.Line, node.Span.Location.Column, node.NodePath.StringValue, MyError.ErrorType.Semantic, MyError.ErrorLevel.Fatal); AddError(error); return(error); }
public static MyError MainNotFound(PyPath nodePath, MyError error) { error.Message = "Main no definido"; error.Set(-1, -1, nodePath.StringValue, MyError.ErrorType.Semantic, MyError.ErrorLevel.Warning); AddError(error); return(error); }
bool Check() { MyError.NewRecord(); if (textBox2.Text.Trim() == "") { MyError.Set(textBox2, "标题不可为空。"); } else if (textBox2.Text.Trim().Length > 30) { MyError.Set(textBox2, "标题字数太长。"); } else if (Operation && M.DuplicateTitle(textBox2.Text.Trim()))//新增时,检查是否重名 { MyError.Set(textBox2, "标题重复。"); } else if (!Operation && row["笔记标题"].ToString() != textBox2.Text.Trim() && M.DuplicateTitle(textBox2.Text.Trim()))//修改时,名称有变,检查是否重名 { MyError.Set(textBox2, "标题重复。"); } else { MyError.Clear(textBox2); } if (richTextBox1.Text.Trim() == "") { MyError.Set(button5, "内容不可为空。"); } else { MyError.Clear(button5); } if (comboBox1.Text == "") { MyError.Set(comboBox1, "请新建笔记本。"); } else { MyError.Clear(comboBox1); } return(MyError.CheckAll()); }
bool Check() { MyError.NewRecord(); if (listBox1.Items.Count == 0) { MyError.Set(button5, "请新建日记本。"); } else if (richTextBox1.Text.Trim() == "") { MyError.Set(button5, "日记内容不可为空。"); } else { MyError.Clear(button5); } return(MyError.CheckAll()); }
bool Check() { MyError.NewRecord(); if (textBox1.Text.Trim() == "") { MyError.Set(textBox1, "标题不可为空。"); } else if (Operation && M.DuplicateAnniTitle(textBox1.Text.Trim()))//新增时,检查是否重名 { MyError.Set(textBox1, "标题重复。"); } else if (!Operation && row["Title"].ToString() != textBox1.Text.Trim() && M.DuplicateAnniTitle(textBox1.Text.Trim()))//修改时,名称有变,检查是否重名 { MyError.Set(textBox1, "标题重复。"); } else { MyError.Clear(textBox1); } return(MyError.CheckAll()); }