Example #1
0
 public async Task <bool> Delete(RepairTicket RepairTicket)
 {
     if (await ValidateId(RepairTicket))
     {
     }
     return(RepairTicket.IsValidated);
 }
Example #2
0
 public Customer_RepairTicketDTO(RepairTicket RepairTicket)
 {
     this.Id              = RepairTicket.Id;
     this.Code            = RepairTicket.Code;
     this.DeviceSerial    = RepairTicket.DeviceSerial;
     this.OrderCategoryId = RepairTicket.OrderCategoryId;
     this.OrderId         = RepairTicket.OrderId;
     this.RepairDueDate   = RepairTicket.RepairDueDate;
     this.ItemId          = RepairTicket.ItemId;
     this.IsRejectRepair  = RepairTicket.IsRejectRepair;
     this.RejectReason    = RepairTicket.RejectReason;
     this.DeviceState     = RepairTicket.DeviceState;
     this.RepairStatusId  = RepairTicket.RepairStatusId;
     this.RepairAddess    = RepairTicket.RepairAddess;
     this.ReceiveUser     = RepairTicket.ReceiveUser;
     this.ReceiveDate     = RepairTicket.ReceiveDate;
     this.RepairDate      = RepairTicket.RepairDate;
     this.ReturnDate      = RepairTicket.ReturnDate;
     this.RepairSolution  = RepairTicket.RepairSolution;
     this.Note            = RepairTicket.Note;
     this.RepairCost      = RepairTicket.RepairCost;
     this.PaymentStatusId = RepairTicket.PaymentStatusId;
     this.CustomerId      = RepairTicket.CustomerId;
     this.CreatorId       = RepairTicket.CreatorId;
     this.Creator         = RepairTicket.Creator == null ? null : new Customer_AppUserDTO(RepairTicket.Creator);
     this.Customer        = RepairTicket.Customer == null ? null : new Customer_CustomerDTO(RepairTicket.Customer);
     this.Item            = RepairTicket.Item == null ? null : new Customer_ItemDTO(RepairTicket.Item);
     this.OrderCategory   = RepairTicket.OrderCategory == null ? null : new Customer_OrderCategoryDTO(RepairTicket.OrderCategory);
     this.PaymentStatus   = RepairTicket.PaymentStatus == null ? null : new Customer_PaymentStatusDTO(RepairTicket.PaymentStatus);
     this.RepairStatus    = RepairTicket.RepairStatus == null ? null : new Customer_RepairStatusDTO(RepairTicket.RepairStatus);
     this.CreatedAt       = RepairTicket.CreatedAt;
     this.UpdatedAt       = RepairTicket.UpdatedAt;
     this.Errors          = RepairTicket.Errors;
 }
Example #3
0
        private async Task <bool> ValidateCustomer(RepairTicket RepairTicket)
        {
            if (RepairTicket.CustomerId == 0)
            {
                RepairTicket.AddError(nameof(RepairTicketValidator), nameof(RepairTicket.Customer), ErrorCode.CustomerEmpty);
            }
            else
            {
                CustomerFilter CustomerFilter = new CustomerFilter
                {
                    Id = new IdFilter {
                        Equal = RepairTicket.CustomerId
                    },
                    StatusId = new IdFilter {
                        Equal = StatusEnum.ACTIVE.Id
                    }
                };

                var count = await UOW.CustomerRepository.Count(CustomerFilter);

                if (count == 0)
                {
                    RepairTicket.AddError(nameof(RepairTicketValidator), nameof(RepairTicket.Customer), ErrorCode.CustomerNotExisted);
                }
            }
            return(RepairTicket.IsValidated);
        }
        public async Task <ActionResult <RepairTicket_RepairTicketDTO> > Delete([FromBody] RepairTicket_RepairTicketDTO RepairTicket_RepairTicketDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            if (!await HasPermission(RepairTicket_RepairTicketDTO.Id))
            {
                return(Forbid());
            }

            RepairTicket RepairTicket = ConvertDTOToEntity(RepairTicket_RepairTicketDTO);

            RepairTicket = await RepairTicketService.Delete(RepairTicket);

            RepairTicket_RepairTicketDTO = new RepairTicket_RepairTicketDTO(RepairTicket);
            if (RepairTicket.IsValidated)
            {
                return(RepairTicket_RepairTicketDTO);
            }
            else
            {
                return(BadRequest(RepairTicket_RepairTicketDTO));
            }
        }
Example #5
0
 private async Task <bool> ValidateItem(RepairTicket RepairTicket)
 {
     if (RepairTicket.ItemId == 0)
     {
         RepairTicket.AddError(nameof(RepairTicketValidator), nameof(RepairTicket.Item), ErrorCode.ItemEmpty);
     }
     return(RepairTicket.IsValidated);
 }
Example #6
0
 private async Task <bool> ValidateOrder(RepairTicket RepairTicket)
 {
     if (RepairTicket.OrderId == 0)
     {
         RepairTicket.AddError(nameof(RepairTicketValidator), nameof(RepairTicket.OrderId), ErrorCode.OrderEmpty);
     }
     return(RepairTicket.IsValidated);
 }
Example #7
0
        public async Task <bool> Delete(RepairTicket RepairTicket)
        {
            await DataContext.RepairTicket.Where(x => x.Id == RepairTicket.Id).UpdateFromQueryAsync(x => new RepairTicketDAO {
                DeletedAt = StaticParams.DateTimeNow, UpdatedAt = StaticParams.DateTimeNow
            });

            return(true);
        }
Example #8
0
 //Post
 public HttpResponseMessage Post(RepairTicket ticket)
 {
     ticket.TicketId = Guid.NewGuid().ToString();
     ticket.CreatedRepairTicketDateTime = DateTime.Now;
     repairTicketManager.AddTicket(ticket);
     repairTicketManager.Save();
     return(Request.CreateResponse(HttpStatusCode.Accepted));
 }
Example #9
0
        public async Task <bool> Create(RepairTicket RepairTicket)
        {
            await ValidateCode(RepairTicket);
            await ValidateDeviceSerial(RepairTicket);
            await ValidateDeviceState(RepairTicket);
            await ValidateOrderCategory(RepairTicket);
            await ValidateOrder(RepairTicket);
            await ValidateItem(RepairTicket);
            await ValidateCustomer(RepairTicket);

            return(RepairTicket.IsValidated);
        }
        public async Task <ActionResult <Customer_RepairTicketDTO> > GetRepairTicket([FromBody] Customer_RepairTicketDTO Customer_RepairTicketDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            RepairTicket RepairTicket = await RepairTicketService.Get(Customer_RepairTicketDTO.Id);

            return(new Customer_RepairTicketDTO(RepairTicket));
        }
Example #11
0
 private async Task <bool> ValidateDeviceState(RepairTicket RepairTicket)
 {
     if (string.IsNullOrWhiteSpace(RepairTicket.DeviceState))
     {
         RepairTicket.AddError(nameof(RepairTicketValidator), nameof(RepairTicket.DeviceState), ErrorCode.DeviceStateEmpty);
     }
     else
     {
         if (RepairTicket.DeviceState.Length > 500)
         {
             RepairTicket.AddError(nameof(RepairTicketValidator), nameof(RepairTicket.DeviceState), ErrorCode.DeviceStateOverLength);
         }
     }
     return(RepairTicket.IsValidated);
 }
Example #12
0
        private async Task <bool> ValidateOrderCategory(RepairTicket RepairTicket)
        {
            if (RepairTicket.OrderCategoryId == 0)
            {
                RepairTicket.AddError(nameof(RepairTicketValidator), nameof(RepairTicket.OrderCategoryId), ErrorCode.OrderCategoryEmpty);
            }
            else
            {
                var OrderCategoryIds = OrderCategoryEnum.OrderCategoryEnumList.Select(x => x.Id).ToList();
                if (!OrderCategoryIds.Contains(RepairTicket.OrderCategoryId))
                {
                    RepairTicket.AddError(nameof(RepairTicketValidator), nameof(RepairTicket.OrderCategoryId), ErrorCode.OrderCategoryNotExisted);
                }
            }

            return(RepairTicket.IsValidated);
        }
Example #13
0
        private async Task <bool> ValidateCode(RepairTicket RepairTicket)
        {
            if (string.IsNullOrWhiteSpace(RepairTicket.Code))
            {
                RepairTicket.AddError(nameof(RepairTicketValidator), nameof(RepairTicket.Code), ErrorCode.CodeEmpty);
            }
            else
            {
                var Code = RepairTicket.Code;
                if (RepairTicket.Code.Contains(" ") || !FilterExtension.ChangeToEnglishChar(Code).Equals(RepairTicket.Code))
                {
                    RepairTicket.AddError(nameof(RepairTicketValidator), nameof(RepairTicket.Code), ErrorCode.CodeHasSpecialCharacter);
                }
                else
                {
                    if (RepairTicket.Code.Length > 255)
                    {
                        RepairTicket.AddError(nameof(RepairTicketValidator), nameof(RepairTicket.Code), ErrorCode.CodeOverLength);
                    }
                    else
                    {
                        RepairTicketFilter RepairTicketFilter = new RepairTicketFilter
                        {
                            Skip = 0,
                            Take = 10,
                            Id   = new IdFilter {
                                NotEqual = RepairTicket.Id
                            },
                            Code = new StringFilter {
                                Equal = RepairTicket.Code
                            },
                            Selects = RepairTicketSelect.Code
                        };

                        int count = await UOW.RepairTicketRepository.Count(RepairTicketFilter);

                        if (count != 0)
                        {
                            RepairTicket.AddError(nameof(RepairTicketValidator), nameof(RepairTicket.Code), ErrorCode.CodeExisted);
                        }
                    }
                }
            }
            return(RepairTicket.IsValidated);
        }
Example #14
0
        public async Task <RepairTicket> Get(long Id)
        {
            RepairTicket RepairTicket = await UOW.RepairTicketRepository.Get(Id);

            if (RepairTicket == null)
            {
                return(null);
            }

            if (RepairTicket.OrderCategoryId == OrderCategoryEnum.ORDER_CUSTOMER.Id)
            {
                RepairTicket.CustomerSalesOrder = await UOW.CustomerSalesOrderRepository.Get(RepairTicket.OrderId);
            }
            if (RepairTicket.OrderCategoryId == OrderCategoryEnum.ORDER_DIRECT.Id)
            {
                RepairTicket.DirectSalesOrder = await UOW.DirectSalesOrderRepository.Get(RepairTicket.OrderId);
            }
            return(RepairTicket);
        }
        /// <summary>
        /// Get the color of the ticket depending on the tickets status.
        /// This is used for dynamic css.
        /// </summary>
        /// <param name="rt"></param>
        /// <returns></returns>
        public string GetColor(RepairTicket rt)
        {
            switch (rt.status)
            {
            case Constants.NEW:
                return("new-card");

            case Constants.WAITING_ON_CUSTOMER:
                return("waiting-on-customer-card");

            case Constants.READY_TO_REPAIR:
                return("ready-to-repair-card");

            case Constants.WAITING_FOR_PARTS:
                return("waiting-for-parts-card");

            case Constants.CUSTOMER_REPLY:
                return("customer-reply-card");

            case Constants.RESOLVED:
                return("resolved-card");

            case Constants.SENT_OFFSITE:
                return("sent-offsite-card");

            case Constants.READY_FOR_PICKUP:
                return("ready-for-pickup-card");

            case Constants.IN_PROGRESS:
                return("in-progress-card");

            case Constants.RUSH:
                return("rush-card");

            case Constants.CORPORATE_CUSTOMER:
                return("corporate-card");

            default:
                break;
            }
            return("");
        }
        /// <summary>
        /// Get the icon for the ticket depending on the tickets status.
        /// </summary>
        /// <param name="rt"></param>
        /// <returns></returns>
        public string GetIcon(RepairTicket rt)
        {
            switch (rt.status)
            {
            case Constants.NEW:
                return("add");

            case Constants.WAITING_ON_CUSTOMER:
                return("hourglass_bottom");

            case Constants.READY_TO_REPAIR:
                return("thumb_up_alt");

            case Constants.WAITING_FOR_PARTS:
                return("pending");

            case Constants.CUSTOMER_REPLY:
                return("reply");

            case Constants.RESOLVED:
                return("grade");

            case Constants.SENT_OFFSITE:
                return("call");

            case Constants.READY_FOR_PICKUP:
                return("done");

            case Constants.IN_PROGRESS:
                return("build");

            case Constants.RUSH:
                return("flash_on");

            case Constants.CORPORATE_CUSTOMER:
                return("corporate_fare");

            default:
                break;
            }
            return("");
        }
Example #17
0
        public async Task <ActionResult <RepairTicket_RepairTicketDTO> > Get([FromBody] RepairTicket_RepairTicketDTO RepairTicket_RepairTicketDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            if (!await HasPermission(RepairTicket_RepairTicketDTO.Id))
            {
                return(Forbid());
            }

            RepairTicket RepairTicket = await RepairTicketService.Get(RepairTicket_RepairTicketDTO.Id);

            return(new RepairTicket_RepairTicketDTO(RepairTicket));
        }
Example #18
0
        public async Task <bool> ValidateId(RepairTicket RepairTicket)
        {
            RepairTicketFilter RepairTicketFilter = new RepairTicketFilter
            {
                Skip = 0,
                Take = 10,
                Id   = new IdFilter {
                    Equal = RepairTicket.Id
                },
                Selects = RepairTicketSelect.Id
            };

            int count = await UOW.RepairTicketRepository.Count(RepairTicketFilter);

            if (count == 0)
            {
                RepairTicket.AddError(nameof(RepairTicketValidator), nameof(RepairTicket.Id), ErrorCode.IdNotExisted);
            }
            return(count == 1);
        }
Example #19
0
        public async Task <RepairTicket> Delete(RepairTicket RepairTicket)
        {
            if (!await RepairTicketValidator.Delete(RepairTicket))
            {
                return(RepairTicket);
            }

            try
            {
                await UOW.RepairTicketRepository.Delete(RepairTicket);

                await Logging.CreateAuditLog(new { }, RepairTicket, nameof(RepairTicketService));

                return(RepairTicket);
            }
            catch (Exception ex)
            {
                await Logging.CreateSystemLog(ex, nameof(RepairTicketService));
            }
            return(null);
        }
Example #20
0
        public static string GetColor(RepairTicket rt)
        {
            switch (rt.status)
            {
            case "New":
                return("new-card");

            case "Waiting on Customer":
                return("waiting-on-customer-card");

            case "Ready to Repair":
                return("ready-to-repair-card");

            case "Waiting for Parts":
                return("waiting-for-parts-card");

            case "Customer Reply":
                return("customer-reply-card");

            case "Resolved":
                return("resolved-card");

            case "Sent Offsite":
                return("sent-offsite-card");

            case "Ready for Pickup":
                return("ready-for-pickup-card");

            case "In Progress":
                return("in-progress-card");

            case "Rush":
                return("rush-card");

            default:
                break;
            }
            return("");
        }
Example #21
0
        public async Task <bool> Update(RepairTicket RepairTicket)
        {
            RepairTicketDAO RepairTicketDAO = DataContext.RepairTicket.Where(x => x.Id == RepairTicket.Id).FirstOrDefault();

            if (RepairTicketDAO == null)
            {
                return(false);
            }
            RepairTicketDAO.Id              = RepairTicket.Id;
            RepairTicketDAO.Code            = RepairTicket.Code;
            RepairTicketDAO.DeviceSerial    = RepairTicket.DeviceSerial;
            RepairTicketDAO.OrderId         = RepairTicket.OrderId;
            RepairTicketDAO.OrderCategoryId = RepairTicket.OrderCategoryId;
            RepairTicketDAO.RepairDueDate   = RepairTicket.RepairDueDate;
            RepairTicketDAO.ItemId          = RepairTicket.ItemId;
            RepairTicketDAO.IsRejectRepair  = RepairTicket.IsRejectRepair;
            RepairTicketDAO.RejectReason    = RepairTicket.RejectReason;
            RepairTicketDAO.DeviceState     = RepairTicket.DeviceState;
            RepairTicketDAO.RepairStatusId  = RepairTicket.RepairStatusId;
            RepairTicketDAO.RepairAddess    = RepairTicket.RepairAddess;
            RepairTicketDAO.ReceiveUser     = RepairTicket.ReceiveUser;
            RepairTicketDAO.ReceiveDate     = RepairTicket.ReceiveDate;
            RepairTicketDAO.RepairDate      = RepairTicket.RepairDate;
            RepairTicketDAO.ReturnDate      = RepairTicket.ReturnDate;
            RepairTicketDAO.RepairSolution  = RepairTicket.RepairSolution;
            RepairTicketDAO.Note            = RepairTicket.Note;
            RepairTicketDAO.RepairCost      = RepairTicket.RepairCost;
            RepairTicketDAO.PaymentStatusId = RepairTicket.PaymentStatusId;
            RepairTicketDAO.CustomerId      = RepairTicket.CustomerId;
            RepairTicketDAO.CreatorId       = RepairTicket.CreatorId;
            RepairTicketDAO.UpdatedAt       = StaticParams.DateTimeNow;
            await DataContext.SaveChangesAsync();

            await SaveReference(RepairTicket);

            return(true);
        }
Example #22
0
        public async Task <RepairTicket> Update(RepairTicket RepairTicket)
        {
            if (!await RepairTicketValidator.Update(RepairTicket))
            {
                return(RepairTicket);
            }
            try
            {
                var oldData = await UOW.RepairTicketRepository.Get(RepairTicket.Id);

                await UOW.RepairTicketRepository.Update(RepairTicket);

                RepairTicket = await UOW.RepairTicketRepository.Get(RepairTicket.Id);

                await Logging.CreateAuditLog(RepairTicket, oldData, nameof(RepairTicketService));

                return(RepairTicket);
            }
            catch (Exception ex)
            {
                await Logging.CreateSystemLog(ex, nameof(RepairTicketService));
            }
            return(null);
        }
Example #23
0
        public async Task <bool> Create(RepairTicket RepairTicket)
        {
            RepairTicketDAO RepairTicketDAO = new RepairTicketDAO();

            RepairTicketDAO.Id              = RepairTicket.Id;
            RepairTicketDAO.Code            = RepairTicket.Code;
            RepairTicketDAO.DeviceSerial    = RepairTicket.DeviceSerial;
            RepairTicketDAO.OrderId         = RepairTicket.OrderId;
            RepairTicketDAO.OrderCategoryId = RepairTicket.OrderCategoryId;
            RepairTicketDAO.RepairDueDate   = RepairTicket.RepairDueDate;
            RepairTicketDAO.ItemId          = RepairTicket.ItemId;
            RepairTicketDAO.IsRejectRepair  = RepairTicket.IsRejectRepair;
            RepairTicketDAO.RejectReason    = RepairTicket.RejectReason;
            RepairTicketDAO.DeviceState     = RepairTicket.DeviceState;
            RepairTicketDAO.RepairStatusId  = RepairTicket.RepairStatusId;
            RepairTicketDAO.RepairAddess    = RepairTicket.RepairAddess;
            RepairTicketDAO.ReceiveUser     = RepairTicket.ReceiveUser;
            RepairTicketDAO.ReceiveDate     = RepairTicket.ReceiveDate;
            RepairTicketDAO.RepairDate      = RepairTicket.RepairDate;
            RepairTicketDAO.ReturnDate      = RepairTicket.ReturnDate;
            RepairTicketDAO.RepairSolution  = RepairTicket.RepairSolution;
            RepairTicketDAO.Note            = RepairTicket.Note;
            RepairTicketDAO.RepairCost      = RepairTicket.RepairCost;
            RepairTicketDAO.PaymentStatusId = RepairTicket.PaymentStatusId;
            RepairTicketDAO.CustomerId      = RepairTicket.CustomerId;
            RepairTicketDAO.CreatorId       = RepairTicket.CreatorId;
            RepairTicketDAO.CreatedAt       = StaticParams.DateTimeNow;
            RepairTicketDAO.UpdatedAt       = StaticParams.DateTimeNow;
            DataContext.RepairTicket.Add(RepairTicketDAO);
            await DataContext.SaveChangesAsync();

            RepairTicket.Id = RepairTicketDAO.Id;
            await SaveReference(RepairTicket);

            return(true);
        }
Example #24
0
        public async Task <RepairTicket> Create(RepairTicket RepairTicket)
        {
            if (!await RepairTicketValidator.Create(RepairTicket))
            {
                return(RepairTicket);
            }

            try
            {
                RepairTicket.CreatorId = CurrentContext.UserId;
                await UOW.RepairTicketRepository.Create(RepairTicket);

                RepairTicket = await UOW.RepairTicketRepository.Get(RepairTicket.Id);

                await Logging.CreateAuditLog(RepairTicket, new { }, nameof(RepairTicketService));

                return(RepairTicket);
            }
            catch (Exception ex)
            {
                await Logging.CreateSystemLog(ex, nameof(RepairTicketService));
            }
            return(null);
        }
Example #25
0
        public async Task <RepairTicket> Get(long Id)
        {
            RepairTicket RepairTicket = await DataContext.RepairTicket.AsNoTracking()
                                        .Where(x => x.Id == Id)
                                        .Where(x => x.DeletedAt == null)
                                        .Select(x => new RepairTicket()
            {
                CreatedAt       = x.CreatedAt,
                UpdatedAt       = x.UpdatedAt,
                Id              = x.Id,
                Code            = x.Code,
                DeviceSerial    = x.DeviceSerial,
                OrderId         = x.OrderId,
                OrderCategoryId = x.OrderCategoryId,
                RepairDueDate   = x.RepairDueDate,
                ItemId          = x.ItemId,
                IsRejectRepair  = x.IsRejectRepair,
                RejectReason    = x.RejectReason,
                DeviceState     = x.DeviceState,
                RepairStatusId  = x.RepairStatusId,
                RepairAddess    = x.RepairAddess,
                ReceiveUser     = x.ReceiveUser,
                ReceiveDate     = x.ReceiveDate,
                RepairDate      = x.RepairDate,
                ReturnDate      = x.ReturnDate,
                RepairSolution  = x.RepairSolution,
                Note            = x.Note,
                RepairCost      = x.RepairCost,
                PaymentStatusId = x.PaymentStatusId,
                CustomerId      = x.CustomerId,
                CreatorId       = x.CreatorId,
                Creator         = x.Creator == null ? null : new AppUser
                {
                    Id             = x.Creator.Id,
                    Username       = x.Creator.Username,
                    DisplayName    = x.Creator.DisplayName,
                    Address        = x.Creator.Address,
                    Email          = x.Creator.Email,
                    Phone          = x.Creator.Phone,
                    SexId          = x.Creator.SexId,
                    Birthday       = x.Creator.Birthday,
                    Avatar         = x.Creator.Avatar,
                    Department     = x.Creator.Department,
                    OrganizationId = x.Creator.OrganizationId,
                    Longitude      = x.Creator.Longitude,
                    Latitude       = x.Creator.Latitude,
                    StatusId       = x.Creator.StatusId,
                    RowId          = x.Creator.RowId,
                    Used           = x.Creator.Used,
                },
                Customer = x.Customer == null ? null : new Customer
                {
                    Id           = x.Customer.Id,
                    Code         = x.Customer.Code,
                    Name         = x.Customer.Name,
                    Phone        = x.Customer.Phone,
                    Email        = x.Customer.Email,
                    Address      = x.Customer.Address,
                    StatusId     = x.Customer.StatusId,
                    NationId     = x.Customer.NationId,
                    ProvinceId   = x.Customer.ProvinceId,
                    DistrictId   = x.Customer.DistrictId,
                    WardId       = x.Customer.WardId,
                    ProfessionId = x.Customer.ProfessionId,
                    Used         = x.Customer.Used,
                },
                Item = x.Item == null ? null : new Item
                {
                    Id          = x.Item.Id,
                    ProductId   = x.Item.ProductId,
                    Code        = x.Item.Code,
                    Name        = x.Item.Name,
                    ScanCode    = x.Item.ScanCode,
                    SalePrice   = x.Item.SalePrice,
                    RetailPrice = x.Item.RetailPrice,
                    StatusId    = x.Item.StatusId,
                    Used        = x.Item.Used,
                    RowId       = x.Item.RowId,
                },
                OrderCategory = x.OrderCategory == null ? null : new OrderCategory
                {
                    Id   = x.OrderCategory.Id,
                    Code = x.OrderCategory.Code,
                    Name = x.OrderCategory.Name,
                },
                PaymentStatus = x.PaymentStatus == null ? null : new PaymentStatus
                {
                    Id   = x.PaymentStatus.Id,
                    Code = x.PaymentStatus.Code,
                    Name = x.PaymentStatus.Name,
                },
                RepairStatus = x.RepairStatus == null ? null : new RepairStatus
                {
                    Id   = x.RepairStatus.Id,
                    Name = x.RepairStatus.Name,
                    Code = x.RepairStatus.Code,
                },
            }).FirstOrDefaultAsync();

            if (RepairTicket == null)
            {
                return(null);
            }

            return(RepairTicket);
        }
Example #26
0
 public void AddTicket(RepairTicket ticket)
 {
     repairTicketManager.Add(ticket);
 }
Example #27
0
 public void DeleteTicket(RepairTicket ticket)
 {
     repairTicketManager.Delete(ticket);
 }
Example #28
0
        public void UpdateTicket(RepairTicket ticket)
        {
            var originalTicket = repairTicketManager.GetQuery().Where(t => t.TicketId == ticket.TicketId).LastOrDefault() ?? null;

            repairTicketManager.Update(originalTicket, ticket);
        }
Example #29
0
 private async Task SaveReference(RepairTicket RepairTicket)
 {
 }
Example #30
0
        private RepairTicket ConvertDTOToEntity(RepairTicket_RepairTicketDTO RepairTicket_RepairTicketDTO)
        {
            RepairTicket RepairTicket = new RepairTicket();

            RepairTicket.Id              = RepairTicket_RepairTicketDTO.Id;
            RepairTicket.Code            = RepairTicket_RepairTicketDTO.Code;
            RepairTicket.DeviceSerial    = RepairTicket_RepairTicketDTO.DeviceSerial;
            RepairTicket.OrderId         = RepairTicket_RepairTicketDTO.OrderId;
            RepairTicket.OrderCategoryId = RepairTicket_RepairTicketDTO.OrderCategoryId;
            RepairTicket.RepairDueDate   = RepairTicket_RepairTicketDTO.RepairDueDate;
            RepairTicket.ItemId          = RepairTicket_RepairTicketDTO.ItemId;
            RepairTicket.IsRejectRepair  = RepairTicket_RepairTicketDTO.IsRejectRepair;
            RepairTicket.RejectReason    = RepairTicket_RepairTicketDTO.RejectReason;
            RepairTicket.DeviceState     = RepairTicket_RepairTicketDTO.DeviceState;
            RepairTicket.RepairStatusId  = RepairTicket_RepairTicketDTO.RepairStatusId;
            RepairTicket.RepairAddess    = RepairTicket_RepairTicketDTO.RepairAddess;
            RepairTicket.ReceiveUser     = RepairTicket_RepairTicketDTO.ReceiveUser;
            RepairTicket.ReceiveDate     = RepairTicket_RepairTicketDTO.ReceiveDate;
            RepairTicket.RepairDate      = RepairTicket_RepairTicketDTO.RepairDate;
            RepairTicket.ReturnDate      = RepairTicket_RepairTicketDTO.ReturnDate;
            RepairTicket.RepairSolution  = RepairTicket_RepairTicketDTO.RepairSolution;
            RepairTicket.Note            = RepairTicket_RepairTicketDTO.Note;
            RepairTicket.RepairCost      = RepairTicket_RepairTicketDTO.RepairCost;
            RepairTicket.PaymentStatusId = RepairTicket_RepairTicketDTO.PaymentStatusId;
            RepairTicket.CustomerId      = RepairTicket_RepairTicketDTO.CustomerId;
            RepairTicket.CreatorId       = RepairTicket_RepairTicketDTO.CreatorId;
            RepairTicket.Creator         = RepairTicket_RepairTicketDTO.Creator == null ? null : new AppUser
            {
                Id             = RepairTicket_RepairTicketDTO.Creator.Id,
                Username       = RepairTicket_RepairTicketDTO.Creator.Username,
                DisplayName    = RepairTicket_RepairTicketDTO.Creator.DisplayName,
                Address        = RepairTicket_RepairTicketDTO.Creator.Address,
                Email          = RepairTicket_RepairTicketDTO.Creator.Email,
                Phone          = RepairTicket_RepairTicketDTO.Creator.Phone,
                SexId          = RepairTicket_RepairTicketDTO.Creator.SexId,
                Birthday       = RepairTicket_RepairTicketDTO.Creator.Birthday,
                Avatar         = RepairTicket_RepairTicketDTO.Creator.Avatar,
                Department     = RepairTicket_RepairTicketDTO.Creator.Department,
                OrganizationId = RepairTicket_RepairTicketDTO.Creator.OrganizationId,
                Longitude      = RepairTicket_RepairTicketDTO.Creator.Longitude,
                Latitude       = RepairTicket_RepairTicketDTO.Creator.Latitude,
                StatusId       = RepairTicket_RepairTicketDTO.Creator.StatusId,
                RowId          = RepairTicket_RepairTicketDTO.Creator.RowId,
                Used           = RepairTicket_RepairTicketDTO.Creator.Used,
            };
            RepairTicket.Customer = RepairTicket_RepairTicketDTO.Customer == null ? null : new Customer
            {
                Id           = RepairTicket_RepairTicketDTO.Customer.Id,
                Code         = RepairTicket_RepairTicketDTO.Customer.Code,
                Name         = RepairTicket_RepairTicketDTO.Customer.FullName,
                Phone        = RepairTicket_RepairTicketDTO.Customer.Phone,
                Email        = RepairTicket_RepairTicketDTO.Customer.Email,
                Address      = RepairTicket_RepairTicketDTO.Customer.Address,
                StatusId     = RepairTicket_RepairTicketDTO.Customer.StatusId,
                NationId     = RepairTicket_RepairTicketDTO.Customer.NationId,
                ProvinceId   = RepairTicket_RepairTicketDTO.Customer.ProvinceId,
                DistrictId   = RepairTicket_RepairTicketDTO.Customer.DistrictId,
                WardId       = RepairTicket_RepairTicketDTO.Customer.WardId,
                ProfessionId = RepairTicket_RepairTicketDTO.Customer.ProfessionId,
            };
            RepairTicket.Item = RepairTicket_RepairTicketDTO.Item == null ? null : new Item
            {
                Id          = RepairTicket_RepairTicketDTO.Item.Id,
                ProductId   = RepairTicket_RepairTicketDTO.Item.ProductId,
                Code        = RepairTicket_RepairTicketDTO.Item.Code,
                Name        = RepairTicket_RepairTicketDTO.Item.Name,
                ScanCode    = RepairTicket_RepairTicketDTO.Item.ScanCode,
                SalePrice   = RepairTicket_RepairTicketDTO.Item.SalePrice,
                RetailPrice = RepairTicket_RepairTicketDTO.Item.RetailPrice,
                StatusId    = RepairTicket_RepairTicketDTO.Item.StatusId,
                Used        = RepairTicket_RepairTicketDTO.Item.Used,
                RowId       = RepairTicket_RepairTicketDTO.Item.RowId,
            };
            RepairTicket.OrderCategory = RepairTicket_RepairTicketDTO.OrderCategory == null ? null : new OrderCategory
            {
                Id   = RepairTicket_RepairTicketDTO.OrderCategory.Id,
                Code = RepairTicket_RepairTicketDTO.OrderCategory.Code,
                Name = RepairTicket_RepairTicketDTO.OrderCategory.Name,
            };
            RepairTicket.PaymentStatus = RepairTicket_RepairTicketDTO.PaymentStatus == null ? null : new PaymentStatus
            {
                Id   = RepairTicket_RepairTicketDTO.PaymentStatus.Id,
                Code = RepairTicket_RepairTicketDTO.PaymentStatus.Code,
                Name = RepairTicket_RepairTicketDTO.PaymentStatus.Name,
            };
            RepairTicket.RepairStatus = RepairTicket_RepairTicketDTO.RepairStatus == null ? null : new RepairStatus
            {
                Id   = RepairTicket_RepairTicketDTO.RepairStatus.Id,
                Name = RepairTicket_RepairTicketDTO.RepairStatus.Name,
                Code = RepairTicket_RepairTicketDTO.RepairStatus.Code,
            };
            RepairTicket.BaseLanguage = CurrentContext.Language;
            return(RepairTicket);
        }