public static AMQPOutcome getOutcome(TLVList list)
        {
            AMQPOutcome outcome = null;

            Byte       byteCode = list.Constructor.getDescriptorCode().Value;
            StateCodes code     = (StateCodes)byteCode;

            switch (code)
            {
            case StateCodes.ACCEPTED:
                outcome = new AMQPAccepted();
                break;

            case StateCodes.MODIFIED:
                outcome = new AMQPModified();
                break;

            case StateCodes.REJECTED:
                outcome = new AMQPRejected();
                break;

            case StateCodes.RELEASED:
                outcome = new AMQPReleased();
                break;

            default:
                throw new MalformedMessageException("Received header with unrecognized outcome code");
            }
            return(outcome);
        }
Exemple #2
0
 public GstRequest(string _searchType, string _practitionerName, StateCodes _stateCode, string _districtCode, string _pinCode)
 {
     SearchType       = _searchType;
     PractitionerName = _practitionerName;
     StateCode        = $"{(int) _stateCode:D2}";
     DistrictCode     = _districtCode;
     PinCode          = _pinCode;
 }
        public List <string> GetStatesSearchByStreet(string street)
        {
            System.Threading.Thread.Sleep(2000); //rate limit if api is consumed free
            var response = SendRequest(street);

            return(response.Data == null || response.Data[0].Address == null || response.Data[0].Address.Count == 0? new List <string> {
                ErrorMessages.NoStateFound
            } :
                   response.Data.SelectMany(x => x.Address).Select(y => y.ExtendedState).ToList()
                   .Select(state => StateCodes.GetStateCode(state, _listOfStates)).ToList());
        }
Exemple #4
0
 public Address(long addressId, string address1, string address2, string address3,
                string city, StateCodes state, string zipcode, string province, CountryCodes countrycode)
     : this()
 {
     AddressId   = addressId;
     Address1    = address1;
     Address2    = address2;
     Address3    = address3;
     City        = city;
     State       = state;
     ZipCode     = zipcode;
     Province    = province;
     CountryCode = countrycode;
 }
Exemple #5
0
 /*****
  *
  * Update the state in the table
  * from the send command
  *
  * ****/
 public void changeState(Guid RequestId, StateCodes state)
 {
     using (var context = new MVCAppEntities())
     {
         /****
          * Update the row selected with
          * the new state                 * ***/
         var row = context.Paymessages.Where(x => x.EventId == RequestId).FirstOrDefault();
         if (row != null)
         {
             Paymessage new_row = new Paymessage();
             new_row.error = row.error;
             new_row.EventId = row.EventId;
             new_row.id = row.id;
             new_row.state = state.ToString();
             context.Entry(row).CurrentValues.SetValues(new_row);
             context.SaveChanges();
         }
     }
 }
 private string Failure(StateCodes stateCode, string errorMessage)
 {
     this.LastResult = stateCode;
     this.LastResultMsg = errorMessage;
     return null;
 }
 static SmppStatusCodes()
 {
     Codes.Add(0, "Command executed successfully");
     Codes.Add(1, "Message Length is invalid");
     Codes.Add(2, "Command Length is invalid");
     Codes.Add(3, "Invalid Command ID");
     Codes.Add(4, "Incorrect BIND Status for given command");
     Codes.Add(5, "ESME Already in Bound State");
     Codes.Add(6, "Invalid Priority Flag");
     Codes.Add(7, "Invalid Registered Delivery Flag");
     Codes.Add(8, "System Error");
     Codes.Add(10, "Invalid Source Address");
     Codes.Add(11, "Invalid Destination Address");
     Codes.Add(12, "Message ID is invalid");
     Codes.Add(13, "Bind Failed");
     Codes.Add(14, "Invalid Password");
     Codes.Add(15, "Invalid System ID");
     Codes.Add(0x11, "Cancel SM Failed");
     Codes.Add(0x13, "Replace SM Failed");
     Codes.Add(20, "Message Queue Full");
     Codes.Add(0x15, "Invalid Service Type");
     Codes.Add(0x33, "Invalid number of destinations");
     Codes.Add(0x34, "Invalid Distribution List name");
     Codes.Add(0x40, "Destination flag is invalid (submit_multi)");
     Codes.Add(0x42,
               "Submit w/replace functionality has been requested where it is either unsupported or inappropriate for the particular MC");
     Codes.Add(0x43, "Invalid esm_class field data");
     Codes.Add(0x44, "Cannot Submit to Distribution List");
     Codes.Add(0x45, "submit_sm, data_sm or submit_multi failed");
     Codes.Add(0x48, "Invalid Source address TON");
     Codes.Add(0x49, "Invalid Source address NPI");
     Codes.Add(80, "Invalid Destination address TON");
     Codes.Add(0x51, "Invalid Destination address NPI");
     Codes.Add(0x53, "Invalid system_type field");
     Codes.Add(0x54, "Invalid replace_if_present flag");
     Codes.Add(0x55, "Invalid number of messages");
     Codes.Add(0x58, "Throttling error (ESME has exceeded allowed message limits)");
     Codes.Add(0x61, "Invalid Scheduled Delivery Time");
     Codes.Add(0x62, "Invalid message validity period (Expiry time)");
     Codes.Add(0x63, "Predefined Message ID is Invalid or specified predefined message was not found");
     Codes.Add(100, "ESME Receiver Temporary App Error Code");
     Codes.Add(0x65, "ESME Receiver Permanent App Error Code");
     Codes.Add(0x66, "ESME Receiver Reject Message Error Code");
     Codes.Add(0x67, "Query_Sm request failed");
     Codes.Add(0xc0, "Error in the optional part of the PDU Body");
     Codes.Add(0xc1, "TLV not allowed");
     Codes.Add(0xc2, "Invalid Parameter Length");
     Codes.Add(0xc3, "Expected TLV missing");
     Codes.Add(0xc4, "Invalid TLV Value");
     Codes.Add(0xfe, "Transaction Delivery Failure");
     Codes.Add(0xff, "Unknown Error");
     Codes.Add(0x100, "ESME Not authorised to use specified service_type");
     Codes.Add(0x101, "ESME Prohibited from using specified operation");
     Codes.Add(0x102, "Specified service_type is unavailable");
     Codes.Add(0x103, "Specified service_type is denied");
     Codes.Add(260, "Invalid Data Coding Scheme");
     Codes.Add(0x105, "Source Address Sub unit is Invalid");
     Codes.Add(0x106, "Destination Address Sub unit is Invalid");
     Codes.Add(0x107, "Broadcast Frequency Interval is invalid");
     Codes.Add(0x108, "Broadcast Alias Name is invalid");
     Codes.Add(0x109, "Broadcast Area Format is invalid");
     Codes.Add(0x10a, "Number of Broadcast Areas is invalid");
     Codes.Add(0x10b, "Broadcast Content Type is invalid");
     Codes.Add(0x10c, "Broadcast Message Class is invalid");
     Codes.Add(0x10d, "Broadcast_sm operation failed");
     Codes.Add(270, "Query_broadcast_sm operation failed");
     Codes.Add(0x10f, "Cancel_broadcast_sm operation failed");
     Codes.Add(0x110, "Number of Repeated Broadcasts is invalid");
     Codes.Add(0x111, "Broadcast Service Group is invalid");
     Codes.Add(0x112, "Broadcast Channel Indicator is invalid");
     Codes.Add(0x15f95, "Local Exception. Check LastException property");
     Codes.Add(-1, "Invalid Error Code for this version. Maybe is a MC custom error code");
     StateCodes.Add(0, "The message is scheduled. Delivery has not yet been initiated");
     StateCodes.Add(1, "The message is in enroute state");
     StateCodes.Add(2, "Message is delivered to destination");
     StateCodes.Add(3, "Message validity period has expired");
     StateCodes.Add(4, "Message has been deleted");
     StateCodes.Add(5, "Message is undeliverable");
     StateCodes.Add(6, "Message is in accepted state");
     StateCodes.Add(7, "Message is in invalid state");
     StateCodes.Add(8, "Message is in a rejected state");
     StateCodes.Add(9, "The message was accepted but not transmitted or broadcast on the network");
     StateCodes.Add(-1, "Invalid State Code for this version. Maybe is a MC custom state code");
 }
 public StateResponse(StateCodes code, int sequence)
 {
     Code           = code;
     SequenceNumber = sequence;
 }
 public LocationlQStreetLookup()
 {
     _client       = new RestClient("https://us1.locationiq.com/v1/");
     _listOfStates = StateCodes.MakeListOfStatesAndStateCodes();
 }
Exemple #10
0
        public ActionResult ProcessCode(string stateCode)
        {
            StateCodes input = new StateCodes()
            {
                InputCode = stateCode, Results = new List <string>()
            };
            BinarySearchTree countryTree = BinarySearchTree.BuildTree();

            switch (input.InputCode)
            {
            case "USA":
            case "usa":
                countryTree.FindPath(99, input.Results);
                return(View(input));

            case "CAN":
            case "can":
                countryTree.FindPath(100, input.Results);
                return(View(input));

            case "MEX":
            case "mex":
                countryTree.FindPath(80, input.Results);
                return(View(input));

            case "BEL":
            case "bel":
                countryTree.FindPath(85, input.Results);
                return(View(input));

            case "GTM":
            case "gtm":
                countryTree.FindPath(40, input.Results);
                return(View(input));

            case "HND":
            case "hnd":
                countryTree.FindPath(41, input.Results);
                return(View(input));

            case "SLV":
            case "slv":
                countryTree.FindPath(1, input.Results);
                return(View(input));

            case "NIC":
            case "nic":
                countryTree.FindPath(42, input.Results);
                return(View(input));

            case "CRI":
            case "cri":
                countryTree.FindPath(43, input.Results);
                return(View(input));

            case "PAN":
            case "pan":
                countryTree.FindPath(44, input.Results);
                return(View(input));

            default:
                break;
            }
            return(View(input));
        }
Exemple #11
0
        internal async Task InitAsync()
        {
            States.Clear();
            StateCodes stateCode        = StateCodes.AndamanNicobarIslands;
            string     districtCode     = null;
            string     pinCode          = null;
            string     parctitionerName = null;
            State      state            = null;

            Out("------------------- Search Configuration -------------------");

            for (int i = 0; i < 3; i++)
            {
                Out("Enter the state code: ");
                Out("(Enter the number by the left side of each state)", ConsoleColor.White);
                Out("Example: ' 02 ' (without quotes) which stands for 'HimachalPradesh'", ConsoleColor.White);

                foreach (StateCodes code in Enum.GetValues(typeof(StateCodes)))
                {
                    Out($"| {(int) code:D2}  |  {code.ToString()}", ConsoleColor.White);
                }

                string stateCodeString = In();

                if (string.IsNullOrEmpty(stateCodeString) || stateCodeString.Where(x => !char.IsDigit(x)).Count() > 0)
                {
                    Out("Entered value is invalid.");
                }

                stateCode = (StateCodes)Enum.Parse(typeof(StateCodes), stateCodeString);
                Out("Please wait... getting districts of the specified state...");
                state = await CacheStateAsync(stateCode).ConfigureAwait(false);

                if (state == null)
                {
                    Out("Failed to get the districts. Please reenter the state code.");
                    continue;
                }

                break;
            }

            Out("Enter district numerical code: ");
            Out("(the code on left side of the district name)", ConsoleColor.White);
            Out("(leave empty to display all practitioners in the state)", ConsoleColor.White);

            foreach (StateResponse.Districts district in state.Districts)
            {
                Out($"| {district.DistrictNumericalCode}  |  {district.DistrictName}", ConsoleColor.White);
            }

            districtCode = In();

            Out("Enter pin code of the location of which you want to display practitioners of: ");
            Out("(leave empty if you don't want to filter with pin code)", ConsoleColor.White);
            pinCode = In();

            Out("Enter the practitioner name: ");
            parctitionerName = InWithMessage("(Leave Empty to display all the practitioners in the location)", ConsoleColor.White);

            Out("------------------- Configuration Success -------------------");

            Logger.Info("Please wait while we fetch the required data from 'https://services.gst.gov.in/' ...");

            List <GstResponse.Practitioner> result = await RequestGstPractitionersAsync(parctitionerName, stateCode, districtCode, pinCode).ConfigureAwait(false);

            if (result != null)
            {
                Logger.Info("Successfully received the data!");

                IEnumerable <GstResponse.Practitioner> parti = result.Where(x => (StateCodes)Enum.Parse(typeof(StateCodes), x.StateCode) == stateCode);

                Logger.Info($"Found a total of '{parti.Count()}' practitioners from '{stateCode.ToString()}' state.");

                foreach (GstResponse.Practitioner p in parti)
                {
                    Out($"{p.EnrolmentNumber} | {p.PractitionerName}", ConsoleColor.White);
                }

                Logger.Info("Shall we save the received data in CSV file ? (y/n)");

                if (InBoolean(ConsoleKey.Y))
                {
                    StringBuilder lines = new StringBuilder();

                    foreach (GstResponse.Practitioner p in parti)
                    {
                        lines.AppendLine($"{p.EnrolmentNumber},{p.PractitionerName},{p.EmailID},{p.ContactNumber},{p.Address.BuildingNumber} {p.Address.BuildName} {p.Address.FlatNumber} {p.Address.Road} {p.Address.PinCode},{p.StateCode},{p.DistrictCode}");
                    }

                    ToFile(lines.ToString());
                }

                Logger.Info("All operations completed!");
                return;
            }

            Logger.Error("Failed to complete operations.");
            Logger.Error("Please restart the application.");
        }
Exemple #12
0
 private string GenerateStateUrl(StateCodes stateCode) => $"{REQUEST_BASE_URL}master/st/{(int) stateCode:D2}/district";
        public IActionResult Index()
        {
            StateCodes stateCodes = new StateCodes();

            return(View(stateCodes));
        }
Exemple #14
0
 internal State(StateCodes _code, List <Districts> _districts)
 {
     StateCode = _code;
     Districts = _districts;
 }
 public LoginResultRequest(string username, StateCodes stateCode)
 {
     this.username  = username;
     this.stateCode = stateCode;
 }
 public override void Deserialize(DataStream reader)
 {
     base.Deserialize(reader);
     username  = reader.ReadString8();
     stateCode = (StateCodes)reader.ReadSInt32();
 }
Exemple #17
0
 public Address(long addressId, string address1, string address2, string address3,
     string city, StateCodes state, string zipcode, string province, CountryCodes countrycode)
     : this()
 {
     AddressId = addressId;
     Address1 = address1;
     Address2 = address2;
     Address3 = address3;
     City = city;
     State = state;
     ZipCode = zipcode;
     Province = province;
     CountryCode = countrycode;
 }