コード例 #1
0
ファイル: TicketService.cs プロジェクト: Thanak1234/test
        public TicketGroupPolicy addNewGroupPolicy(TicketGroupPolicyDto instance)
        {
            TicketGroupPolicy gp = createGroupPolicyObject(instance);

            try
            {
                groupPolicyRepo.Add(gp);

                DateTime currentDate = DateTime.Now;
                foreach (GroupPolicyAssignTeamListDto dto in instance.assignTeamList)
                {
                    TicketGroupPolicyTeamAssign t = new TicketGroupPolicyTeamAssign();
                    t.GroupPolicyId = gp.Id;
                    t.TeamId        = dto.teamId;
                    t.CreatedDate   = currentDate;
                    t.Status        = "ACTIVE";
                    groupPolicyTeamAssignRepo.Add(t);
                }

                foreach (GroupPolicyAssignTeamListDto dto in instance.assignReportLimitAccessTeamList)
                {
                    TicketGroupPolicyReportAssign t = new TicketGroupPolicyReportAssign();
                    t.GroupPolicyId = gp.Id;
                    t.TeamId        = dto.teamId;
                    t.CreatedDate   = currentDate;
                    t.Status        = "ACTIVE";
                    groupPolicyReportAssignRepo.Add(t);
                }
                return(gp);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                return(gp);
            }
        }
コード例 #2
0
ファイル: TicketService.cs プロジェクト: Thanak1234/test
        private TicketGroupPolicy createGroupPolicyObject(TicketGroupPolicyDto instance)
        {
            TicketGroupPolicy groupPolicy = new TicketGroupPolicy();

            groupPolicy.Description        = instance.description;
            groupPolicy.GroupName          = instance.groupName;
            groupPolicy.Status             = instance.status;
            groupPolicy.LimitAccess        = instance.limitAccess;
            groupPolicy.NewTicketNotify    = instance.newTicketNotify;
            groupPolicy.AssignedNotify     = instance.assignedNotify;
            groupPolicy.ReplyNotify        = instance.replyNotify;
            groupPolicy.ChangeStatusNotify = instance.changeStatusNotify;
            groupPolicy.CreateTicket       = instance.createTicket;
            groupPolicy.EditTicket         = instance.editTicket;
            groupPolicy.ChangeStatus       = instance.changeStatus;
            groupPolicy.PostTicket         = instance.postTicket;
            groupPolicy.CloseTicket        = instance.closeTicket;
            groupPolicy.AssignTicket       = instance.assignTicket;
            groupPolicy.MergeTicket        = instance.mergeTicket;
            groupPolicy.DeleteTicket       = instance.deleteTicket;
            groupPolicy.SubTicket          = instance.subTicket;
            groupPolicy.ReportAccess       = instance.reportAccess;
            return(groupPolicy);
        }
コード例 #3
0
ファイル: TicketService.cs プロジェクト: Thanak1234/test
        public TicketGroupPolicy updateGroupPolicy(TicketGroupPolicyDto instance)
        {
            TicketGroupPolicy gp = createGroupPolicyObject(instance);

            try
            {
                gp.Id = instance.id;
                groupPolicyRepo.Update(gp);
                DateTime currentDate = DateTime.Now;
                //remove priouse ones
                foreach (TicketGroupPolicyTeamsDto obj in groupPolicyTeamAssignRepo.getListByPartners(0, gp.Id))
                {
                    TicketGroupPolicyTeamAssign gpTa = groupPolicyTeamAssignRepo.GetById(obj.id);
                    gpTa.CreatedDate = currentDate;
                    gpTa.Status      = "DELETE";
                    groupPolicyTeamAssignRepo.Update(gpTa);
                }

                foreach (TicketGroupPolicyTeamsDto obj in groupPolicyReportAssignRepo.getListByPartners(0, gp.Id))
                {
                    TicketGroupPolicyReportAssign gpTa = groupPolicyReportAssignRepo.GetById(obj.id);
                    gpTa.CreatedDate = currentDate;
                    gpTa.Status      = "DELETE";
                    groupPolicyReportAssignRepo.Update(gpTa);
                }

                IEnumerable <GroupPolicyAssignTeamListDto> gpTeamAssignList = instance.assignTeamList;

                foreach (GroupPolicyAssignTeamListDto dto in gpTeamAssignList)
                {
                    TicketGroupPolicyTeamAssign gpTaObj = new TicketGroupPolicyTeamAssign();
                    gpTaObj.CreatedDate   = currentDate;
                    gpTaObj.TeamId        = dto.teamId;
                    gpTaObj.GroupPolicyId = gp.Id;
                    gpTaObj.Status        = "ACTIVE";
                    gpTaObj.ModifiedDate  = currentDate;
                    gpTaObj.Description   = "Team assigned";
                    groupPolicyTeamAssignRepo.Add(gpTaObj);
                }

                IEnumerable <GroupPolicyAssignTeamListDto> gpReportAssignList = instance.assignReportLimitAccessTeamList;

                foreach (GroupPolicyAssignTeamListDto dto in gpReportAssignList)
                {
                    TicketGroupPolicyReportAssign gpTaObj = new TicketGroupPolicyReportAssign();
                    gpTaObj.CreatedDate   = currentDate;
                    gpTaObj.TeamId        = dto.teamId;
                    gpTaObj.GroupPolicyId = gp.Id;
                    gpTaObj.Status        = "ACTIVE";
                    gpTaObj.ModifiedDate  = currentDate;
                    gpTaObj.Description   = "Team assigned";
                    groupPolicyReportAssignRepo.Add(gpTaObj);
                }

                return(gp);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                return(gp);
            }
        }