/// <UpdateDrafts>
 /// Update existing Draft
 /// </summary>
 /// <param name="d">Set Values in a Draft Class Property and Pass the same Object of Draft Class (SocioBoard.Domain.Draft).</param>
 public void UpdateDrafts(Domain.Myfashion.Domain.Drafts d)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //Begin session trasaction and opens up.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 session.CreateQuery("Update Drafts set Message =:mess,ModifiedDate =:mod where UserId =:userid")
                 .SetParameter("mess", d.Message)
                 .SetParameter("mod", d.ModifiedDate)
                 .SetParameter("userid", d.UserId)
                 .ExecuteUpdate();
                 transaction.Commit();
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 // return 0;
             }
         } //End Trasaction
     }     //End session
 }
 /// <DeleteDrafts>
 /// Delete Draft
 /// </summary>
 /// <param name="d">Set Values in a Draft Class Property and Pass the Object of Draft Class (SocioBoard.Domain.Draft).</param>
 /// <returns>Return 1 for successfully deleted or 0 for failed.</returns>
 public int DeleteDrafts(Domain.Myfashion.Domain.Drafts d)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //Begin session trasaction and opens up.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 //Proceed action ,
                 //To delete draft, by user id and message.
                 NHibernate.IQuery query = session.CreateQuery("delete from Drafts where UserId = :userid and Message =:mess")
                                           .SetParameter("userid", d.UserId)
                                           .SetParameter("mess", d.Message);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End transaction
     }     //End session
 }
Esempio n. 3
0
 public string UpdateDraftsMessage(String draftId, string userid, string groupid, string message)
 {
     try
     {
         Domain.Myfashion.Domain.Drafts objDrafts = new Domain.Myfashion.Domain.Drafts();
         objDraftsRepository.UpdateDraftsMessage(Guid.Parse(draftId), Guid.Parse(userid), Guid.Parse(groupid), message);
         return("Success");
     }
     catch (Exception)
     {
         return("Failed");
     }
 }
 /// <AddDrafts>
 /// Add new draft
 /// </summary>
 /// <param name="d">Set Values in a Draft Class Property and Pass the Object of Draft Class (SocioBoard.Domain.Draft).</param>
 public void AddDrafts(Domain.Myfashion.Domain.Drafts d)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //Begin session trasaction and opens up.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             //Proceed action , to save data.
             session.Save(d);
             transaction.Commit();
         } //End transaction
     }     //End session
 }
Esempio n. 5
0
        public string UpdateDrafts(String Id, string message)
        {
            try
            {
                Domain.Myfashion.Domain.Drafts objDrafts = new Domain.Myfashion.Domain.Drafts();

                Guid DraftId = Guid.Parse(Id);

                objDraftsRepository.UpdateDrafts(DraftId, message);

                return("Success");
            }
            catch (Exception)
            {
                return("Failed");
            }
        }
Esempio n. 6
0
        public string AddDraft(String UserId, string groupid, DateTime ModifiedDate, string Message)
        {
            try
            {
                Domain.Myfashion.Domain.Drafts objDrafts = new Domain.Myfashion.Domain.Drafts();

                Guid id     = new Guid();
                Guid userid = Guid.Parse(UserId);
                objDrafts.Id           = id;
                objDrafts.UserId       = userid;
                objDrafts.CreatedDate  = DateTime.Now;
                objDrafts.ModifiedDate = ModifiedDate;
                objDrafts.Message      = Message;
                objDrafts.GroupId      = Guid.Parse(groupid);
                objDraftsRepository.AddDrafts(objDrafts);
                return("Success");
            }
            catch (Exception)
            {
                return("Failed");
            }
        }
Esempio n. 7
0
        public string DeleteDrafts(String Id)
        {
            try
            {
                Domain.Myfashion.Domain.Drafts objDrafts = new Domain.Myfashion.Domain.Drafts();

                Guid DraftId = Guid.Parse(Id);

                int isUpdated = objDraftsRepository.DeleteDrafts(objDrafts);
                if (isUpdated > 0)
                {
                    return("Success");
                }
                else
                {
                    return("Failed");
                }
            }
            catch (Exception)
            {
                return("Failed");
            }
        }
        public string AddDraft(String UserId, string groupid, DateTime ModifiedDate, string Message)
        {
            try
            {

                Domain.Myfashion.Domain.Drafts objDrafts = new Domain.Myfashion.Domain.Drafts();

                Guid id = new Guid();
                Guid userid = Guid.Parse(UserId);
                objDrafts.Id = id;
                objDrafts.UserId = userid;
                objDrafts.CreatedDate = DateTime.Now;
                objDrafts.ModifiedDate = ModifiedDate;
                objDrafts.Message = Message;
                objDrafts.GroupId = Guid.Parse(groupid);
                objDraftsRepository.AddDrafts(objDrafts);
                return "Success";
            }
            catch (Exception)
            {
                return "Failed";
            }
        }
        public string UpdateDrafts(String Id, string message)
        {
            try
            {

                Domain.Myfashion.Domain.Drafts objDrafts = new Domain.Myfashion.Domain.Drafts();

                Guid DraftId = Guid.Parse(Id);

                objDraftsRepository.UpdateDrafts(DraftId, message);

                return "Success";
            }
            catch (Exception)
            {
                return "Failed";
            }
        }
 public string UpdateDraftsMessage(String draftId, string userid, string groupid, string message)
 {
     try
     {
         Domain.Myfashion.Domain.Drafts objDrafts = new Domain.Myfashion.Domain.Drafts();
         objDraftsRepository.UpdateDraftsMessage(Guid.Parse(draftId), Guid.Parse(userid), Guid.Parse(groupid), message);
         return "Success";
     }
     catch (Exception)
     {
         return "Failed";
     }
 }
        public string DeleteDrafts(String Id)
        {
            try
            {
                
                Domain.Myfashion.Domain.Drafts objDrafts = new Domain.Myfashion.Domain.Drafts();

                Guid DraftId = Guid.Parse(Id);

                int isUpdated = objDraftsRepository.DeleteDrafts(objDrafts);
                if (isUpdated > 0)
                {
                    return "Success";
                }
                else
                {
                    return "Failed";
                }
            }
            catch (Exception)
            {
                return "Failed";
            }
        }