コード例 #1
0
        public GetDCNumberResponseDto GetDCNumber(string WoType)
        {
            var response = new GetDCNumberResponseDto();

            var model = deliveryChallanRepository.GetDCNumber(WoType);

            var currentYear = Helper.CurrentFiniancialYear();

            if (!string.IsNullOrEmpty(model))
            {
                var savedYear = Convert.ToString(model.ToString().Substring(2, 2));
                //var currentYear = Convert.ToString(DateTime.UtcNow.Year.ToString().Substring(2, 2));

                if (!savedYear.Equals(currentYear))
                {
                    response.DCNumber = "D" + WoType + Convert.ToString(currentYear + "0001");
                }
                else
                {
                    var dcType       = Convert.ToString(model.ToString().Substring(0, 1));
                    var workOrderInc = Int32.Parse(model.ToString().Substring(2, 6)) + 1;
                    response.DCNumber = dcType + WoType + Convert.ToString(workOrderInc);
                }
            }
            else
            {
                response.DCNumber = "D" + WoType + Convert.ToString(currentYear + "0001");
            }

            return(response);
        }
コード例 #2
0
        public GetDCNumberResponseDto GetDCNumber(string WoType)
        {
            GetDCNumberResponseDto response = new GetDCNumberResponseDto();

            try
            {
                response = rDeliveryChallanProvider.GetDCNumber(WoType);
                response.ServiceResponseStatus = 1;
            }
            catch (SSException applicationException)
            {
                response = new GetDCNumberResponseDto
                {
                    ServiceResponseStatus = 0,
                    ErrorMessage          = applicationException.Message,
                    ErrorCode             = applicationException.ExceptionCode
                };
            }
            catch (Exception exception)
            {
                response = new GetDCNumberResponseDto
                {
                    ServiceResponseStatus = 0,
                    ErrorCode             = ExceptionAttributes.ExceptionCodes.InternalServerError,
                    ErrorMessage          = exception.Message
                };
            }

            return(response);
        }