本文整理汇总了C#中Domain类的典型用法代码示例。如果您正苦于以下问题:C# Domain类的具体用法?C# Domain怎么用?C# Domain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Domain类属于命名空间,在下文中一共展示了Domain类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateNewTask
public void CreateNewTask(string description, string userid, Domain.Socioboard.Domain.Tasks task, string assigntoId, string comment)
{
string descritption = description;
Guid idtoassign = Guid.Empty;
idtoassign = Guid.Parse(assigntoId);
Domain.Socioboard.Domain.Tasks objTask = task;
TaskRepository objTaskRepo = new TaskRepository();
objTask.AssignDate = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString();
objTask.AssignTaskTo = idtoassign;
objTask.TaskStatus = false;
objTask.TaskMessage = descritption;
objTask.UserId = Guid.Parse(userid);
Guid taskid = Guid.NewGuid();
objTask.Id = taskid;
objTaskRepo.addTask(objTask);
/////////////////
string Comment = comment;
if (!string.IsNullOrEmpty(comment))
{
string curdate = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString();
Domain.Socioboard.Domain.TaskComment objcmt = new Domain.Socioboard.Domain.TaskComment();
TaskCommentRepository objcmtRepo = new TaskCommentRepository();
objcmt.Comment = comment;
objcmt.CommentDate = DateTime.Now;
objcmt.EntryDate = DateTime.Now;
objcmt.Id = Guid.NewGuid();
objcmt.TaskId = objTask.Id;
objcmt.UserId = Guid.Parse(userid);
objcmtRepo.addTaskComment(objcmt);
}
}
示例2: Composites
public void Composites()
{
var metaPopulation = new MetaPopulation();
var domain = new Domain(metaPopulation, Guid.NewGuid());
var superdomain = new Domain(metaPopulation, Guid.NewGuid());
domain.AddDirectSuperdomain(superdomain);
Assert.AreEqual(0, metaPopulation.Composites.Count());
var @class = new ClassBuilder(domain, Guid.NewGuid()).WithSingularName("Class").WithPluralName("Classes").Build();
Assert.AreEqual(1, metaPopulation.Composites.Count());
var superclass = new ClassBuilder(superdomain, Guid.NewGuid()).WithSingularName("Superclass").WithPluralName("Superclasses").Build();
Assert.AreEqual(2, metaPopulation.Composites.Count());
var @interface = new InterfaceBuilder(domain, Guid.NewGuid()).WithSingularName("i1").WithPluralName("i1s").Build();
Assert.AreEqual(3, metaPopulation.Composites.Count());
var superinterface = new InterfaceBuilder(superdomain, Guid.NewGuid()).WithSingularName("i2").WithPluralName("i2s").Build();
Assert.AreEqual(4, metaPopulation.Composites.Count());
var unit = new UnitBuilder(domain, UnitIds.StringId).WithSingularName("AllorsString").WithPluralName("AllorsStrings").WithUnitTag(UnitTags.AllorsString).Build();
Assert.AreEqual(4, metaPopulation.Composites.Count());
var superunit = new UnitBuilder(domain, UnitIds.IntegerId).WithSingularName("AllorsInteger").WithPluralName("AllorsIntegers").WithUnitTag(UnitTags.AllorsString).Build();
Assert.AreEqual(4, metaPopulation.Composites.Count());
}
示例3: PutRestaurant
public async Task<IHttpActionResult> PutRestaurant(Guid id, Domain.Entities.Restaurant restaurant)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
if (id != restaurant.ID)
{
return BadRequest();
}
db.Entry(restaurant).State = EntityState.Modified;
try
{
await db.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!RestaurantExists(id))
{
return NotFound();
}
else
{
throw;
}
}
return StatusCode(HttpStatusCode.NoContent);
}
示例4: CreateKey
public static Key CreateKey(string id, Domain domain, string name, string attibType, object defaultVal)
{
Key key = null;
if (attibType.ToLower() == XMLConstants._Bool)
{
key = new BooleanKey(id, domain, name, (bool)defaultVal);
}
else if (attibType.ToLower() == XMLConstants._Int)
{
key = new IntegerKey(id, domain, name, (int)defaultVal);
}
else if (attibType.ToLower() == XMLConstants._Long)
{
key = new LongKey(id, domain, name, (long)defaultVal);
}
else if (attibType.ToLower() == XMLConstants._Float)
{
key = new FloatKey(id, domain, name, (float)defaultVal);
}
else if (attibType.ToLower() == XMLConstants._Double)
{
key = new DoubleKey(id, domain, name, (double)defaultVal);
}
else if (attibType.ToLower() == XMLConstants._String)
{
key = new StringKey(id, domain, name, (string)defaultVal);
}
return key;
}
示例5: checkTubmlrUserExists
public bool checkTubmlrUserExists(Domain.Socioboard.Domain.TumblrAccount objTumblrAccount)
{
//Creates a database connection and opens up a session
using (NHibernate.ISession session = SessionFactory.GetNewSession())
{
//After Session creation, start Transaction.
using (NHibernate.ITransaction transaction = session.BeginTransaction())
{
try
{
//Proceed action, to Check if FacebookUser is Exist in database or not by UserId and FbuserId.
// And Set the reuired paremeters to find the specific values.
NHibernate.IQuery query = session.CreateQuery("from TumblrAccount where UserId = :uidd and tblrUserName = :tbuname");
query.SetParameter("uidd",objTumblrAccount.UserId);
query.SetParameter("tbuname", objTumblrAccount.tblrUserName);
var result = query.UniqueResult();
if (result == null)
return false;
else
return true;
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
return true;
}
}//End Transaction
}//End session
}
示例6: GetCurrentDomain
} // End of the GetConnectionString method
/// <summary>
/// Get the current domain
/// </summary>
/// <returns>The current domain, a empty domain if it is null</returns>
public static Domain GetCurrentDomain()
{
// Get the domain name
string domainName = HttpContext.Current.Request.Url.Host;
// Replace www.
domainName = domainName.Replace("www.", "");
// Get the domain post
Domain domain = Domain.GetOneByDomainName(domainName);
// Make sure that the domain not is null
if(domain == null)
{
domain = new Domain();
domain.id = 0;
domain.domain_name = "localhost";
domain.web_address = "https://localhost:80";
domain.front_end_language = 2;
domain.back_end_language = 2;
domain.custom_theme_id = 0;
domain.analytics_tracking_id = "";
domain.facebook_app_id = "";
domain.facebook_app_secret = "";
domain.google_app_id = "";
domain.google_app_secret = "";
domain.noindex = true;
}
// Return the current front end language id
return domain;
} // End of the GetCurrentDomain method
示例7: SaveSensorData
public static void SaveSensorData(Domain.SensorData sd) {
SqlConnection connection = new SqlConnection(CN);
SqlCommand insert = new SqlCommand();
SqlParameter nodeId, timeStamp, powerLevel, motionDetected;
insert.CommandText = "INSERT INTO [SensorFeed] (NodeID, TimeStamp, PowerLevel, MotionDetected) VALUES (@NodeID, @TimeStamp, @PowerLevel, @MotionDetected)";
nodeId = new SqlParameter("@NodeID", System.Data.SqlDbType.Int);
nodeId.Value = sd.NodeId;
timeStamp = new SqlParameter("@TimeStamp", System.Data.SqlDbType.DateTime);
timeStamp.Value = sd.TimeStamp;
powerLevel = new SqlParameter("@PowerLevel", System.Data.SqlDbType.Float);
powerLevel.Value = sd.PowerLevel;
motionDetected = new SqlParameter("@MotionDetected", System.Data.SqlDbType.Bit);
motionDetected.Value = 0;
insert.Parameters.Add(nodeId);
insert.Parameters.Add(timeStamp);
insert.Parameters.Add(powerLevel);
insert.Parameters.Add(motionDetected);
insert.Connection = connection;
try {
connection.Open();
insert.ExecuteNonQuery();
} catch (Exception ex) {
System.Diagnostics.Debug.WriteLine(ex.Message);
} finally {
connection.Close();
insert.Dispose();
connection.Dispose();
}
}
示例8: ReadKey
public void ReadKey(string keyId, Domain domain, string keyName, Type dataType, object defaultVal, string inputStr)
{
//<key id="nd0" for="node" attr.name="X1" attr.type="string" />
var keyReader = new KeyReader();
var reader = new XmlTextReader(new StringReader(inputStr));
reader.Read();
Assert.True(reader.IsStartElement());
Assert.True(string.Compare("key", reader.Name, true) == 0, string.Format("Reader.Name should match expected, not: \"{0}\"", reader.Name));
string retrievedKeyId;
Domain retrievedDomain;
string retrievedAttribName;
Type retrievedType;
object retrievedDefault;
keyReader.Read(out retrievedKeyId, out retrievedDomain, out retrievedAttribName, out retrievedType, out retrievedDefault, reader);
Assert.Equal(keyId, retrievedKeyId);
Assert.Equal(domain, retrievedDomain);
Assert.Equal(keyName, retrievedAttribName);
Assert.Equal(dataType, retrievedType);
Assert.Equal(defaultVal, retrievedDefault);
if (!reader.IsEmptyElement)
Assert.True(string.Compare("key", reader.Name, true) == 0, string.Format("End Reader.Name should match expected, not: \"{0}\"", reader.Name));
}
示例9: FromBasket
public static BasketResource FromBasket(Domain.Basket basket)
{
return new BasketResource
{
Id = basket.Id
};
}
示例10: PerformAdmin
protected override void PerformAdmin(Domain.IncomingSmsMessage message)
{
int id;
if (TryCrackId(message.Message, out id))
{
IDataStore store = DataStore.GetInstance();
Subscription sub = store.Subscriptions.Where(s => s.Id == id).FirstOrDefault();
if (sub != null)
{
Say(message.From, "Subscription {0} has phone {1} and is due on {2}",
sub.Id,
sub.Phone,
sub.Next);
}
else
{
Say(message.From, "Subscription Not Found: {0}", id);
}
}
else
{
Say(message.From, "Unable to parse input. Usage: SUB <id> Example: SUB 10");
}
}
示例11: deleteTwitterMessage
/// <deleteTwitterMessage>
/// Delete Twitter Message
/// </summary>
/// <param name="twtmsg">Set Values of profile id and user id in a TwitterMessage Class Property and Pass the Object of Class.(Domein.TwitterMessage)</param>
/// <returns>Return 1 for success and 0 for failure.(int) </returns>
public int deleteTwitterMessage(Domain.Myfashion.Domain.TwitterMessage twtmsg)
{
//Creates a database connection and opens up a session
using (NHibernate.ISession session = SessionFactory.GetNewSession())
{
//After Session creation, open up a Transaction.
using (NHibernate.ITransaction transaction = session.BeginTransaction())
{
try
{
//Proceed action, to delete twitter message by twitter user id and user id
NHibernate.IQuery query = session.CreateQuery("delete from TwitterMessage where ProfileId = :twtuserid and UserId = :userid")
.SetParameter("twtuserid", twtmsg.ProfileId)
.SetParameter("userid", twtmsg.UserId);
int isUpdated = query.ExecuteUpdate();
transaction.Commit();
return isUpdated;
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
return 0;
}
}//End Transaction
}//End Session
}
示例12: AccessionOrderDataSheetDataCommentLog
public AccessionOrderDataSheetDataCommentLog(Domain.OrderCommentLog orderCommentLog)
{
this.m_LoggedBy = string.IsNullOrEmpty(orderCommentLog.LoggedBy) ? orderCommentLog.LoggedBy : string.Empty;
this.m_Description = string.IsNullOrEmpty(orderCommentLog.Description) ? orderCommentLog.Description : string.Empty;
this.m_Comment = string.IsNullOrEmpty(orderCommentLog.Comment) ? orderCommentLog.Comment : string.Empty;
this.m_LogDate = orderCommentLog.LogDate.ToShortDateString() + " " + orderCommentLog.LogDate.ToShortTimeString();
}
示例13: DeleteArchiveMessage
/// <DeleteArchiveMessage>
/// Delete a ArchieveMessage From Database by UserId and Message.
/// </summary>
/// <param name="archive">the object of the ArchieveMessage class(Domain.ArchieveMEssage)</param>
/// <returns>Return 1 for True and 0 for False</returns>
public int DeleteArchiveMessage(Domain.Socioboard.Domain.ArchiveMessage archive)
{
//Creates a database connection and opens up a session
using (NHibernate.ISession session = SessionFactory.GetNewSession())
{
//After Session creation, start Transaction.
using (NHibernate.ITransaction transaction = session.BeginTransaction())
{
try
{
// Proceed action to Detele specific data.
// return the integer value when it is success or not (0 or 1).
NHibernate.IQuery query = session.CreateQuery("delete from ArchiveMessage where UserId = :userid and Message = :message")
.SetParameter("message", archive.Message)
.SetParameter("userid", archive.UserId);
int isUpdated = query.ExecuteUpdate();
transaction.Commit();
return isUpdated;
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
return 0;
}
}// End using trasaction
}// End using session
}
示例14: updateGooglePlusUser
/// <updateGooglePlusUser>
/// Update google pluse user account details.
/// </summary>
/// <param name="gpaccount">Set Values in a GooglePlusAccount Class Property and Pass the same Object of GooglePlusAccount Class.(Domain.GooglePlusAccount)</param>
public void updateGooglePlusUser(Domain.Socioboard.Domain.GooglePlusAccount gpaccount)
{
//Creates a database connection and opens up a session
using (NHibernate.ISession session = SessionFactory.GetNewSession())
{
//After Session creation, start Transaction.
using (NHibernate.ITransaction transaction = session.BeginTransaction())
{
try
{
//Proceed action, to update google pluse account details
session.CreateQuery("Update GooglePlusAccount set GpUserName =:gpusername,AccessToken =:access,RefreshToken=:refreshtoken,GpProfileImage =:gpprofileimage,RefreshToken=:refreshtoken,EmailId=:emailid where GpUserId = :gpuserid and UserId = :userid")
.SetParameter("gpusername", gpaccount.GpUserName)
.SetParameter("access", gpaccount.AccessToken)
.SetParameter("refreshtoken",gpaccount.RefreshToken)
.SetParameter("gpprofileimage", gpaccount.GpProfileImage)
.SetParameter("emailid", gpaccount.EmailId)
.SetParameter("fbuserid", gpaccount.GpUserId)
.SetParameter("userid", gpaccount.UserId)
.ExecuteUpdate();
transaction.Commit();
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
// return 0;
}
}//End Transaction
}//End Session
}
示例15: GetDefualtDomain
/// <summary>
/// This method return the default domain for single domain scenarios (this is necessary because the ratings for each user is added to a domain)
/// (should be tested)
/// </summary>
/// <returns></returns>
public static Domain GetDefualtDomain()
{
if (_defaultDomain == null)
_defaultDomain = new Domain("default");
return _defaultDomain;
}