public static SemanticError FunctionDoesNotExist(string name, LanguageNode node) { return new SemanticError(node) { Message = string.Format("Function '{0}' does not exist", name), }; }
public void OnSave(ref string msg, HT_NHNSD obj) { try { if (Validate(ref msg, obj)) { QuanTriHeThongProcess process = new QuanTriHeThongProcess(); List <string> lstStrIdNSD = new List <string>(); //(from row in dt.AsEnumerable() select row.Field<string>("ID")).Distinct().ToList(); List <int> lstIdNSD = lstStrIdNSD.Select(i => i.StringToInt32()).ToList(); ApplicationConstant.ResponseStatus ret = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG; var lstTruyCap = new List <HT_TRUY_CAP>(); string responseMessage = null; // Nếu là thêm mới if (obj.ID == 0) { ret = process.ThemNHNSD(ref obj, lstIdNSD, lstTruyCap, ref responseMessage); afterAddNew(ref msg, ret, obj, responseMessage); } else { ret = process.SuaNHNSD(ref obj, lstIdNSD, lstTruyCap, ref responseMessage); afterModify(ref msg, ret, obj, responseMessage); } } } catch (Exception ex) { msg = LanguageNode.GetValueMessageLanguage(ex.Message); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } }
public static SemanticError DefinedVariable(string varId, LanguageNode node) { return new SemanticError(node) { Message = string.Format("Variable '{0}' is already defined as a routin or a variable.", varId), }; }
public static SemanticError HidingAnStandardFunc(string declaration, string identifier, LanguageNode node) { return new SemanticError(node) { Message = string.Format("{0} declaration of {1} at line {2} is hiding a standard function.", declaration, identifier, node.Line), }; }
public static SemanticError DefinedType(string typeId, LanguageNode node) { return new SemanticError(node) { Message = string.Format("'{0}' is already defined.", typeId), }; }
internal RequestHoverText( LanguageNode languageNode, LinePosition linePosition, KernelCommand parent = null) : base(languageNode, linePosition, parent) { }
internal RequestCompletions( LanguageNode languageNode, LinePosition linePosition, KernelCommand parent = null) : base(languageNode, linePosition, parent) { }
public static SemanticError DefinedFunction(string functionId, LanguageNode node) { return new SemanticError(node) { Message = string.Format("Routin '{0}' is already defined as a routin or a variable.", functionId), }; }
public static SemanticError FunctionUsedAsVariable(string name, LanguageNode node) { return new SemanticError(node) { Message = string.Format("Function '{0}' used as variable or constant.", name), }; }
public static SemanticError DefinedField(string field, LanguageNode node) { return new SemanticError(node) { Message = string.Format("The field '{0}' is already declared in the definition.", field), }; }
public KeywordExprRecognizer(LanguageNode Parent) : base(Parent) { List = new Dictionary <string, KeywordExprRecognizerFunc>(); List.Add("true", (CodeString Code, PluginRoot Plugin, ref ExpressionNode Ret) => { Ret = Constants.GetBoolValue(Plugin.Container, true, Code); return(ExprRecResult.Succeeded); }); List.Add("false", (CodeString Code, PluginRoot Plugin, ref ExpressionNode Ret) => { Ret = Constants.GetBoolValue(Plugin.Container, false, Code); return(ExprRecResult.Succeeded); }); List.Add("null", (CodeString Code, PluginRoot Plugin, ref ExpressionNode Ret) => { Ret = Constants.GetNullValue(Plugin.Container, Code); return(ExprRecResult.Succeeded); }); List.Add("default", (CodeString Code, PluginRoot Plugin, ref ExpressionNode Ret) => { Ret = Constants.GetDefaultValue(Plugin.Container, Code); return(ExprRecResult.Succeeded); }); }
public static SemanticError InvalidArrayType(string text, string identifier, LanguageNode node) { return new SemanticError(node) { Message = string.Format("Undefined type '{0}' in the array '{1}' declaration at line {2}.", text, identifier, node.Line), }; }
/// <summary> /// Sau khi xóa /// </summary> /// <param name="ret"></param> private void AfterDelete(ref string msg, int id, bool ret, List <ClientResponseDetail> listClientResponseDetail) { if (ret) { msg = "S#" + LanguageNode.GetValueMessageLanguage("M.DungChung.XoaThanhCong"); } else { //msg = LanguageNode.GetValueMessageLanguage("M.DungChung.XoaKhongThanhCong", LMessage.MessageBoxType.Warning); //CommonFunction.ThongBaoKetQua(listClientResponseDetail); msg = "E#"; } // Yêu cầu unlock dữ liệu UtilitiesProcess process = new UtilitiesProcess(); List <int> listLockId = new List <int>(); listLockId.Add(id); List <int> listUnlockId = new List <int>(); bool retUnlockData = process.UnlockData(DatabaseConstant.Module.QTHT, DatabaseConstant.Function.HT_NHNSD, DatabaseConstant.Table.HT_NHNSD, DatabaseConstant.Action.XOA, listLockId); }
/// <summary> /// Sau khi sửa /// </summary> /// <param name="ret"></param> private void afterModify(ref string msg, ApplicationConstant.ResponseStatus ret, HT_NHNSD obj, string responseMessage) { if (ret == ApplicationConstant.ResponseStatus.THANH_CONG) { msg = "S#" + LanguageNode.GetValueMessageLanguage("M.DungChung.CapNhatThanhCong"); // Bind lại giao diện } else { msg = "E#" + LanguageNode.GetValueMessageLanguage(responseMessage); } // Yêu cầu Unlock bản ghi cần sửa UtilitiesProcess process = new UtilitiesProcess(); List <int> listLockId = new List <int>(); listLockId.Add(obj.ID); bool retUnlockData = process.UnlockData(DatabaseConstant.Module.QTHT, DatabaseConstant.Function.HT_NHNSD, DatabaseConstant.Table.HT_NHNSD, DatabaseConstant.Action.SUA, listLockId); }
internal RequestSignatureHelp( LanguageNode languageNode, LinePosition linePosition, KernelCommand parent = null) : base(languageNode, linePosition, parent) { }
/// <summary> /// Trước khi xóa /// </summary> private void BeforeDelete(ref string msg, int id) { // Lock dữ liệu nếu người dùng chấp nhận cảnh báo UtilitiesProcess process = new UtilitiesProcess(); List <int> listLockId = new List <int>(); listLockId.Add(id); List <int> listLockedId = new List <int>(); bool retLockData = process.LockData(DatabaseConstant.Module.QTHT, DatabaseConstant.Function.HT_NHNSD, DatabaseConstant.Table.HT_NHNSD, DatabaseConstant.Action.XOA, listLockId); // Nếu lock thành công >> cho phép sửa if (retLockData) { // Gọi tới hàm xóa dữ liệu OnDelete(ref msg, id); return; } // Nếu lock không thành công >> cảnh báo else { msg = LanguageNode.GetValueMessageLanguage("M.ResponseMessage.Common.LockDataInvalid"); return; } }
public NumberRecognizer(LanguageNode Parent, NumberRadixDefinition[] AtStart, NumberRadixDefinition[] AtEnd, NumberTypeCodeDefinition[] TypeCodes) : base(Parent) { this.AtStart = AtStart; this.AtEnd = AtEnd; this.TypeCodes = TypeCodes; }
public string getText(LanguageNode langNode) { if (dataList == null) { return(""); } return(dataList.Item((int)langNode).InnerText); }
public void ShouldParseEmptyLanguage() { Parser parser = new Parser("language HelloWorld { }"); LanguageNode language = parser.ParseLanguage(); Assert.IsNotNull(language); Assert.AreEqual("HelloWorld", language.Name); }
public NumberRecognizer(LanguageNode Parent) : base(Parent) { AtStart = new NumberRadixDefinition[] { new NumberRadixDefinition("$", 16), new NumberRadixDefinition("%", 2), }; }
public bool InsideLoop(LanguageNode node, int loopsCount) { if (node == null || node is RoutineDeclarationNode || node is LetInEndNode) return false; return ((node is WhileNode || node is ForNode) && loopsCount == 0) || InsideLoop((LanguageNode)node.Parent, node is BreakNode ? loopsCount-- : node is WhileNode || node is ForNode ? loopsCount++ : loopsCount); }
internal SubmitCode( LanguageNode languageNode, SubmissionType submissionType = SubmissionType.Run, IKernelCommand parent = null) : base(languageNode.Language, parent) { Code = languageNode.Text; SubmissionType = submissionType; SuppressSplit = true; }
public string getSentance(LanguageNode langNode, string value) { if (dataList == null) { return(""); } string sentance = dataList.Item((int)langNode).InnerText; return(sentance.Replace(SEARCH_KEY, value)); }
protected LanguageServiceCommand( LanguageNode languageNode, LinePosition linePosition, KernelCommand parent = null) : base(languageNode.KernelName, parent) { Code = languageNode.Text; LanguageNode = languageNode; LinePosition = linePosition; }
internal RequestDiagnostics( LanguageNode languageNode, KernelCommand parent = null) : base(languageNode.KernelName, parent) { Code = languageNode.Text; LanguageNode = languageNode; if (languageNode is ActionDirectiveNode actionDirectiveNode) { TargetKernelName = actionDirectiveNode.ParentKernelName; } }
/// <summary> /// Lấy ngôn ngữ hiển thị trạng thái bản ghi /// </summary> /// <param name="trangthai">string TrangThaiBanGhi</param> /// <returns>trạng thái bản ghi</returns> public static string layNgonNguSuDung(string trangthai) { if (trangthai == BusinessConstant.layGiaTri(BusinessConstant.TrangThaiBanGhi.SU_DUNG)) { return(LanguageNode.GetValueUILanguage("U.DungChung.TrangThaiBanGhi.SuDung")); } else if (trangthai == BusinessConstant.layGiaTri(BusinessConstant.TrangThaiBanGhi.KHONG_SU_DUNG)) { return(LanguageNode.GetValueUILanguage("U.DungChung.TrangThaiBanGhi.KhongSuDung")); } return(""); }
private bool Breakable(LanguageNode root, int bucleCount) { if (root.ChildCount == 0) return false; foreach (var child in root.Children) { if (child is WhileNode || child is ForNode) bucleCount++; if (child is BreakNode || Breakable((LanguageNode)child, bucleCount)) if (bucleCount == 0) return true; else bucleCount--; } return false; }
internal SubmitCode( LanguageNode languageNode, SubmissionType submissionType = SubmissionType.Run, KernelCommand parent = null, KernelNameDirectiveNode kernelNameDirectiveNode = null) : base(languageNode.KernelName, parent) { Code = languageNode.Text; LanguageNode = languageNode; SubmissionType = submissionType; KernelNameDirectiveNode = kernelNameDirectiveNode; if (languageNode is ActionDirectiveNode actionDirectiveNode) { TargetKernelName = actionDirectiveNode.ParentKernelName; } }
/// <summary> /// Lấy ngôn ngữ hiển thị trạng thái nghiệp vụ /// </summary> /// <param name="trangthai">string TrangThaiNghiepVu</param> /// <returns>trạng thái nghiệp vụ</returns> public static string layNgonNguNghiepVu(string trangthai) { if (trangthai == BusinessConstant.layGiaTri(BusinessConstant.TrangThaiNghiepVu.LUU_TAM)) { return(LanguageNode.GetValueUILanguage("U.DungChung.TrangThaiNghiepVu.LuuTam")); } else if (trangthai == BusinessConstant.layGiaTri(BusinessConstant.TrangThaiNghiepVu.CHO_DUYET)) { return(LanguageNode.GetValueUILanguage("U.DungChung.TrangThaiNghiepVu.ChoDuyet")); } else if (trangthai == BusinessConstant.layGiaTri(BusinessConstant.TrangThaiNghiepVu.SUA_SAU_DUYET)) { return(LanguageNode.GetValueUILanguage("U.DungChung.TrangThaiNghiepVu.SuaSauDuyet")); } else if (trangthai == BusinessConstant.layGiaTri(BusinessConstant.TrangThaiNghiepVu.DA_DUYET)) { return(LanguageNode.GetValueUILanguage("U.DungChung.TrangThaiNghiepVu.DaDuyet")); } else if (trangthai == BusinessConstant.layGiaTri(BusinessConstant.TrangThaiNghiepVu.TU_CHOI)) { return(LanguageNode.GetValueUILanguage("U.DungChung.TrangThaiNghiepVu.TuChoi")); } else if (trangthai == BusinessConstant.layGiaTri(BusinessConstant.TrangThaiNghiepVu.THOAI_DUYET)) { return(LanguageNode.GetValueUILanguage("U.DungChung.TrangThaiNghiepVu.ThoaiDuyet")); } else if (trangthai == BusinessConstant.layGiaTri(BusinessConstant.TrangThaiNghiepVu.LUU_TAM_SUA_SAU_DUYET)) { return(LanguageNode.GetValueUILanguage("U.DungChung.TrangThaiNghiepVu.LuuTamSuaSauDuyet")); } else if (trangthai == BusinessConstant.layGiaTri(BusinessConstant.TrangThaiNghiepVu.TU_CHOI_SUA_SAU_DUYET)) { return(LanguageNode.GetValueUILanguage("U.DungChung.TrangThaiNghiepVu.TuChoiSuaSauDuyet")); } else if (trangthai == BusinessConstant.layGiaTri(BusinessConstant.TrangThaiNghiepVu.TU_CHOI_CAP_TIN_DUNG)) { return(LanguageNode.GetValueUILanguage("U.DungChung.TrangThaiNghiepVu.TuChoi")); } return(""); }
/// <summary> /// Sau khi thêm mới /// </summary> /// <param name="ret"></param> private void afterAddNew(ref string msg, ApplicationConstant.ResponseStatus ret, HT_NHNSD obj, string responseMessage, bool multiAdd = false) { if (ret == ApplicationConstant.ResponseStatus.THANH_CONG) { msg = "S#" + LanguageNode.GetValueMessageLanguage("M.DungChung.ThemThanhCong"); if (multiAdd) { } else if (!DatabaseConstant.CLOSE_DETAIL_FORM) { } else { } } else { msg = "E#" + LanguageNode.GetValueMessageLanguage(responseMessage); } }
/// <summary> /// Xóa dữ liệu /// </summary> private void OnDelete(ref string msg, int id) { QuanTriHeThongProcess process = new QuanTriHeThongProcess(); int[] arrayID = new int[0]; try { Array.Resize(ref arrayID, arrayID.Length + 1); arrayID[arrayID.Length - 1] = id; List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>(); bool ret = process.XoaListNHNSD(arrayID, ref listClientResponseDetail); AfterDelete(ref msg, id, ret, listClientResponseDetail); } catch (Exception ex) { msg = LanguageNode.GetValueMessageLanguage(ex.Message); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } }
/// <summary> /// Trước khi sửa /// </summary> public JsonResult BeforeModifyNsd(int id) { string msg = ""; // Yêu cầu lock bản ghi cần sửa UtilitiesProcess process = new UtilitiesProcess(); List <int> listLockId = new List <int>(); listLockId.Add(id); bool ret = process.LockData(DatabaseConstant.Module.QTHT, DatabaseConstant.Function.HT_NSD, DatabaseConstant.Table.HT_NSD, DatabaseConstant.Action.SUA, listLockId); // Nếu lock thành công >> cho phép sửa if (!ret) { msg = LanguageNode.GetValueMessageLanguage("M.ResponseMessage.Common.LockDataInvalid"); } return(Json(msg.IsNullOrEmpty() ? Common.ResultJson.Success.LayMa() : msg, JsonRequestBehavior.AllowGet)); }
public static SemanticError InvalidFieldAccess(string identifier, string fieldIdentifier, LanguageNode node) { return new SemanticError(node) { Message = string.Format("{0} does not contain a definition for '{1}'.", identifier, fieldIdentifier), }; }
public static SemanticError InvalidUseOfOperator(LanguageNode node) { return new SemanticError(node) { Message = string.Format("Invalid use of '{0}' operator with a non-valued expression at line {1}.", node, node.Line), }; }
public static SemanticError UndefinedVariableType(string text, LanguageNode node) { return new SemanticError(node) { Message = string.Format("The actual variable type of {0} cann't be determined.", text), }; }
public RetValLessRecognizer(LanguageNode Parent, IExprRecognizer[] RunBefore = null) : base(Parent) { this.RunBefore = RunBefore; }
public TestScopeRecognizer(LanguageNode Parent) : base(Parent) { NewLineRight = Operators = new string[] { "testscope" }; }
public GenericRecognizer(LanguageNode Parent) : base(Parent) { NewLineRight = new string[] { "<" }; NewLineLeft = new string[] { "<", ">" }; }
internal static SemanticError DontReturnExpression(string statement, LanguageNode node) { return new SemanticError(node) { Message = string.Format("{0} used with an expression with return value at line {1}.", statement, node.Line), }; }
internal static SemanticError WrongParameterNumber(string type,string name, int formalCount, int actualCount, LanguageNode node) { return new SemanticError(node) { Message = string.Format("{0} '{1}' takes {2} arguments, got {3} instead", type, name, formalCount, actualCount), }; }
internal static SemanticError WrongType(string actualType, string formalType, LanguageNode node) { return new SemanticError(node) { Message = string.Format("Cannot implicitly convert type '{0}' to '{1}'", formalType, actualType), }; }
internal static SemanticError WrongBreak(LanguageNode node) { return new SemanticError(node) { Message = string.Format("break used out of a while or for statement at line {0}.", node.Line), }; }
internal static SemanticError UndefinedVariableUsed(string name, LanguageNode node) { return new SemanticError(node) { Message = string.Format("Undefined variable '{0}' at line {1}.", name, node.Line), }; }
internal static SemanticError InvalidNumber(string literal, LanguageNode node) { return new SemanticError(node) { Message = string.Format("'{0}' is not a valid number.", literal), }; }
public static SemanticError InvalidForExpression(string expr, LanguageNode node) { return new SemanticError(node) { Message = string.Format("The expression for the {0} bound of the for loop at line {1} does not return an int value.", expr, node.Line), }; }
public BracketRecognizer(LanguageNode Parent, GenericBracketSkipOptions GenericBracketSkipMode = new GenericBracketSkipOptions()) : base(Parent) { this.GenericBracketSkipOptions = GenericBracketSkipMode; }
public static SemanticError TypeNotDefined(string name, LanguageNode node) { return new SemanticError(node) { Message = string.Format("Type '{0}' does not exist.", name), }; }
public static SemanticError TypeNotVisible(string name, LanguageNode node) { return new SemanticError(node) { Message = string.Format("The type '{0}' is not visible at this point.", name), }; }
public BracketGroupRecognizer(LanguageNode Parent, char BracketLeft = '{', char BracketRight = '}') : base(Parent) { }
public static SemanticError StandardFunctionDeclaration(string text, LanguageNode node) { return new SemanticError(node) { Message = string.Format("Routin {0} is defined as a standard function.", text), }; }
public ExprIdRecognizer(LanguageNode Parent) : base(Parent) { }
public static SemanticError ReadOnlyAssing(string varName, LanguageNode node) { return new SemanticError(node) { Message = string.Format("Invalid use of assignment to the readonly variable {0} at line {1}.", varName, node.Line), }; }
public CheckedUncExprRecognizer(LanguageNode Parent) : base(Parent) { Operators = new string[] { "checked", "unchecked" }; NewLineRight = Operators; }
public static SemanticError ProcedureDontReturn(string functionId, LanguageNode node) { return new SemanticError(node) { Message = string.Format("Routin '{0}' is defined as a procedure and return a value.", functionId), }; }
public static SemanticError NonValuedAssignation(LanguageNode node) { return new SemanticError(node) { Message = string.Format("Initialization expression doesn't return a value at line {0}.", node.Line), }; }
public static SemanticError InvalidWileCondition(LanguageNode node) { return new SemanticError(node) { Message = string.Format("Invalid type of condition of the while statement at line {0}", node.Line), }; }
public static SemanticError WrongAliasDeclaration(string definedType, LanguageNode node) { return new SemanticError(node) { Message = string.Format("The type {0} is an invalid alias .", definedType), }; }
public static SemanticError VariableOrConstantUsedAsFunction(string name, LanguageNode node) { return new SemanticError(node) { Message = string.Format("Variable or constant '{0}' is being used as a function", name), }; }
/// <summary> /// This constructor is never called by the framework, only by you when creating the prototype. /// that's why we can set the LanguageNode as static. /// </summary> public UserController(TemplateManager mgr, LanguageNode modelLanguage) : base(mgr, modelLanguage) { DefaultMethod = "Main"; }
public static SemanticError WrongFieldInit(string recordName,string fieldName, LanguageNode node) { return new SemanticError(node) { Message = string.Format("{0}' is missing in the init of '{1}'.", fieldName, recordName), }; }