当前位置: 首页>>代码示例>>C#>>正文


C# Domain类代码示例

本文整理汇总了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);
            }
        }
开发者ID:ankitpr89,项目名称:socioboard-core,代码行数:33,代码来源:Tasks.asmx.cs

示例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());
        }
开发者ID:whesius,项目名称:allors,代码行数:33,代码来源:MetaPopulationTest.cs

示例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);
        }
开发者ID:csvila,项目名称:Restaurant,代码行数:32,代码来源:RestaurantsController.cs

示例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;
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:31,代码来源:KeyFactory.cs

示例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
        }
开发者ID:socioboard,项目名称:socioboard-core,代码行数:32,代码来源:TumblrAccountRepository.cs

示例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
开发者ID:hunii,项目名称:a-blogsite,代码行数:39,代码来源:Tools.cs

示例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();
      }
 }
开发者ID:wendellinfinity,项目名称:Electricity-Monitor-.Net,代码行数:29,代码来源:SensorDataAccess.cs

示例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));
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:26,代码来源:KeyReaderFixture.cs

示例9: FromBasket

 public static BasketResource FromBasket(Domain.Basket basket)
 {
     return new BasketResource
                {
                    Id = basket.Id
                };
 }
开发者ID:bnathyuw,项目名称:NancyShop,代码行数:7,代码来源:BasketResource.cs

示例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");
            }
        }
开发者ID:bubbafat,项目名称:TellHer,代码行数:25,代码来源:Sub.cs

示例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
 }
开发者ID:sumitglobussoft,项目名称:myfashionmarketer,代码行数:31,代码来源:TwitterMessageRepository.cs

示例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();
 }
开发者ID:ericramses,项目名称:YPILIS,代码行数:7,代码来源:AccessionOrderDataSheetDataCommentLog.cs

示例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
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:32,代码来源:ArchiveMessageRepository.cs

示例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
 }
开发者ID:socioboard,项目名称:socioboard-core,代码行数:34,代码来源:GooglePlusAccountRepository.cs

示例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;
        }
开发者ID:WisonHuang,项目名称:WrapRec,代码行数:12,代码来源:CrossDomainDataContainer.cs


注:本文中的Domain类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。