public ResultOperation Update(Guid?processID, Guid?applicationPageID, string name, int varTypeLU, Guid?entityDefID, string fieldName, string query, int?filterTypeLU, string collection, Guid?dbConnectionID, string defaultValue, string whereClause, string orderByClause) { this.ProcessID = processID; this.ApplicationPageID = applicationPageID; this.Name = name; this.VarTypeLU = varTypeLU; this.EntityDefID = entityDefID; this.FieldName = fieldName; this.Query = query; if (RelationTypeLU == (int)sysBpmsVariable.e_RelationTypeLU.Entity) { this.FilterTypeLU = applicationPageID.HasValue ? (int)sysBpmsVariable.e_FilterTypeLU.AllEntities : filterTypeLU; } this.DBConnectionID = dbConnectionID; this.Collection = collection; this.DefaultValue = defaultValue; this.WhereClause = whereClause; this.OrderByClause = orderByClause; ResultOperation resultOperation = new ResultOperation(this); if (string.IsNullOrWhiteSpace(this.Name)) { resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsVariable.Name), nameof(sysBpmsVariable))); } switch ((sysBpmsVariable.e_RelationTypeLU) this.RelationTypeLU) { case sysBpmsVariable.e_RelationTypeLU.Entity: if (this.VarTypeLU != (int)sysBpmsVariable.e_VarTypeLU.Object && this.VarTypeLU != (int)sysBpmsVariable.e_VarTypeLU.List && string.IsNullOrWhiteSpace(this.FieldName)) { resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsVariable.FieldName), nameof(sysBpmsVariable))); } break; case sysBpmsVariable.e_RelationTypeLU.SqlQuery: if (string.IsNullOrWhiteSpace(this.Query)) { resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsVariable.Query), nameof(sysBpmsVariable))); } break; case sysBpmsVariable.e_RelationTypeLU.Local: if (this.VarTypeLU == (int)sysBpmsVariable.e_VarTypeLU.List && !this.Items.Any()) { resultOperation.AddError(LangUtility.Get("AtleastOneItem.Text", nameof(sysBpmsVariable))); } if (this.VarTypeLU == (int)sysBpmsVariable.e_VarTypeLU.List && this.Items.Any(c => string.IsNullOrWhiteSpace(c.Key) || string.IsNullOrWhiteSpace(c.Text))) { resultOperation.AddError(LangUtility.Get("AllItemError.Text", nameof(sysBpmsVariable))); } break; } return(resultOperation); }
public ResultOperation Update(string designJson) { this.DesignJson = designJson; ResultOperation resultOperation = new ResultOperation(); if (this.DesignJson != null && this.DesignJson.LastIndexOf("\"subtype\":\"threadTaskDescription\"") != this.DesignJson.IndexOf("\"subtype\":\"threadTaskDescription\"")) { resultOperation.AddError(LangUtility.Get("DescriptionError.Text", nameof(sysBpmsDynamicForm))); } return(resultOperation); }
public ResultOperation Update(string name, bool isActive, List <MessageTypeParamsModel> paramsXML) { paramsXML = paramsXML?.Where(c => !string.IsNullOrWhiteSpace(c.Name)).ToList(); ResultOperation resultOperation = new ResultOperation(); this.Name = name; this.IsActive = isActive; this.ParamsXML = paramsXML.BuildXml() ?? ""; if (paramsXML?.GroupBy(c => c.Name).Any(c => c.Count() > 1) ?? false) { resultOperation.AddError(LangUtility.Get("SameName.Text", nameof(sysBpmsMessageType))); } return(resultOperation); }
public static string GetDescription(this Enum e) { if (e == null) { return(""); } try { var type = e.GetType(); var memInfo = type.GetMember(e.ToString()); var attributes = memInfo[0].GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false); var description = ((System.ComponentModel.DescriptionAttribute)attributes[0]).Description; //for resx and multilanguages string resxName = LangUtility.Get(e.GetType().Name + "." + description + ".Text", e.GetType().FullName.Split('+')[0].Split('.').LastOrDefault()); return(string.IsNullOrWhiteSpace(resxName) ? description : resxName); } catch { } return(""); }
public static string Get(string name, string modelName) { return(Localization.GetString(name, LangUtility.GetResx(modelName))); }
public ResultOperation Update(string displayName, string name, string designXML, bool isActive, List <EntityPropertyModel> properties) { this.DisplayName = displayName; if (this.ID == Guid.Empty) { this.Name = name.ToStringObj().Trim(); } this.DesignXML = designXML; this.IsActive = isActive; this.Properties = properties; ResultOperation resultOperation = new ResultOperation(this); if ((this.Properties == null || !this.Properties.Any())) { resultOperation.AddError(LangUtility.Get("AtLeastOnePropert.Text", nameof(sysBpmsEntityDef))); } if (this.Name.ToLower().StartsWith("sys") || this.Name.ToLower().EndsWith("model") || this.Name.ToLower().EndsWith("vm") || this.Name.ToLower().EndsWith("html")) { resultOperation.AddError(LangUtility.Get("NameError.Text", nameof(sysBpmsEntityDef))); } foreach (var Item in this.Properties) { Item.Name = Item.Name.ToStringObj().Trim(); if (string.IsNullOrWhiteSpace(Item.Name)) { resultOperation.AddError(SharedLang.GetReuired("PropertyName.Text", nameof(sysBpmsEntityDef))); } if (Item.Name.ToLower() == "id" || Item.Name.ToLower() == "variablename" || Item.Name.ToLower() == this.Name || Item.Name.ToLower().Contains(".") || Item.Name.ToLower().Contains("__")) { resultOperation.AddError(LangUtility.Get("PropertyNameError.Text", nameof(sysBpmsEntityDef))); } if (Item.IsActive && this.Properties.Any(c => c.ID != Item.ID && c.Name == Item.Name)) { resultOperation.AddError(LangUtility.Get("SameProperty.Text", nameof(sysBpmsEntityDef))); } } if (string.IsNullOrWhiteSpace(this.DisplayName)) { resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsEntityDef.DisplayName), nameof(sysBpmsEntityDef))); } if (string.IsNullOrWhiteSpace(this.Name)) { resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsEntityDef.Name), nameof(sysBpmsEntityDef))); } if (this.Name.Split(' ').Count() > 1 || this.Name.Contains("-")) { resultOperation.AddError("Name is not valid (do not use space or - in your name)"); } return(resultOperation); }
public static string GetReuired(string name, string modelName) { return(string.Format(SharedLang.Get("FormatRequired.Text"), LangUtility.Get(name, modelName))); }