public SOARolePropertyDefinitionCollection LoadByRoleID(string roleID) { roleID.CheckStringIsNullOrEmpty("roleID"); string sql = string.Format("SELECT * FROM WF.ROLE_PROPERTIES_DEFINITIONS WHERE {0} ORDER BY SORT_ORDER", roleID.ToRoleIDCriteria()); using (TransactionScope scope = TransactionScopeFactory.Create(TransactionScopeOption.Suppress)) { DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0]; SOARolePropertyDefinitionCollection result = new SOARolePropertyDefinitionCollection(); foreach (DataRow row in table.Rows) { SOARolePropertyDefinition property = new SOARolePropertyDefinition(); ORMapping.DataRowToObject(row, property); result.Add(property); } return result; } }
public WfApprovalMatrix ClientToServer(WfClientApprovalMatrix client, ref WfApprovalMatrix server) { client.NullCheck("client"); if (server == null) { server = new WfApprovalMatrix(); } server.ID = client.ID; foreach (WfClientRolePropertyDefinition cpd in client.PropertyDefinitions) { SOARolePropertyDefinition spd = null; WfClientRolePropertyDefinitionConverter.Instance.ClientToServer(cpd, ref spd); server.PropertyDefinitions.Add(spd); } foreach (WfClientRolePropertyRow cRow in client.Rows) { SOARolePropertyRow sRow = null; WfClientRolePropertyRowConverter.Instance.ClientToServer(cRow, server.PropertyDefinitions, ref sRow); server.Rows.Add(sRow); } return(server); }
public override void ClientToServer(WfClientResourceDescriptor client, ref WfResourceDescriptor server) { client.NullCheck("client"); if (server == null) { server = new WfActivityMatrixResourceDescriptor(); } WfActivityMatrixResourceDescriptor amr = (WfActivityMatrixResourceDescriptor)server; WfClientActivityMatrixResourceDescriptor cmr = (WfClientActivityMatrixResourceDescriptor)client; amr.ExternalMatrixID = cmr.ExternalMatrixID; foreach (WfClientRolePropertyDefinition cpd in cmr.PropertyDefinitions) { SOARolePropertyDefinition spd = null; WfClientRolePropertyDefinitionConverter.Instance.ClientToServer(cpd, ref spd); amr.PropertyDefinitions.Add(spd); } foreach (WfClientRolePropertyRow cRow in cmr.Rows) { SOARolePropertyRow sRow = null; WfClientRolePropertyRowConverter.Instance.ClientToServer(cRow, amr.PropertyDefinitions, ref sRow); amr.Rows.Add(sRow); } }
public static void AreSame(this SOARolePropertyDefinition expected, SOARolePropertyDefinition actual) { AssertStringEqual(expected.Name, actual.Name); Assert.AreEqual(expected.DataType, actual.DataType); AssertStringEqual(expected.Caption, actual.Caption); Assert.AreEqual(expected.SortOrder, actual.SortOrder); Assert.AreEqual(expected.DefaultValue, actual.DefaultValue); }
private static void FillColumnInfoToRowValues(SOARolePropertyDefinitionCollection columns, SOARolePropertyRowCollection rows) { foreach (SOARolePropertyRow row in rows) { foreach (SOARolePropertyValue pv in row.Values) { SOARolePropertyDefinition column = columns[pv.Column.Name]; pv.SetColumnInfo(column); } } }
public WfClientRolePropertyDefinition ServerToClient(SOARolePropertyDefinition server, ref WfClientRolePropertyDefinition client) { server.NullCheck("server"); if (client == null) client = new WfClientRolePropertyDefinition(); client.Name = server.Name; client.Caption = server.Caption; client.DataType = server.DataType; client.DefaultValue = server.DefaultValue; client.SortOrder = server.SortOrder; client.Description = server.Description; return client; }
public SOARolePropertyDefinition ClientToServer(WfClientRolePropertyDefinition client, ref SOARolePropertyDefinition server) { client.NullCheck("client"); if (server == null) server = new SOARolePropertyDefinition(); server.Name = client.Name; server.Caption = client.Caption; server.DataType = client.DataType; server.DefaultValue = client.DefaultValue; server.SortOrder = client.SortOrder; server.Description = client.Description; return server; }
public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer) { SOARolePropertyDefinition pv = new SOARolePropertyDefinition(); //ColumnDefinitionBase pv.Caption = DictionaryHelper.GetValue(dictionary, "caption", string.Empty); pv.Name = DictionaryHelper.GetValue(dictionary, "name", string.Empty); pv.DataType = DictionaryHelper.GetValue(dictionary, "dataType", ColumnDataType.String); pv.DefaultValue = DictionaryHelper.GetValue(dictionary, "defaultValue", (string)null); //SOARolePropertyDefinition pv.RoleID = DictionaryHelper.GetValue(dictionary, "roleID", string.Empty); pv.SortOrder = DictionaryHelper.GetValue(dictionary, "sortOrder", 0); pv.Description = DictionaryHelper.GetValue(dictionary, "description", string.Empty); return(pv); }
public WfClientRolePropertyDefinition ServerToClient(SOARolePropertyDefinition server, ref WfClientRolePropertyDefinition client) { server.NullCheck("server"); if (client == null) { client = new WfClientRolePropertyDefinition(); } client.Name = server.Name; client.Caption = server.Caption; client.DataType = server.DataType; client.DefaultValue = server.DefaultValue; client.SortOrder = server.SortOrder; client.Description = server.Description; return(client); }
public SOARolePropertyValue ClientToServer(WfClientRolePropertyValue client, SOARolePropertyDefinitionCollection serverColumns, ref SOARolePropertyValue server) { client.NullCheck("client"); serverColumns.NullCheck("serverColumns"); if (server == null) { SOARolePropertyDefinition serverColumn = serverColumns[client.Column.Name]; serverColumn.NullCheck("serverColumn"); server = new SOARolePropertyValue(serverColumn); } server.Value = client.Value; return(server); }
public SOARolePropertyDefinition ClientToServer(WfClientRolePropertyDefinition client, ref SOARolePropertyDefinition server) { client.NullCheck("client"); if (server == null) { server = new SOARolePropertyDefinition(); } server.Name = client.Name; server.Caption = client.Caption; server.DataType = client.DataType; server.DefaultValue = client.DefaultValue; server.SortOrder = client.SortOrder; server.Description = client.Description; return(server); }
public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); SOARolePropertyDefinition pd = (SOARolePropertyDefinition)obj; //ColumnDefinitionBase DictionaryHelper.AddNonDefaultValue(dictionary, "caption", pd.Caption); DictionaryHelper.AddNonDefaultValue(dictionary, "name", pd.Name); DictionaryHelper.AddNonDefaultValue(dictionary, "dataType", pd.DataType); DictionaryHelper.AddNonDefaultValue(dictionary, "defaultValue", pd.DefaultValue); //SOARolePropertyDefinition DictionaryHelper.AddNonDefaultValue(dictionary, "roleID", pd.RoleID); DictionaryHelper.AddNonDefaultValue(dictionary, "sortOrder", pd.SortOrder); DictionaryHelper.AddNonDefaultValue(dictionary, "description", pd.Description); return(dictionary); }
private static bool IsQueryableColumn(SOARolePropertyDefinition pd, SOARolePropertyDefinitionCollection propertyDefines) { bool isReservered = true; switch (propertyDefines.MatrixType) { case WfMatrixType.RoleMatrix: isReservered = SOARolePropertyDefinition.IsRoleMatrixReservedPropertyName(pd.Name); break; case WfMatrixType.ActivityMatrix: isReservered = SOARolePropertyDefinition.IsActivityMatrixReservedPropertyName(pd.Name); break; } return isReservered == false; }
private static void ProcessActivityPropertyByRoleJsonProperty(WfCreateActivityParam cap, SOARolePropertyRow row, SOARolePropertyDefinition pd) { string json = row.Values.GetValue(pd.Name, row.GetPropertyDefinitions().GetColumnDefaultValue(pd.Name, string.Empty)); if (json.IsNotEmpty()) { Dictionary <string, object> data = JSONSerializerExecute.Deserialize <Dictionary <string, object> >(json); foreach (KeyValuePair <string, object> kp in data) { cap.Template.Properties.TrySetValue(kp.Key, kp.Value); //ydz 2013-2-18 解决活动矩阵定义的属性优先于活动模板定义的属性 cap.RoleDefineActivityPropertyNames.Add(kp.Key); } } }
/// <summary> /// 根据带Activity前缀的Role的属性名称,初始化Activity的属性值 /// </summary> /// <param name="cap"></param> /// <param name="row"></param> /// <param name="pd"></param> private static void ProcessActivityPropertyByRoleProperty(WfCreateActivityParam cap, SOARolePropertyRow row, SOARolePropertyDefinition pd) { const string prefixName = "Activity"; if (pd.Name.IndexOf(prefixName, StringComparison.OrdinalIgnoreCase) == 0) { string actPropertyName = pd.Name.Substring(prefixName.Length); string propertyValue = row.Values.GetValue(pd.Name, row.GetPropertyDefinitions().GetColumnDefaultValue(pd.Name, string.Empty)); cap.Template.Properties.TrySetValue(actPropertyName, propertyValue); cap.RoleDefineActivityPropertyNames.Add(actPropertyName); } }
/// <summary> /// 从上下文和流程中得到值 /// </summary> /// <param name="pd"></param> /// <param name="process"></param> /// <returns></returns> private static object GetQueryValueFromContext(SOARolePropertyDefinition pd, IWfProcess process) { WfApplicationParametersContext apContext = WfApplicationParametersContext.Current; object arpValue = null; if (apContext != null) arpValue = apContext.ApplicationRuntimeParameters.GetValue(pd.Name, (string)null); if (arpValue == null && process != null) arpValue = process.ApplicationRuntimeParameters.GetValueRecursively(pd.Name, (string)null); return arpValue; }
public static void AreSame(this SOARolePropertyDefinition expected, SOARolePropertyDefinition actual) { AssertStringEqual(expected.Name, actual.Name); Assert.AreEqual(expected.DataType, actual.DataType); AssertStringEqual(expected.Caption, actual.Caption); Assert.AreEqual(expected.SortOrder, actual.SortOrder); Assert.AreEqual(expected.DefaultValue, actual.DefaultValue); }