Exemplo n.º 1
0
        public TicketQuery WithDepartment(TicketDepartment value      = null,
                                          ArgumentEvaluationMode mode = ArgumentEvaluationMode.IgnoreNeutral,
                                          EntityOperator @operator    = EntityOperator.Equal)
        {
            switch (mode)
            {
            case ArgumentEvaluationMode.IgnoreNeutral:
                if (Neutrals.Is(value))
                {
                    return(this);
                }
                break;

            case ArgumentEvaluationMode.Explicit:
                break;

            default:
                throw new NotSupportedEnumException(mode);
            }

            switch (@operator)
            {
            case EntityOperator.Equal:
                Entities = Entities.Where(t => t.Department == value);
                return(this);

            case EntityOperator.NotEqual:
                Entities = Entities.Where(t => t.Department != value);
                return(this);

            default:
                throw new NotSupportedEnumException(@operator);
            }
        }
        protected virtual void loadInfomation()
        {
            if (ticket != null)
            {
                this.submitter = dataProcessingProvider.getEmployee(ticket.SubmitterId);
                //None requestor
                if (ticket.RequestorId == 0)
                {
                    this.requestor = this.submitter;
                }
                //Unknow requestor
                else if (ticket.RequestorId == -1)
                {
                    this.requestor = dataProcessingProvider.getUnknowRequestor(ticket);
                }
                else
                {
                    this.requestor = dataProcessingProvider.getEmployee(ticket.RequestorId);
                }

                ticketDept = dataProcessingProvider.getDept(ticket.DeptId);
            }

            this.currLogin = dataProcessingProvider.getEmployee(ticketParam.CurrLoginUserId);
        }
Exemplo n.º 3
0
 public HttpResponseMessage updateSettingDepartment(int id, [FromUri] TicketDepartment instance)
 {
     if (ticketService.isDepartmentExisted(instance))
     {
         return(Request.CreateResponse(HttpStatusCode.PreconditionFailed, new { msg = "This Department was existed" }));
     }
     else
     {
         return(Request.CreateResponse(HttpStatusCode.OK, ticketService.updateDepartment(instance)));
     }
 }
Exemplo n.º 4
0
 public TicketDepartment updateDepartment(TicketDepartment instance)
 {
     try
     {
         deptRepo.Update(instance);
         return(instance);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.StackTrace);
         return(instance);
     }
 }
Exemplo n.º 5
0
        private TicketDepartment getDept(EmailItem item)
        {
            TicketDepartment dept = null;

            depts.Where(t => !string.IsNullOrWhiteSpace(item.Receipient) && item.Receipient.IndexOf(t.AutomationEmail.Trim()) > 0).ToList().ForEach(t =>
            {
                dept = t;
            });


            if (dept == null)
            {
                depts.Where(t => t.IsDefault).ToList().ForEach(t => dept = t);

                if (dept == null)
                {
                    throw new Exception("Cannot find default department setup in the system. Please check department configuration");
                }
            }

            return(dept);
        }
Exemplo n.º 6
0
 public Boolean isDepartmentExisted(TicketDepartment instance)
 {
     return(deptRepo.isDepartmentExisted(instance));
 }