public GPSendingNumberResponseDto getGPSendingNumber(string gpType) { var response = new GPSendingNumberResponseDto(); var model = gatePassRepository.getGPSendingNumber(gpType); var currentYear = Helper.CurrentFiniancialYear(); if (!string.IsNullOrEmpty(model)) { var savedYear = Convert.ToString(model.ToString().Substring(1, 2)); if (!savedYear.Equals(currentYear)) { response.GPNumber = "G" + Convert.ToString(currentYear + "I" + gpType + "0001"); } else { var gpnumbernc = (Int32.Parse(model.ToString().Substring(model.ToString().Length - 4)) + 1).ToString().PadLeft(4, '0'); response.GPNumber = "G" + Convert.ToString(currentYear + "I" + gpType + gpnumbernc); } } else { response.GPNumber = "G" + Convert.ToString(currentYear + "I" + gpType + "0001"); } return(response); }
public GPSendingNumberResponseDto getGPSendingNumber(string gpType) { GPSendingNumberResponseDto gPSendingNumberResponseDto; try { gPSendingNumberResponseDto = reportGatePass.getGPSendingNumber(gpType); gPSendingNumberResponseDto.ServiceResponseStatus = 1; } catch (SSException exception) { gPSendingNumberResponseDto = new GPSendingNumberResponseDto { ServiceResponseStatus = 0, ErrorMessage = exception.Message, ErrorCode = exception.ExceptionCode }; } catch (Exception exception) { gPSendingNumberResponseDto = new GPSendingNumberResponseDto { ServiceResponseStatus = 0, ErrorCode = ExceptionAttributes.ExceptionCodes.InternalServerError, ErrorMessage = exception.Message }; } return(gPSendingNumberResponseDto); }