Пример #1
0
 /// <AddPackage>
 /// Add Package
 /// </summary>
 /// <param name="package">Set Values in a Package Class Property and Pass the Object of Package Class.(Domein.Package)</param>
 public void AddReplyMessage(Domain.Socioboard.Domain.ReplyMessage ReplyMessage)
 {
     //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())
         {
             //Proceed action, to save data.
             session.Save(ReplyMessage);
             transaction.Commit();
         } //End Transaction
     }     //End Session
 }
Пример #2
0
        public string AddReplyMessage(string FromUserId, string Name, string UserId, string MessageId, string Message, string type)
        {
            String status = "Failed";
            try
            {
                ReplyMessageRepository RplyMsgRepository = new ReplyMessageRepository();
                ReplyMessage RplMsg = new ReplyMessage();

                Guid _Id = Guid.NewGuid();
                Guid _UserId = Guid.Parse(UserId);
                Guid _MessageId = Guid.Parse(MessageId);

                RplMsg.Id = _Id;
                RplMsg.FromUserId = FromUserId;
                RplMsg.Name = Name;
                RplMsg.UserId = _UserId;
                RplMsg.MessageId = _MessageId;
                RplMsg.Message = Message;
                RplMsg.Type = type;

                try
                {
                    RplyMsgRepository.AddReplyMessage(RplMsg);
                    status = "Success";
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    status = ex.Message;
                }
            }
            catch (Exception)
            {

            }
            return new JavaScriptSerializer().Serialize(status);
        }