public override void ServerToClient(WfResourceDescriptor server, ref WfClientResourceDescriptor client) { server.NullCheck("server"); if (client == null) { client = new WfClientActivityMatrixResourceDescriptor(); } WfClientActivityMatrixResourceDescriptor cmr = (WfClientActivityMatrixResourceDescriptor)client; WfActivityMatrixResourceDescriptor amr = (WfActivityMatrixResourceDescriptor)server; cmr.ExternalMatrixID = amr.ExternalMatrixID; foreach (SOARolePropertyDefinition spd in amr.PropertyDefinitions) { WfClientRolePropertyDefinition cpd = null; WfClientRolePropertyDefinitionConverter.Instance.ServerToClient(spd, ref cpd); cmr.PropertyDefinitions.Add(cpd); } foreach (SOARolePropertyRow sRow in amr.Rows) { WfClientRolePropertyRow cRow = null; WfClientRolePropertyRowConverter.Instance.ServerToClient(sRow, cmr.PropertyDefinitions, ref cRow); cmr.Rows.Add(cRow); } }
public WfClientApprovalMatrix ServerToClient(WfApprovalMatrix server, ref WfClientApprovalMatrix client) { server.NullCheck("server"); if (client == null) { client = new WfClientApprovalMatrix(); } client.ID = server.ID; foreach (SOARolePropertyDefinition spd in server.PropertyDefinitions) { WfClientRolePropertyDefinition cpd = null; WfClientRolePropertyDefinitionConverter.Instance.ServerToClient(spd, ref cpd); client.PropertyDefinitions.Add(cpd); } foreach (SOARolePropertyRow sRow in server.Rows) { WfClientRolePropertyRow cRow = null; WfClientRolePropertyRowConverter.Instance.ServerToClient(sRow, client.PropertyDefinitions, ref cRow); client.Rows.Add(cRow); } return(client); }
public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer) { WfClientRolePropertyRow row = new WfClientRolePropertyRow(); row.RowNumber = dictionary.GetValue("rowNumber", 0); row.Operator = dictionary.GetValue("operator", string.Empty); row.OperatorType = dictionary.GetValue("operatorType", WfClientRoleOperatorType.User); JSONSerializerExecute.FillDeserializedCollection(dictionary["values"], row.Values); return(row); }
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer) { WfClientRolePropertyRow row = new WfClientRolePropertyRow(); row.RowNumber = dictionary.GetValue("rowNumber", 0); row.Operator = dictionary.GetValue("operator", string.Empty); row.OperatorType = dictionary.GetValue("operatorType", WfClientRoleOperatorType.User); JSONSerializerExecute.FillDeserializedCollection(dictionary["values"], row.Values); return row; }
public static void AreSame(this WfClientRolePropertyRow expected, SOARolePropertyRow actual) { AssertStringEqual(expected.Operator, actual.Operator); Assert.AreEqual(expected.OperatorType, actual.OperatorType.ToClientRoleOperatorType()); Assert.AreEqual(expected.RowNumber, actual.RowNumber); foreach (WfClientRolePropertyValue pve in expected.Values) { string actualValue = actual.Values.GetValue(pve.Column.Name, string.Empty); AssertStringEqual(pve.Value, actualValue); } }
public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); WfClientRolePropertyRow row = (WfClientRolePropertyRow)obj; dictionary.AddNonDefaultValue("rowNumber", row.RowNumber); dictionary.AddNonDefaultValue("operatorType", row.OperatorType); dictionary.AddNonDefaultValue("operator", row.Operator); dictionary["values"] = JSONSerializerExecute.Serialize(row.Values); return(dictionary); }
private static WfClientRolePropertyRowCollection PrepareClientRows(WfClientRolePropertyDefinitionCollection pds) { WfClientRolePropertyRowCollection rows = new WfClientRolePropertyRowCollection(); WfClientRolePropertyRow row1 = new WfClientRolePropertyRow() { RowNumber = 1, OperatorType = WfClientRoleOperatorType.User, Operator = "fanhy" }; row1.Values.Add(new WfClientRolePropertyValue(pds["CostCenter"]) { Value = "1001" }); row1.Values.Add(new WfClientRolePropertyValue(pds["PayMethod"]) { Value = "1" }); row1.Values.Add(new WfClientRolePropertyValue(pds["Age"]) { Value = "30" }); WfClientRolePropertyRow row2 = new WfClientRolePropertyRow() { RowNumber = 2, OperatorType = WfClientRoleOperatorType.User, Operator = "wangli5" }; row2.Values.Add(new WfClientRolePropertyValue(pds["CostCenter"]) { Value = "1002" }); row2.Values.Add(new WfClientRolePropertyValue(pds["PayMethod"]) { Value = "2" }); row2.Values.Add(new WfClientRolePropertyValue(pds["Age"]) { Value = "40" }); rows.Add(row1); rows.Add(row2); return(rows); }
public WfClientRolePropertyRow ServerToClient(SOARolePropertyRow server, WfClientRolePropertyDefinitionCollection clientColumns, ref WfClientRolePropertyRow client) { server.NullCheck("server"); if (client == null) client = new WfClientRolePropertyRow(); client.RowNumber = server.RowNumber; client.Operator = server.Operator; client.OperatorType = server.OperatorType.ToClientRoleOperatorType(); foreach (SOARolePropertyValue spv in server.Values) { WfClientRolePropertyValue cpv = null; WfClientRolePropertyValueConverter.Instance.ServerToClient(spv, clientColumns, ref cpv); client.Values.Add(cpv); } return client; }
public SOARolePropertyRow ClientToServer(WfClientRolePropertyRow client, SOARolePropertyDefinitionCollection serverColumns, ref SOARolePropertyRow server) { client.NullCheck("client"); if (server == null) server = new SOARolePropertyRow(); server.RowNumber = client.RowNumber; server.Operator = client.Operator; server.OperatorType = client.OperatorType.ToRoleOperatorType(); foreach (WfClientRolePropertyValue cpv in client.Values) { SOARolePropertyValue spv = null; WfClientRolePropertyValueConverter.Instance.ClientToServer(cpv, serverColumns, ref spv); server.Values.Add(spv); } return server; }
public WfClientRolePropertyRow ServerToClient(SOARolePropertyRow server, WfClientRolePropertyDefinitionCollection clientColumns, ref WfClientRolePropertyRow client) { server.NullCheck("server"); if (client == null) { client = new WfClientRolePropertyRow(); } client.RowNumber = server.RowNumber; client.Operator = server.Operator; client.OperatorType = server.OperatorType.ToClientRoleOperatorType(); foreach (SOARolePropertyValue spv in server.Values) { WfClientRolePropertyValue cpv = null; WfClientRolePropertyValueConverter.Instance.ServerToClient(spv, clientColumns, ref cpv); client.Values.Add(cpv); } return(client); }
public SOARolePropertyRow ClientToServer(WfClientRolePropertyRow client, SOARolePropertyDefinitionCollection serverColumns, ref SOARolePropertyRow server) { client.NullCheck("client"); if (server == null) { server = new SOARolePropertyRow(); } server.RowNumber = client.RowNumber; server.Operator = client.Operator; server.OperatorType = client.OperatorType.ToRoleOperatorType(); foreach (WfClientRolePropertyValue cpv in client.Values) { SOARolePropertyValue spv = null; WfClientRolePropertyValueConverter.Instance.ClientToServer(cpv, serverColumns, ref spv); server.Values.Add(spv); } return(server); }
private static WfClientRolePropertyRowCollection PrepareClientRows(WfClientRolePropertyDefinitionCollection pds) { WfClientRolePropertyRowCollection rows = new WfClientRolePropertyRowCollection(); WfClientRolePropertyRow row1 = new WfClientRolePropertyRow() { RowNumber = 1, OperatorType = WfClientRoleOperatorType.User, Operator = "fanhy" }; row1.Values.Add(new WfClientRolePropertyValue(pds["CostCenter"]) { Value = "1001" }); row1.Values.Add(new WfClientRolePropertyValue(pds["PayMethod"]) { Value = "1" }); row1.Values.Add(new WfClientRolePropertyValue(pds["Age"]) { Value = "30" }); WfClientRolePropertyRow row2 = new WfClientRolePropertyRow() { RowNumber = 2, OperatorType = WfClientRoleOperatorType.User, Operator = "wangli5" }; row2.Values.Add(new WfClientRolePropertyValue(pds["CostCenter"]) { Value = "1002" }); row2.Values.Add(new WfClientRolePropertyValue(pds["PayMethod"]) { Value = "2" }); row2.Values.Add(new WfClientRolePropertyValue(pds["Age"]) { Value = "40" }); rows.Add(row1); rows.Add(row2); return rows; }
public static void AreSame(this WfClientRolePropertyRow expected, WfClientRolePropertyRow actual) { AssertStringEqual(expected.Operator, actual.Operator); Assert.AreEqual(expected.OperatorType, actual.OperatorType); Assert.AreEqual(expected.RowNumber, actual.RowNumber); foreach (WfClientRolePropertyValue pve in expected.Values) { string actualValue = actual.Values.GetValue(pve.Column.Name, string.Empty); AssertStringEqual(pve.Value, actualValue); } }
private static WfClientRolePropertyRowCollection PrepareClientRows(WfClientRolePropertyDefinitionCollection pds) { WfClientRolePropertyRowCollection rows = new WfClientRolePropertyRowCollection(); WfClientRolePropertyRow row1 = new WfClientRolePropertyRow() { RowNumber = 1, OperatorType = WfClientRoleOperatorType.User }; row1.Values.Add(new WfClientRolePropertyValue(pds["CostCenter"]) { Value = "1001" }); row1.Values.Add(new WfClientRolePropertyValue(pds["Approver1"]) { Value = "yangrui1" }); row1.Values.Add(new WfClientRolePropertyValue(pds["Approver2"]) { Value = "quym" }); row1.Values.Add(new WfClientRolePropertyValue(pds["Approver3"]) { Value = "liming" }); WfClientRolePropertyRow row2 = new WfClientRolePropertyRow() { RowNumber = 2, OperatorType = WfClientRoleOperatorType.User }; row2.Values.Add(new WfClientRolePropertyValue(pds["CostCenter"]) { Value = "1002" }); row2.Values.Add(new WfClientRolePropertyValue(pds["Approver1"]) { Value = string.Empty }); row2.Values.Add(new WfClientRolePropertyValue(pds["Approver2"]) { Value = "quym" }); row2.Values.Add(new WfClientRolePropertyValue(pds["Approver3"]) { Value = "liming" }); WfClientRolePropertyRow row3 = new WfClientRolePropertyRow() { RowNumber = 3, OperatorType = WfClientRoleOperatorType.User }; row3.Values.Add(new WfClientRolePropertyValue(pds["CostCenter"]) { Value = "1003" }); row3.Values.Add(new WfClientRolePropertyValue(pds["Approver1"]) { Value = string.Empty }); row3.Values.Add(new WfClientRolePropertyValue(pds["Approver2"]) { Value = string.Empty }); row3.Values.Add(new WfClientRolePropertyValue(pds["Approver3"]) { Value = "liming" }); WfClientRolePropertyRow row4 = new WfClientRolePropertyRow() { RowNumber = 4, OperatorType = WfClientRoleOperatorType.User }; row4.Values.Add(new WfClientRolePropertyValue(pds["CostCenter"]) { Value = "1003" }); row4.Values.Add(new WfClientRolePropertyValue(pds["Approver1"]) { Value = "yangrui1" }); row4.Values.Add(new WfClientRolePropertyValue(pds["Approver2"]) { Value = string.Empty }); row4.Values.Add(new WfClientRolePropertyValue(pds["Approver3"]) { Value = "liming" }); rows.Add(row1); rows.Add(row2); rows.Add(row3); rows.Add(row4); return rows; }
private static WfClientRolePropertyRowCollection PrepareClientRows(WfClientRolePropertyDefinitionCollection pds) { WfClientRolePropertyRowCollection rows = new WfClientRolePropertyRowCollection(); WfClientRolePropertyRow row1 = new WfClientRolePropertyRow() { RowNumber = 1, OperatorType = WfClientRoleOperatorType.User }; row1.Values.Add(new WfClientRolePropertyValue(pds["CostCenter"]) { Value = "1001" }); row1.Values.Add(new WfClientRolePropertyValue(pds["Approver1"]) { Value = "yangrui1" }); row1.Values.Add(new WfClientRolePropertyValue(pds["Approver2"]) { Value = "quym" }); row1.Values.Add(new WfClientRolePropertyValue(pds["Approver3"]) { Value = "liming" }); WfClientRolePropertyRow row2 = new WfClientRolePropertyRow() { RowNumber = 2, OperatorType = WfClientRoleOperatorType.User }; row2.Values.Add(new WfClientRolePropertyValue(pds["CostCenter"]) { Value = "1002" }); row2.Values.Add(new WfClientRolePropertyValue(pds["Approver1"]) { Value = string.Empty }); row2.Values.Add(new WfClientRolePropertyValue(pds["Approver2"]) { Value = "quym" }); row2.Values.Add(new WfClientRolePropertyValue(pds["Approver3"]) { Value = "liming" }); WfClientRolePropertyRow row3 = new WfClientRolePropertyRow() { RowNumber = 3, OperatorType = WfClientRoleOperatorType.User }; row3.Values.Add(new WfClientRolePropertyValue(pds["CostCenter"]) { Value = "1003" }); row3.Values.Add(new WfClientRolePropertyValue(pds["Approver1"]) { Value = string.Empty }); row3.Values.Add(new WfClientRolePropertyValue(pds["Approver2"]) { Value = string.Empty }); row3.Values.Add(new WfClientRolePropertyValue(pds["Approver3"]) { Value = "liming" }); WfClientRolePropertyRow row4 = new WfClientRolePropertyRow() { RowNumber = 4, OperatorType = WfClientRoleOperatorType.User }; row4.Values.Add(new WfClientRolePropertyValue(pds["CostCenter"]) { Value = "1003" }); row4.Values.Add(new WfClientRolePropertyValue(pds["Approver1"]) { Value = "yangrui1" }); row4.Values.Add(new WfClientRolePropertyValue(pds["Approver2"]) { Value = string.Empty }); row4.Values.Add(new WfClientRolePropertyValue(pds["Approver3"]) { Value = "liming" }); rows.Add(row1); rows.Add(row2); rows.Add(row3); rows.Add(row4); return(rows); }