Пример #1
0
        public HttpResponseMessage setFileException(int id, int reasonid, string reason)
        {
            try
            {
                int userID = int.Parse(Request.Headers.GetValues("userId").FirstOrDefault());


                var wkflow = _IWkflowinstanceService.GetWkflowinstance(id);

                var batchProcessingWorkflow =
                    _IWkflowdefService.GetWkflowdefs().Where(p => p.Code == "FPW").FirstOrDefault();

                var statusID = batchProcessingWorkflow.WkflowDefWkflowStats.Where(p => p.WkflowStat.Code == "EXCP").FirstOrDefault().WkflowStatId;


                wkflow.CurrWkflowStatId = statusID;

                var ccare = wkflow.Org.OrgUsers.Where(p => p.Type == "CustomerCare");

                if (ccare.Count() > 0)
                {
                    wkflow.CCUserId = ccare.FirstOrDefault().UserId;
                }

                var wkflowHist = new WkflowStepHist
                {
                    CreateDate       = DateTime.UtcNow,
                    DateLastMaint    = DateTime.UtcNow,
                    WkflowStatId     = statusID,
                    WkflowStatReasId = reasonid,
                    CreatedUserId    = userID
                };

                wkflowHist.WkflowStepNotes.Add(new WkflowStepNote()
                {
                    WkflowStepHist = wkflowHist, CreatedDate = DateTime.UtcNow, NoteText = reason, Order = 1
                });
                wkflow.WkflowStepHists.Add(wkflowHist);

                _IWkflowinstanceService.UpdateWkflowinstance(wkflow);
            }
            catch (Exception e)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            return(Request.CreateResponse <bool>(HttpStatusCode.OK, true));
        }
Пример #2
0
        public HttpResponseMessage Update(SupportActivityDTO requestInfo)
        {
            try
            {
                int userID = int.Parse(Request.Headers.GetValues("userId").FirstOrDefault());


                int?orgid;

                if (requestInfo.OrgId != null)
                {
                    orgid = requestInfo.OrgId;
                }
                else
                {
                    orgid = _IUserService.GetUser(userID).OrgUsers.Where(p => p.Type == null || p.Type.Contains("Primary")).FirstOrDefault().OrgId;
                }

                var org = _IOrgService.GetOrg((int)orgid);

                var supportWkflowInstance = _IWkflowinstanceService.GetWkflowinstance((int)requestInfo.Id);

                if (supportWkflowInstance.CCUserId != requestInfo.CCUserId)
                {
                    supportWkflowInstance.CCUserId = requestInfo.CCUserId;
                }

                if (supportWkflowInstance.Priority != requestInfo.Priority)
                {
                    supportWkflowInstance.Priority = requestInfo.Priority;
                }

                supportWkflowInstance.DateLastMaint = DateTime.UtcNow;

                if (requestInfo.NextStepId != null)
                {
                    supportWkflowInstance.CurrWkflowStatId = (int)requestInfo.NextStepId;

                    var hist = new WkflowStepHist
                    {
                        CreateDate       = DateTime.UtcNow,
                        DateLastMaint    = DateTime.UtcNow,
                        WkflowStatId     = (int)requestInfo.NextStepId,
                        CreatedUserId    = userID,
                        WkflowStatReasId = requestInfo.ReasonId
                    };
                    if (requestInfo.NewMessage != null && requestInfo.NewMessage != "")
                    {
                        hist.WkflowStepNotes.Add(new WkflowStepNote()
                        {
                            CreatedDate = DateTime.UtcNow, NoteText = requestInfo.NewMessage
                        });
                    }
                    if (requestInfo.Resolution != null && requestInfo.Resolution != "")
                    {
                        hist.WkflowStepNotes.Add(new WkflowStepNote()
                        {
                            CreatedDate = DateTime.UtcNow, NoteText = requestInfo.Resolution
                        });
                    }

                    supportWkflowInstance.WkflowStepHists.Add(hist);
                }

                _IWkflowinstanceService.UpdateWkflowinstance(supportWkflowInstance);
                return(Request.CreateResponse <bool>(HttpStatusCode.OK, true));
            }
            catch (Exception e)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }
        }