public async Task <IActionResult> PutCustomerCase(int id, CustomerCase customerCase)
        {
            if (id != customerCase.Id)
            {
                return(BadRequest());
            }

            _context.Entry(customerCase).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustomerCaseExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #2
0
        private CustomerCaseServiceResponse SaveCaseStatus(int supplierId, int customerId, int departmentId, Guid userId, bool supplierEmployeeLimitForOrder, Guid orderId)
        {
            CustomerCase @case = new CustomerCase
            {
                ForSupplierId    = supplierId,
                FromCustomerId   = customerId,
                FromDepartmentId = departmentId,
                FromUserId       = userId,
                OrderId          = orderId,
                Tracking         = EntityTracker.StartTracking(ServiceId) // not directly by user, disputable
            };

            CustomerCaseStatusEntry caseEntry = new CustomerCaseStatusEntry
            {
                Status       = (supplierEmployeeLimitForOrder) ? CaseStatus.PendingSupplier : CaseStatus.PendingInternal,
                UserComments = (supplierEmployeeLimitForOrder) ? @"Waiting for Supplier response." : @"Waiting for Support response. Customer-Case has been sent to Support.",
                Tracking     = EntityTracker.StartTracking(ServiceId) // not directly by user, disputable
            };

            @case.CaseHistory.Add(caseEntry);

            //return CustomerCaseServiceLogic.SaveCustomerCase(work, @case);

            return(_customerCaseService.SaveCustomerCase(@case));
        }
        public async Task <ActionResult <CustomerCase> > PostCustomerCase(CustomerCase customerCase)
        {
            customerCase.Created = DateTime.Now;

            _context.CustomerCase.Add(customerCase);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCustomerCase", new { id = customerCase.Id }, customerCase));
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            caseList.DataSource = CustomerCase.GetRecommendDataTable(8);
            caseList.DataBind();

            shareList.DataSource = DryShare.GetRecommendDataTable(2);
            shareList.DataBind();

            newsList.DataSource = News.GetDataTable(10000);
            newsList.DataBind();
        }
コード例 #5
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string    pageindex = context.Request["pageno"];
            string    orderstr  = "";
            string    wherestr  = "";
            DataTable dt        = CustomerCase.GetPageDataTable(orderstr, wherestr, int.Parse(pageindex), 8, out pagecount, out recordcount);
            string    result    = "";

            result = JsonConvert.SerializeObject(dt, new DataTableConverter());
            result = "{\"dataList\":" + result + ",\"num\":{\"Pagecount\":\"" + pagecount + "\"}}";
            context.Response.Write(result);
            context.Response.End();
        }
コード例 #6
0
        public List <ICustomerCase> getCustomerCaseList()
        {
            List <ICustomerCase> list = new List <ICustomerCase>();

            // get data context factory
            IDataContextFactory factory = new DataContextFactory();
            // get data context
            DataClassesDataContext context = factory.getDataContext(DataContextFactory.DB_SQL_SERVER) as DataClassesDataContext;

            // get customer cases from data context
            foreach (EnterPrise enterprise in context.EnterPrise)
            {
                ICustomerCase aCase = new CustomerCase()
                {
                    title   = enterprise.EPName,
                    imgPath = ""
                };
                list.Add(aCase);
            }

            return(list);
        }
コード例 #7
0
        public CustomerCaseServiceResponse SaveCustomerCase(CustomerCase customerCase)
        {
            Logger.Debug("SaveCustomerCase : customerId : " + customerCase?.FromCustomerId ?? "#NULL#");

            if (customerCase != null) // TODO: throw ArgumentNulLException instead
            {
                CustomerCase customerCaseModel = null;

                if (customerCase.CaseId > 0)
                {
                    customerCaseModel = this._customerCaseRepository.All.FirstOrDefault(i => i.CaseId == customerCase.CaseId);
                }

                if (customerCaseModel != null)
                {
                    customerCaseModel.Tracking.ModifiedDateTimeUtc = DateTime.UtcNow; // TODO: TASK: update tracking object with user id

                    if (customerCase.FromUserId != Guid.Empty)
                    {
                        customerCaseModel.FromUserId = customerCase.FromUserId;
                    }

                    if (customerCase.ForSupplierId > 0)
                    {
                        customerCaseModel.ForSupplierId = customerCase.ForSupplierId;
                    }

                    if (customerCase.FromCustomerId > 0)
                    {
                        customerCaseModel.FromCustomerId = customerCase.FromCustomerId;
                    }

                    if (customerCase.FromDepartmentId > 0)
                    {
                        customerCaseModel.FromDepartmentId = customerCase.FromDepartmentId;
                    }

                    this._customerCaseRepository.Update(customerCaseModel);
                    this._customerCaseRepository.SaveChanges();

                    return(new CustomerCaseServiceResponse
                    {
                        IsSuccess = true,
                        CaseId = customerCase.CaseId,
                        Message = ResponseMessage.RecordUpdated
                    });
                }
                else
                {
                    customerCase.Tracking.CreatedDateTimeUtc  = DateTime.UtcNow; // ??? this one is bad
                    customerCase.Tracking.ModifiedDateTimeUtc = DateTime.UtcNow; // TODO: TASK: update tracking object with user id

                    if (customerCase.CaseHistory != null && customerCase.CaseHistory.Count > 0)
                    {
                        foreach (var caseStatusEntry in customerCase.CaseHistory)
                        {
                            if (caseStatusEntry.EntryId == 0)
                            {
                                caseStatusEntry.Tracking.CreatedDateTimeUtc  = DateTime.UtcNow; // ??? this one is bad
                                caseStatusEntry.Tracking.ModifiedDateTimeUtc = DateTime.UtcNow; // TODO: TASK: update tracking object with user id
                            }
                        }
                    }

                    // TODO: this code is again quite bad and doing some magic with entities

                    var newCase = this._customerCaseRepository.All.FirstOrDefault(d => d.OrderId == customerCase.OrderId && customerCase.OrderId != null);
                    if (newCase == null)
                    {
                        this._customerCaseRepository.Insert(customerCase);
                        this._customerCaseRepository.SaveChanges();
                    }
                    else
                    {
                        return(new CustomerCaseServiceResponse
                        {
                            CaseId = newCase.CaseId,
                            IsSuccess = true,
                            Message = "Case Exists"
                        });
                    }
                }

                return(new CustomerCaseServiceResponse
                {
                    IsSuccess = true,
                    CaseId = customerCase.CaseId,
                    Message = ResponseMessage.RecordSaved
                });
            }

            // WARN: this will throw null-ref...
            // TODO: throw ArgumentNulLException instead on top of the function, this is not recoverable bug

            // if parameters are null then sending error response
            return(new CustomerCaseServiceResponse
            {
                IsSuccess = false,
                CaseId = customerCase.CaseId,
                Message = ResponseMessage.InvalidParam
            });
        }
コード例 #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     cc = CustomerCase.Get_CustomerCase(int.Parse(Request["id"]));
 }
コード例 #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     caseList.DataSource = CustomerCase.GetPageDataTable("", "", 1, 8, out pagecount, out recordcount);
     caseList.DataBind();
 }