/// <AddGroupProfile> /// Add a new group profile /// </summary> /// <param name="group">Set Values in a GroupProfile Class Property and Pass the same Object of GroupProfile Class.(Domain.GroupProfile)</param> public void AddGroupProfile(Domain.Myfashion.Domain.GroupProfile group) { //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(group); transaction.Commit(); } //End Transaction } //End Session }
public string AddProfileToGroup(string profileid, string network, string groupid, string userid) { objGroupProfile = new Domain.Myfashion.Domain.GroupProfile(); objGroupProfile.Id = Guid.NewGuid(); objGroupProfile.GroupId = Guid.Parse(groupid); objGroupProfile.ProfileId = profileid; objGroupProfile.GroupOwnerId = Guid.Parse(userid); objGroupProfile.ProfileType = network; objGroupProfile.EntryDate = DateTime.Now; objGroupProfileRepository.AddGroupProfile(objGroupProfile); objTeam = new Domain.Myfashion.Domain.Team(); objTeam = objTeamRepository.GetAllTeam(Guid.Parse(groupid), Guid.Parse(userid)); objTeamMemberProfile = new Domain.Myfashion.Domain.TeamMemberProfile(); objTeamMemberProfile.Id = Guid.NewGuid(); objTeamMemberProfile.TeamId = objTeam.Id; objTeamMemberProfile.ProfileId = profileid; objTeamMemberProfile.ProfileType = network; objTeamMemberProfile.Status = 1; objTeamMemberProfile.StatusUpdateDate = DateTime.Now; objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile); return(""); }
/// <UpdateGroupProfile> /// Update the details of group profile /// </summary> /// <param name="group">Set Values in a GroupProfile Class Property and Pass the same Object of GroupProfile Class.(Domain.GroupProfile)</param> public void UpdateGroupProfile(Domain.Myfashion.Domain.GroupProfile group) { //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 specific data by user id. session.CreateQuery("Update GroupProfiles set EntryDate =:entrydate where Id = :userid") .SetParameter("userid", group.Id) .ExecuteUpdate(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); // return 0; } } //End Transaction } //End Session }