本文整理汇总了C#中DataObject类的典型用法代码示例。如果您正苦于以下问题:C# DataObject类的具体用法?C# DataObject怎么用?C# DataObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataObject类属于命名空间,在下文中一共展示了DataObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RetrievePassword
public RegisterDataObject RetrievePassword(DataObject.RegisterDataObject userData)
{
try
{
DataObject.RegisterDataObject Password = BusinessLayer.Accounts.Retrieve(userData);
if (string.IsNullOrEmpty(Password.Password))
{
return new RegisterDataObject();
}
else
{
RegisterDataObject Data = new RegisterDataObject();
Data.AutoId = Password.AutoId;
Data.ConfirmPassword = Password.ConfirmPassword;
Data.EmailId = Password.EmailId;
Data.FullName = Password.FullName;
Data.Guid = Password.Guid;
Data.Password = Password.Password;
Data.UserName = Password.UserName;
return Data;
}
}
catch (Exception ex)
{
MyCustomErrorDetail Error = new MyCustomErrorDetail("Unexpected Error caused by " + ex.Source, ex.Message);
throw new WebFaultException<MyCustomErrorDetail>(Error, System.Net.HttpStatusCode.InternalServerError);
}
}
示例2: HandleCompletion
/// <summary>
/// Hande task completion with task output data passed as NameValueCollection
/// </summary>
/// <param name="correlationId"></param>
/// <param name="taskOutputData"></param>
private void HandleCompletion(string correlationId, NameValueCollection taskOutputData)
{
try
{
IApplicationContext ctx = Spring.Context.Support.ContextRegistry.GetContext();
INGEnvironment env = (INGEnvironment)ctx.GetObject("NGEnvironment");
IProcessPackageRepository pdr = (IProcessPackageRepository)ctx.GetObject("PackageRepository");
TaskInstanceInfo ti = env.GetTaskInstanceInfo(correlationId);
NG.ProcessDefinition pd = pdr.GetProcess(ti.ProcessDefinitionId);
NG.Task ntsk = pd.GetTask(ti.TaskId);
StructDef sd = ntsk.GetTaskOutputDataSchema();
DataObject completionData = new DataObject();
foreach (MemberDef md in sd.Members)
{
string s = taskOutputData[md.Name];
if (s != null)
{
completionData[md.Name] = s;
}
}
log.Info("Completing task {0} with data {1}", correlationId, completionData.ToString());
env.ReportTaskFinished(correlationId, completionData, Context.User.Identity.Name);
}
catch (Exception ex)
{
log.Error("Error completing task {0}: {1}", correlationId, ex);
throw;
}
}
示例3: DataTest
static void DataTest()
{
DataObject dob = new DataObject();
dob["ala"] = "ma kota";
dob["jola"] = "nie ma zielonego pojêcia";
dob["zenek"] = 35;
dob["dziœ"] = DateTime.Now;
dob["ala"] = "ju¿ nie ma kota";
dob["kot"] = new List<string>(new string[] { "skarpeta", "tiger", "filemon", "kuba" });
StringBuilder sb = new StringBuilder();
foreach (string k in dob.Keys)
{
log.Debug("{0}={1}", k, dob[k]);
}
DataObject dob2 = new DataObject((IDataObject) dob);
XmlWriter xw = XmlWriter.Create(sb);
dob2.ToXml("dob2", xw);
xw.Flush();
log.Debug("XML: {0}", sb.ToString());
string xml = "<?xml version=\"1.0\" ?><data id=\"11\"> <member1>aaa</member1> <member1>bbb</member1> <and>\n<otherData>tutaj</otherData>\n<more>...</more></and>\n<member3>\nsome\ntext</member3>\n</data>";
log.Debug("Parsing XML: {0}", xml);
StringReader sr = new StringReader(xml);
XmlReader xr = XmlReader.Create(sr);
xr.MoveToContent();
DataObject dob3 = DataObject.ParseXmlElement(xr);
log.Debug("Result: {0}", dob3.ToXmlString("dob3"));
}
示例4: ThrowsException
public void ThrowsException()
{
var dataObject1 = new DataObject
{
Name = "First"
};
var dataObject2 = new DataObject
{
Name = "Second",
Other = dataObject1
};
dataObject1.Other = dataObject2;
Assert.That(dataObject1.Other, Is.SameAs(dataObject2), "Sanity check");
Assert.That(dataObject2.Other, Is.SameAs(dataObject1), "Sanity check");
using (var ms = new MemoryStream())
{
Assert.That(
() => KVSerializer.Serialize(ms, dataObject1, "test data"),
Throws.Exception.InstanceOf<KeyValueException>()
.With.Message.EqualTo("Serialization failed - circular object reference detected."));
}
}
示例5: CastTo
public override DataObject CastTo(DataObject value, SqlType destType)
{
var bValue = ((SqlBoolean) value.Value);
if (destType is StringType) {
var s = Convert.ToString(bValue);
// TODO: Provide a method in StringType to build a string specific to the type
return new DataObject(destType, new SqlString(s));
}
if (destType is NumericType) {
SqlNumber num;
if (bValue == SqlBoolean.Null) {
num = SqlNumber.Null;
} else if (bValue) {
num = SqlNumber.One;
} else {
num = SqlNumber.Zero;
}
return new DataObject(destType, num);
}
if (destType is BinaryType) {
var bytes = (byte[]) Convert.ChangeType(bValue, typeof (byte[]), CultureInfo.InvariantCulture);
return new DataObject(destType, new SqlBinary(bytes));
}
if (destType is BooleanType)
return value;
return base.CastTo(value, destType);
}
示例6: createTestVirtualDocument
private void createTestVirtualDocument()
{
// create a new DataObject to use as the parent node
ObjectIdentity emptyIdentity = new ObjectIdentity(DefaultRepository);
DataObject parentDO = new DataObject(emptyIdentity);
parentDO.Type = "dm_document";
PropertySet parentProperties = new PropertySet();
parentProperties.Set("object_name", SampleContentManager.testVdmObjectName);
parentDO.Properties = parentProperties;
// link into a folder
ObjectPath objectPath = new ObjectPath(SampleContentManager.sourcePath);
ObjectIdentity sampleFolderIdentity = new ObjectIdentity(objectPath, DefaultRepository);
ReferenceRelationship sampleFolderRelationship = new ReferenceRelationship();
sampleFolderRelationship.Name = Relationship.RELATIONSHIP_FOLDER;
sampleFolderRelationship.Target = sampleFolderIdentity;
sampleFolderRelationship.TargetRole = Relationship.ROLE_PARENT;
parentDO.Relationships.Add(sampleFolderRelationship);
// get id of document to use for first child node
ObjectIdentity child0Id = new ObjectIdentity();
child0Id.RepositoryName = DefaultRepository;
child0Id.Value = new Qualification(SampleContentManager.gifImageQualString);
// get id of document to use for second child node
ObjectIdentity child1Id = new ObjectIdentity();
child1Id.RepositoryName = DefaultRepository;
child1Id.Value = new Qualification(SampleContentManager.gifImage1QualString);
ObjectIdentitySet childNodes = new ObjectIdentitySet();
childNodes.AddIdentity(child0Id);
childNodes.AddIdentity(child1Id);
virtualDocumentServiceDemo.AddChildNodes(parentDO, childNodes);
}
示例7: btnTest_Click
protected void btnTest_Click(object sender, EventArgs e)
{
if (ConfigXML.AccessAllow(NTT.Web.Core.Security.Cryto.MD5(this.txt_conf.Text)))
{
//ConfigXML.BuildConfigFile("tmpdbconfig.xml", this.Txt_Server.Text, this.txt_db.Text, this.txt_uid.Text, this.txt_pwd.Text);
StringBuilder sb = new StringBuilder();
sb.Append("Server=").Append(this.Txt_Server.Text).Append(";");
sb.Append("Database=").Append(this.txt_db.Text).Append(";");
//sb.Append("Integrated Security=SSPI;");
sb.Append("uid=").Append(this.txt_uid.Text).Append(";");
sb.Append("pwd=").Append(this.txt_pwd.Text).Append(";");
sb.Append("Connect Timeout=30");
string connection_string = sb.ToString();
DataObject con = new DataObject(connection_string, false);
try
{
if (con.TestConnection())
this.lb_mess.Text = "Kết nối thành công";
else
this.lb_mess.Text = "Không thể kết nối!!!";
}
catch (Exception E)
{
this.lb_mess.Text = E.Message;
}
}
else
{
this.lb_mess.Text = "Mật khẩu cấu hình không đúng";
}
}
示例8: AddChildNodes
public DataObject AddChildNodes(DataObject parentObject, ObjectIdentitySet childIdentities)
{
List<ObjectIdentity> idList = childIdentities.Identities;
List<VdmChildrenActionInfo> caInfoList = new List<VdmChildrenActionInfo>();
foreach (ObjectIdentity objIdentity in idList)
{
VirtualDocumentNode vdmNode = new VirtualDocumentNode();
vdmNode.Identity = objIdentity;
VirtualDocumentInfo vdmInfo = new VirtualDocumentInfo();
vdmInfo.Binding = VirtualDocumentInfo.BINDING_LATE;
vdmInfo.CopyBehavior = CopyBehaviorMode.COPY;
vdmInfo.OverrideLateBinding = false;
vdmNode.Policy = vdmInfo;
VdmChildrenActionInfo caInfo = new VdmChildrenActionInfo();
caInfo.Action = VdmChildrenAction.APPEND;
caInfo.Node = vdmNode;
caInfoList.Add(caInfo);
}
VdmUpdateProfile vdmUpdateProfile = new VdmUpdateProfile();
List<String> versionLabels = new List<String>();
versionLabels.Add("testVersionLabel");
// make sure to add the CURRENT label if you
// want the virtual document to be CURRENT
versionLabels.Add("CURRENT");
vdmUpdateProfile.Labels = versionLabels;
OperationOptions options = new OperationOptions();
options.VdmUpdateProfile = vdmUpdateProfile;
return virtualDocumentService.Update(parentObject, caInfoList, options);
}
示例9: Contains
public static DataObject Contains(DataObject geometry, DataObject other)
{
var g1 = (SqlGeometry) geometry.Value;
var g2 = (SqlGeometry) other.Value;
var result = Contains(g1, g2);
return DataObject.Boolean(result);
}
示例10: RegisterData
public static void RegisterData(DataObject.RegisterDataObject accountData)
{
MySqlConnection Connection = new MySqlConnection(ConnString);
try
{
Connection.Open();
MySqlCommand InsertCommand = new MySqlCommand("udsp_account_register", Connection);
InsertCommand.CommandType = CommandType.StoredProcedure;
Guid GuidId = Guid.NewGuid();
InsertCommand.Parameters.AddWithValue("var_Guid", GuidId.ToString());
InsertCommand.Parameters.AddWithValue("var_Username", accountData.UserName);
InsertCommand.Parameters.AddWithValue("var_Password", accountData.Password);
InsertCommand.Parameters.AddWithValue("var_FullName", accountData.FullName);
InsertCommand.Parameters.AddWithValue("var_EmailId", accountData.EmailId);
if (InsertCommand.ExecuteNonQuery() == 0)
throw new Exception("No person was registered");
}
catch (Exception ex)
{
throw ex;
}
finally
{
if(Connection.State== ConnectionState.Open)
{
Connection.Close();
}
}
}
示例11: ScriptManager
public ScriptManager(Application app)
{
_app = app;
_appObject = new AppObject(_app);
_dataObject = new DataObject(_app.Data);
}
示例12: Distance
public static DataObject Distance(DataObject geometry, DataObject other)
{
var input = (SqlGeometry)geometry.Value;
var otherGeometry = (SqlGeometry) other.Value;
var result = Distance(input, otherGeometry);
return DataObject.Number(result);
}
示例13: Initialization
public void Initialization()
{
object1 = new DataObject { Id = 1 };
object1.Add("x", 2);
object1.Add("y", 2);
object2 = new DataObject { Id = 2 };
object2.Add("x", 5);
object2.Add("y", 2);
object3 = new DataObject { Id = 3 };
object3.Add("x", 4);
object3.Add("y", 3);
object4 = new DataObject { Id = 4 };
object4.Add("x", 3);
object4.Add("y", 6);
object5 = new DataObject { Id = 5 };
object5.Add("x", 8);
object5.Add("y", 8);
object6 = new DataObject { Id = 6 };
object6.Add("x", 9);
object6.Add("y", 7);
}
示例14: GetValidationRules
public override IList<ValidationRule> GetValidationRules(DataObject current, string property)
{
IList<ValidationRule> rules = new List<ValidationRule>();
ValidationRule rule = new ValidationRule(GeneralAssertionTemplate.IsBusinessObjectNotNull(current, property));
rules.Add(rule);
return rules;
}
示例15: InsertVerticalNode
public void InsertVerticalNode(DataObject up, DataObject down)
{
Up = up;
Down = down;
down.Up = this;
up.Down = this;
}