Exemplo n.º 1
0
        public GetWorkOrderNumberResponseDto GetWorkOrderNumber()
        {
            var response = new GetWorkOrderNumberResponseDto();

            var model       = workOrderTypeRepository.GetWorkOrderNumber();
            var currentYear = Helper.CurrentFiniancialYear();

            if (!string.IsNullOrEmpty(model))
            {
                var savedYear = Convert.ToString(model.ToString().Substring(0, 2));


                if (!savedYear.Equals(currentYear))
                {
                    response.WorkOrderNumber = Convert.ToString(currentYear + "0001");
                }
                else
                {
                    var workOrderInc = Int32.Parse(model) + 1;
                    response.WorkOrderNumber = Convert.ToString(workOrderInc);
                }
            }
            else
            {
                response.WorkOrderNumber = Convert.ToString(currentYear + "0001");
            }

            return(response);
        }