public WaterCoolerThread GetMessage(int messageID) { WaterCoolerThread thread = new WaterCoolerThread(); WaterCoolerView wcv = new WaterCoolerView(TSAuthentication.GetLoginUser()); wcv.LoadByMessageID(messageID); WaterCoolerView replies = new WaterCoolerView(TSAuthentication.GetLoginUser()); replies.LoadReplies(messageID); WatercoolerAttachments wcgroups = new WatercoolerAttachments(TSAuthentication.GetLoginUser()); wcgroups.LoadByType(messageID, WaterCoolerAttachmentType.Group); WatercoolerAttachments wctickets = new WatercoolerAttachments(TSAuthentication.GetLoginUser()); wctickets.LoadByType(messageID, WaterCoolerAttachmentType.Ticket); WatercoolerAttachments wcprods = new WatercoolerAttachments(TSAuthentication.GetLoginUser()); wcprods.LoadByType(messageID, WaterCoolerAttachmentType.Product); WatercoolerAttachments wccompany = new WatercoolerAttachments(TSAuthentication.GetLoginUser()); wccompany.LoadByType(messageID, WaterCoolerAttachmentType.Company); WatercoolerAttachments wcuseratt = new WatercoolerAttachments(TSAuthentication.GetLoginUser()); wcuseratt.LoadByType(messageID, WaterCoolerAttachmentType.User); WatercoolerAttachments wcactivitiesatt = new WatercoolerAttachments(TSAuthentication.GetLoginUser()); wcactivitiesatt.LoadByType(messageID, WaterCoolerAttachmentType.Activities); thread.Message = wcv.GetWaterCoolerViewItemProxies()[0]; thread.Replies = replies.GetWaterCoolerViewItemProxies(); thread.Groups = wcgroups.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.Group); thread.Tickets = wctickets.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.Ticket); thread.Products = wcprods.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.Product); thread.Company = wccompany.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.Company); thread.User = wcuseratt.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.User); thread.Activities = wcactivitiesatt.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.Activities); return(thread); }
public void Del(int messageID) { LoginUser loginUser = new LoginUser(connString, -1, -1, null); try { loginUser = new LoginUser(connString, TSAuthentication.GetLoginUser().UserID, TSAuthentication.GetLoginUser().OrganizationID, null); WaterCoolerView wcv = new WaterCoolerView(loginUser); wcv.LoadByMessageID(messageID); var result = pusher.Trigger("ticket-dispatch-" + TSAuthentication.GetLoginUser().OrganizationID, "deleteMessage", new { msgID = messageID, parentID = wcv[0].MessageParent }); //Clients.All.deleteMessage(messageID, wcv[0].MessageParent); } catch (Exception ex) { ExceptionLogs.LogException(loginUser, ex, "Socket.Del"); } }
public void NewThread(int messageID, string organizationID) { LoginUser loginUser = new LoginUser(connString, -1, -1, null); try { loginUser = new LoginUser(connString, TSAuthentication.GetLoginUser().UserID, TSAuthentication.GetLoginUser().OrganizationID, null); WaterCoolerThread thread = new WaterCoolerThread(); WaterCoolerView wcv = new WaterCoolerView(loginUser); wcv.LoadByMessageID(messageID); WaterCoolerView replies = new WaterCoolerView(loginUser); replies.LoadReplies(messageID); WatercoolerAttachments wcgroups = new WatercoolerAttachments(loginUser); wcgroups.LoadByType(messageID, WaterCoolerAttachmentType.Group); WatercoolerAttachments wctickets = new WatercoolerAttachments(loginUser); wctickets.LoadByType(messageID, WaterCoolerAttachmentType.Ticket); WatercoolerAttachments wcprods = new WatercoolerAttachments(loginUser); wcprods.LoadByType(messageID, WaterCoolerAttachmentType.Product); WatercoolerAttachments wccompany = new WatercoolerAttachments(loginUser); wccompany.LoadByType(messageID, WaterCoolerAttachmentType.Company); WatercoolerAttachments wcuseratt = new WatercoolerAttachments(loginUser); wcuseratt.LoadByType(messageID, WaterCoolerAttachmentType.User); WatercoolerAttachments wcactivitiesatt = new WatercoolerAttachments(loginUser); wcactivitiesatt.LoadByType(messageID, WaterCoolerAttachmentType.Activities); thread.Message = wcv.GetWaterCoolerViewItemProxies()[0]; thread.Replies = replies.GetWaterCoolerViewItemProxies(); thread.Groups = wcgroups.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.Group); thread.Tickets = wctickets.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.Ticket); thread.Products = wcprods.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.Product); thread.Company = wccompany.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.Company); thread.User = wcuseratt.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.User); thread.Activities = wcactivitiesatt.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.Activities); //If this is a new thread if (thread.Message.MessageParent == -1) { var result = pusher.Trigger("ticket-dispatch-" + organizationID, "addThread", thread); //return JsonConvert.SerializeObject(true); //Clients.Group().addThread(thread); } else { var result = pusher.Trigger("ticket-dispatch-" + organizationID, "addComment", thread); //Clients.Group(organizationID).addComment(thread); int parentThreadID = (int)thread.Message.MessageParent; WaterCoolerThread parentThread = new WaterCoolerThread(); WaterCoolerView parentThreadwcv = new WaterCoolerView(loginUser); parentThreadwcv.LoadByMessageID(parentThreadID); WatercoolerAttachments parentThreadwcgroups = new WatercoolerAttachments(loginUser); parentThreadwcgroups.LoadByType(parentThreadID, WaterCoolerAttachmentType.Group); WatercoolerAttachments parentThreadwctickets = new WatercoolerAttachments(loginUser); parentThreadwctickets.LoadByType(parentThreadID, WaterCoolerAttachmentType.Ticket); WatercoolerAttachments parentThreadwcprods = new WatercoolerAttachments(loginUser); parentThreadwcprods.LoadByType(parentThreadID, WaterCoolerAttachmentType.Product); WatercoolerAttachments parentThreadwccompany = new WatercoolerAttachments(loginUser); parentThreadwccompany.LoadByType(parentThreadID, WaterCoolerAttachmentType.Company); WatercoolerAttachments parentThreadwcuseratt = new WatercoolerAttachments(loginUser); parentThreadwcuseratt.LoadByType(parentThreadID, WaterCoolerAttachmentType.User); WatercoolerAttachments parentThreadactivitiesatt = new WatercoolerAttachments(TSAuthentication.GetLoginUser()); parentThreadactivitiesatt.LoadByType(parentThreadID, WaterCoolerAttachmentType.Activities); parentThread.Message = parentThreadwcv.GetWaterCoolerViewItemProxies()[0]; parentThread.Groups = parentThreadwcgroups.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.Group); parentThread.Tickets = parentThreadwctickets.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.Ticket); parentThread.Products = parentThreadwcprods.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.Product); parentThread.Company = parentThreadwccompany.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.Company); parentThread.User = parentThreadwcuseratt.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.User); parentThread.Activities = parentThreadactivitiesatt.GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType.Activities); result = pusher.Trigger("ticket-dispatch-" + organizationID, "updateattachments", parentThread); //Clients.Group(organizationID).updateattachments(parentThread); } } catch (Exception ex) { ExceptionLogs.LogException(loginUser, ex, "Socket.NewThread"); } }