Ejemplo n.º 1
0
    /// <summary>
    /// this method is to get list of selected country(s) in the grid.
    /// </summary>
    /// <returns></returns>
    private ECountry[] GetSelectedCountry()
    {
        System.Collections.ArrayList ListCountry = new ArrayList();


        for (int i = 0; i < grdCountry.Rows.Count; i++)
        {
            HtmlInputCheckBox chkCountrySelecter = new HtmlInputCheckBox();
            chkCountrySelecter = (HtmlInputCheckBox)grdCountry.Rows[i].FindControl("chkRowChild");
            if (chkCountrySelecter.Checked == true)
            {
                //grdCountry.Rows[i].RowState = DataControlRowState.Selected;
                ECountry country = new ECountry();
                //country.CountryID = Convert.ToInt32(grdCountry.DataKeys[grdCountry.PageSize * (grdCountry.PageIndex) + i].Value);
                country.CountryID = Convert.ToInt32(((DataTable)(ViewState["DSGRID"])).Rows[grdCountry.Rows[i].DataItemIndex]["CountryID"]);
                ListCountry.Add(country);
            }
        }

        ECountry[] Countries = new ECountry[ListCountry.Count];
        for (int i = 0; i < ListCountry.Count; i++)
        {
            Countries[i] = new ECountry();
            Countries[i] = (ECountry)ListCountry[i];
        }

        return(Countries);
    }
Ejemplo n.º 2
0
        /// <summary>
        /// Metodopara Consultar Paises
        /// </summary>


        public DataTable ConsultarCountry(string scodcountry, string snamecountry)
        {
            DataTable dt         = oConn.ejecutarDataTable("UP_WEBSIGE_SEARCHCOUNTRY", scodcountry, snamecountry);
            ECountry  oescountry = new ECountry();

            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i <= dt.Rows.Count - 1; i++)
                    {
                        oescountry.codCountry        = dt.Rows[i]["cod_Country"].ToString().Trim();
                        oescountry.NameCountry       = dt.Rows[i]["Name_Country"].ToString().Trim();
                        oescountry.codLenguaje       = dt.Rows[i]["cod_Lenguaje"].ToString().Trim();
                        oescountry.CountryDpto       = Convert.ToBoolean(dt.Rows[i]["Country_Dpto"].ToString().Trim());
                        oescountry.CountryCiudad     = Convert.ToBoolean(dt.Rows[i]["Country_Ciudad"].ToString().Trim());
                        oescountry.CountryDistrito   = Convert.ToBoolean(dt.Rows[i]["Country_Distrito"].ToString().Trim());
                        oescountry.CountryBarrio     = Convert.ToBoolean(dt.Rows[i]["Country_Barrio"].ToString().Trim());
                        oescountry.Countrystatus     = Convert.ToBoolean(dt.Rows[i]["Country_status"].ToString().Trim());
                        oescountry.CountryCreateBy   = dt.Rows[i]["Country_CreateBy"].ToString().Trim();
                        oescountry.CountryDateBy     = Convert.ToDateTime(dt.Rows[i]["Country_DateBy"].ToString().Trim());
                        oescountry.CountryModiBy     = dt.Rows[i]["Country_ModiBy"].ToString().Trim();
                        oescountry.CountryDateModiBy = Convert.ToDateTime(dt.Rows[i]["Country_DateModiBy"].ToString().Trim());
                    }
                }
                return(dt);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
    /// <summary>
    /// this method is used for adding new and updating the information regarding the country which is
    /// called on clicking save button.
    /// </summary>
    private void UpdateCountry()
    {
        MasterDAL masterDAL = new MasterDAL();
        ECountry  country   = new ECountry();


        country.Description = txtDescription.Text;
        country.Name        = txtName.Text;
        country.CountryCode = txtCountryCode.Text.ToUpper();
        country.Active      = true;
        Int64 returnresult;

        if (hfCountryID.Value.ToString().Equals(""))
        {
            returnresult = masterDAL.SaveCountry(country, Convert.ToInt32(EOperationMode.Insert));
            if (returnresult == 0)
            {
                returnresult = 9999990;
            }
        }
        else
        {
            country.CountryID = Convert.ToInt32(((DataTable)(ViewState["DSGRID"])).Rows[grdCountry.Rows[Convert.ToInt32(hfCountryID.Value)].DataItemIndex]["CountryID"]);

            returnresult = masterDAL.SaveCountry(country, Convert.ToInt32(EOperationMode.Update));
            if (returnresult == 0)
            {
                returnresult = 9999991;
            }
        }
        divErrorMsg.Visible   = true;
        divErrorMsg.InnerHtml = (String)GetGlobalResourceObject("Resource", "msgDatabaseResult" + returnresult.ToString());
        hfCountryID.Value     = "";
        GetCountry();
    }
Ejemplo n.º 4
0
 public Address(string firstLine, string secondLine, string postalCode, string city, ECountry country)
 {
     FirstLine = firstLine;
     SecondLine = secondLine;
     PostalCode = postalCode;
     City = city;
     Country = country;
 }
Ejemplo n.º 5
0
 public static void SetFlag(this Image image, ECountry country, double size, Thickness margin)
 {
     if (image.Source is null)
     {
         image.Source = ApplicationHelpers.Manager.GetFlagImageSource(country);
         image.SetSize(size);
         image.Margin = margin;
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Metodo para Actualizar Paises
        /// </summary>


        public ECountry ActualizarCountry(string scodcountry, string snamecountry, string slenguaje, bool bCountryDpto,
                                          bool bCountryCity, bool bDistrito, bool bBarrio, bool bstatuscountry, string sCountryModiBy, DateTime tCountryDateModiBy)
        {
            DCountry odacountry = new DCountry();
            ECountry oeacountry = odacountry.ActualizarCountry(scodcountry, snamecountry, slenguaje, bCountryDpto, bCountryCity, bDistrito,
                                                               bBarrio, bstatuscountry, sCountryModiBy, tCountryDateModiBy);

            odacountry = null;
            return(oeacountry);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Asynchronous method to generates an iban code and get the bic for that code.
        /// </summary>
        /// <param name="countryCode">The country for which the iban should be generated.</param>
        /// <param name="bankIdent">The bank ident for which the iban should be generated.</param>
        /// <param name="accountNumber">The account number for which the iban should be generated.</param>
        /// <returns>The generated result which contains iban and bic.</returns>
        public async Task <IbanBic> GenerateIbanAsync(ECountry countryCode, string bankIdent, string accountNumber)
        {
            IbanBic result = null;

            await Task.Run(() =>
            {
                result = this.GenerateIban(countryCode, bankIdent, accountNumber);
            });

            return(result);
        }
Ejemplo n.º 8
0
 public VehicleCountWithFlag
 (
     ECountry country,
     int count,
     Thickness margin,
     MouseButtonEventHandler mouseDownHandler,
     HorizontalAlignment textHorizontalAlignment = HorizontalAlignment.Left,
     bool useNationFlags = false
 ) : this(new NationCountryPair(ENation.None, country), count, margin, mouseDownHandler, textHorizontalAlignment, useNationFlags)
 {
     Tag = country;
 }
        public ImageSource GetFlagImageSource(ECountry country)
        {
            if (!(_flagImageSources is null) && _flagImageSources.TryGetValue(country, out var cachedSource))
            {
                return(cachedSource);
            }

            var imageSource = Application.Current.MainWindow.FindResource(EReference.CountryIconKeys[country]) as ImageSource;

            _flagImageSources?.Add(country, imageSource);

            return(imageSource);
        }
Ejemplo n.º 10
0
 public TextLabelWithFlag
 (
     ECountry country,
     string text,
     Thickness margin,
     MouseButtonEventHandler mouseDownHandler,
     HorizontalAlignment textHorizontalAlignment = HorizontalAlignment.Left,
     bool isBold         = false,
     bool useNationFlags = false,
     bool createTooltip  = true
 )
     : this(new NationCountryPair(ENation.None, country), text, margin, mouseDownHandler, textHorizontalAlignment, isBold, useNationFlags, createTooltip)
 {
     Tag = country;
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Synchronous method to generates an iban code and get the bic for that code.
        /// </summary>
        /// <param name="countryCode">The country for which the iban should be generated.</param>
        /// <param name="bankIdent">The bank ident for which the iban should be generated.</param>
        /// <param name="accountNumber">The account number for which the iban should be generated.</param>
        /// <returns>The generated result which contains iban and bic.</returns>
        /// <exception cref="IbanException">
        /// <list type="table">
        ///     <item>
        ///         <term><see cref="RuleType"/></term>
        ///         <description>BankIdentNotValid</description>
        ///         <description>When a given bank id is not valid (no results in datastore).</description>
        ///     </item>
        /// </list>
        /// </exception>
        public IbanBic GenerateIban(ECountry countryCode, string bankIdent, string accountNumber)
        {
            Country country = null;
            Bank    bank    = null;

            IbanBic result = null;

            //  1. load country
            country = _dataService.LoadCountry(countryCode);

            //  1.2 Check bank ident
            if (!this.CheckBankIdent(country, bankIdent))
            {
                throw new IbanException(IbanExceptionType.BankIdentNotValid);
            }

            //  2. load bank
            bank = _dataService.LoadBank(bankIdent);

            //  3. create default Iban
            Iban iban = new Iban()
            {
                AccountNumber = accountNumber, Country = country
            };

            //  3.1 create default  bank
            iban.Bank = new Bank()
            {
                BankIdentification = bankIdent
            };

            //  4 check if account number fits maximum length
            result      = new IbanBic();
            result.IBAN = iban;
            result.IBAN.AccountNumber = this.CheckAccountNumber(country, result.IBAN.AccountNumber);

            //  5. Generate iban
            result.IBAN.BBAN       = this.GetBBAN(result.IBAN);
            result.IBAN.Country    = country;
            result.IBAN.CheckDigit = (98 - this.Modulo97(result.IBAN)).ToString("00");
            result.IBAN.IBAN       = this.GetIban(result.IBAN);

            //  6. bic is null
            result.BIC = null;

            return(result);
        }
Ejemplo n.º 12
0
    public string UpdateUser(string email, string password, string firstName, string lastName, string gender, string country)
    {
        mCurrentUser = (UserBase)Session["CurrentUser"];

        if (mCurrentUser == null)
        {
            return("Please Reload Page");
        }

        UserBaseBO userBaseBO = new UserBaseBO();

        ECountry eCountry = (ECountry)Int32.Parse(country.Substring(("ECountry_").Length));
        EGender  eGender  = (EGender)Int32.Parse(gender.Substring(("EGender_").Length));

        mCurrentUser.Email     = email;
        mCurrentUser.FirstName = firstName;
        mCurrentUser.LastName  = lastName;
        mCurrentUser.Gender    = eGender;

        if (!mCurrentUser.Location.IsLoaded())
        {
            ObjectLocationBO objectLocationBO = new ObjectLocationBO();
            objectLocationBO.Load(mCurrentUser.Location);
        }

        mCurrentUser.Location.Country = eCountry;

        userBaseBO.Save(mCurrentUser);

        LoginManagerBO loginManagerBO = new LoginManagerBO();

        if (password.Length < 6)
        {
            loginManagerBO.UpdateUserLoginInfo(mCurrentUser.UniqueID, email);
        }
        else
        {
            loginManagerBO.UpdateUserLoginInfo(mCurrentUser.UniqueID, email, password);
        }

        Session["CurrentUser"] = mCurrentUser;

        return("Success");
    }
Ejemplo n.º 13
0
        /// <summary>
        /// Loads a Country to a given country code.
        /// </summary>
        /// <param name="country_code">The given country code.</param>
        /// <returns>The loaded country.</returns>
        public Country LoadCountry(ECountry country_code)
        {
            //  Load searched format from file
            IEnumerable <XElement> format = LoadData(_fileNameIbanFormat, "country", new KeyValuePair <string, string>("countryCode", country_code.ToString()));

            //  convert data in class object
            var result = (from ibanFormat in format
                          select new Country
            {
                AccountNumberLength = ibanFormat.Element(XmlNamespace + "ktoIdentLength").Value,
                BankIdentLength = ibanFormat.Element(XmlNamespace + "bankIdentLength").Value,
                CountryCode = country_code.ToString(),
                Name = ibanFormat.Element(XmlNamespace + "name").Value,
                RegExp = ibanFormat.Element(XmlNamespace + "regexp").Value,
                CountryType = country_code
            });

            return(result.First());
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Metodo para Actualizar Paises
        /// </summary>


        public ECountry ActualizarCountry(string scodcountry, string snamecountry, string slenguaje, bool bCountryDpto,
                                          bool bCountryCity, bool bDistrito, bool bBarrio, bool bstatuscountry, string sCountryModiBy, DateTime tCountryDateModiBy)
        {
            DataTable dt = oConn.ejecutarDataTable("UP_WEBSIGE_ACTUALIZARCOUNTRY", scodcountry, snamecountry, slenguaje, bCountryDpto,
                                                   bCountryCity, bDistrito, bBarrio, bstatuscountry, sCountryModiBy, tCountryDateModiBy);
            ECountry oeacountry = new ECountry();

            oeacountry.codCountry        = scodcountry;
            oeacountry.NameCountry       = snamecountry;
            oeacountry.codLenguaje       = slenguaje;
            oeacountry.CountryDpto       = bCountryDpto;
            oeacountry.CountryCiudad     = bCountryCity;
            oeacountry.CountryDistrito   = bDistrito;
            oeacountry.CountryBarrio     = bBarrio;
            oeacountry.Countrystatus     = bstatuscountry;
            oeacountry.CountryModiBy     = sCountryModiBy;
            oeacountry.CountryDateModiBy = tCountryDateModiBy;

            return(oeacountry);
        }
Ejemplo n.º 15
0
    /// <summary>
    /// this method is used for adding new and updating the information regarding the State which is
    /// called on clicking save button.
    /// </summary>
    private void UpdateState()
    {
        EState state = new EState
        {
            Description = txtDescription.Text,
            Name        = txtName.Text,
            Active      = true,
            StateCode   = txtStateCode.Text.ToUpper()
        };

        var country = new ECountry();

        country.CountryID = Convert.ToInt32(ddlcountry.SelectedValue);

        state.Country = country;

        Int64     returnresult;
        MasterDAL masterDal = new MasterDAL();

        if (hfStateID.Value.Equals(""))
        {
            returnresult = masterDal.SaveState(state, Convert.ToInt32(EOperationMode.Insert));
            if (returnresult == 0)
            {
                returnresult = 9999990;
            }
        }
        else
        {
            state.StateID = Convert.ToInt32(((DataTable)(ViewState["DSGRID"])).Rows[grdState.Rows[Convert.ToInt32(hfStateID.Value)].DataItemIndex]["StateID"]);
            returnresult  = masterDal.SaveState(state, Convert.ToInt32(EOperationMode.Update));
            if (returnresult == 0)
            {
                returnresult = 9999991;
            }
        }

        errordiv.InnerHtml = (String)GetGlobalResourceObject("Resource", "msgDatabaseResult" + returnresult);
        hfStateID.Value    = "";
        GetState();
    }
Ejemplo n.º 16
0
    public string CreateUser(string email, string password, string fullName, string gender, string country)
    {
        LoginManagerBO loginManagerBO = new LoginManagerBO();

        CreateCurrentUser();

        ECountry eCountry = (ECountry)Int32.Parse(country.Substring(("ECountry_").Length));
        EGender  eGender  = (EGender)Int32.Parse(gender.Substring(("EGender_").Length));
        string   firstName;
        string   lastName = "";

        string[] fullNameSplit = fullName.Split(' ');
        firstName = fullNameSplit[0];

        for (int i = 1; i < fullNameSplit.Length; i++)
        {
            if (i > 1)
            {
                lastName += " " + fullNameSplit[i];
            }
            else
            {
                lastName += fullNameSplit[i];
            }
        }


        if (loginManagerBO.EmailExists(email))
        {
            return(email + " already taken");
        }

        // Create User
        loginManagerBO.CreateUser(mCurrentUser, password, email, firstName, lastName, eGender, eCountry);
        //loginManagerBO.CreateSampleEvent(mCurrentUser);

        Session["CurrentUser"] = mCurrentUser;

        return("success");
    }
Ejemplo n.º 17
0
        /// <summary>
        /// Synchronous method to generates an iban code and get the bic for that code.
        /// </summary>
        /// <param name="countryCode">The country for which the iban should be generated.</param>
        /// <param name="bankIdent">The bank ident for which the iban should be generated.</param>
        /// <param name="accountNumber">The account number for which the iban should be generated.</param>
        /// <returns>The generated result which contains iban and bic.</returns>
        /// <exception cref="IbanException">
        /// <list type="table">
        ///     <item>
        ///         <term><see cref="RuleType"/></term>
        ///         <description>NoCalculation</description>
        ///         <description>When iban calculation is not allowed.</description>
        ///     </item>
        /// </list>
        /// </exception>
        public IbanBic GenerateIban(ECountry countryCode, string bankIdent, string accountNumber)
        {
            Country country = null;
            Bank    bank    = null;
            Rule    rule    = null;

            IbanBic result = null;

            //  1. load country
            country = _dataService.LoadCountry(countryCode);

            //  1.2 Check bank ident
            if (!this.CheckBankIdent(country, bankIdent))
            {
                throw new IbanException(IbanExceptionType.BankIdentNotValid);
            }

            //  2. load bank
            bank = _dataService.LoadBank(bankIdent);

            //  3. load rule
            rule = _dataService.LoadRule(bank.Rule);

            //  4. take care of rule
            result = this.ConsiderRule(bank, rule, country, accountNumber);

            //  4.1 check if account number fits maximum length
            result.IBAN.AccountNumber = this.CheckAccountNumber(country, result.IBAN.AccountNumber);

            //  5. Generate iban
            result.IBAN.BBAN       = this.GetBBAN(result.IBAN);
            result.IBAN.Country    = country;
            result.IBAN.CheckDigit = (98 - this.Modulo97(result.IBAN)).ToString("00");
            result.IBAN.IBAN       = this.GetIban(result.IBAN);

            return(result);
        }
Ejemplo n.º 18
0
        public override ActionResult Execute(ISpecialExecutionTaskTestAction testAction)
        {
            String bankIdent = testAction.GetParameterAsInputValue("bankIdent", false).Value;

            if (string.IsNullOrEmpty(bankIdent))
            {
                throw new ArgumentException(string.Format("Es muss eine Bank identifikation angegeben sein."));
            }

            String accountNumber = testAction.GetParameterAsInputValue("accountNumber", false).Value;

            if (string.IsNullOrEmpty(accountNumber))
            {
                throw new ArgumentException(string.Format("Es muss eine Kontonummer angegeben sein."));
            }

            String buffer = testAction.GetParameterAsInputValue("buffer", false).Value;

            if (string.IsNullOrEmpty(buffer))
            {
                throw new ArgumentException(string.Format("Es muss ein Puffer angegeben werden in welche die IBAN gespeichert werden soll."));
            }

            // onyl support DE so far
            ECountry countryCode = ECountry.DE;

            // DE46 | 5054 0028 | 0420 0861 00

            _manager = ContainerBootstrapper.Resolve <IIbanManager>(countryCode.ToString());
            iban     = _manager.GenerateIban(countryCode, bankIdent, accountNumber);

            Buffers.Instance.SetBuffer(buffer, iban.IBAN.IBAN, false);

            testAction.SetResult(SpecialExecutionTaskResultState.Ok, "IBAN generated and saved to buffer.");

            throw new NotImplementedException();
        }
Ejemplo n.º 19
0
        /*protected void AddNewItemToEvent(EventBase newEvent, UserBase userBase, string name, string iconName, int value)
         * {
         *  ItemBase newItemBase = new ItemBase(0, newEvent, userBase, new NameImage(name, DefaultIconsList.DefaultIconPath + iconName));
         *  newItemBase.Value = value;
         *  mItemBaseBO.Save(newItemBase);
         *  newEvent.ItemChildren.Add(newItemBase);
         *
         *  HoldingsInfo newDefaultHolding = new HoldingsInfo();
         *  newDefaultHolding.ItemOwner = newItemBase;
         *  mHoldingsInfoBO.Save(newDefaultHolding);
         *  newItemBase.HoldingsInfo.Add(newDefaultHolding);
         * }
         *
         * public void CreateSampleEvent(UserBase userBase)
         * {
         *  EventBase newEvent = new EventBase();
         *          DateTime todayAndNow = DateTime.Now;
         *
         *          newEvent.Admin                          = userBase;
         *          newEvent.ResourceDescription.Topic		= "Your First Potluck Event";
         *          newEvent.ResourceDescription.Summary	= "Here you can enter description of the potluck party.\n" +
         *                                              "You can invited your friends, and add items (Salads, pies) to the event.\n" +
         *                                              "If you want that your friends will bring an equal value of things, you can set a value for your event.\n" +
         *                                              "A Value means that your friends will have to bring a sum of the value you have asked for.\n" +
         *                                              "For example, if you set your event to be a total number of 4 value stars, then your friends will have to bring an Apple juice and a Banana (both valued as 2) to complete their attendance.\n" +
         *                                              "Enjoy - Just remember to save event whenever you make changes to this section";
         *          newEvent.Value = 3;
         *          newEvent.IsPublic = false;
         *
         *          newEvent.EventTimeInfo.BecomeActive		= todayAndNow;
         *          newEvent.EventTimeInfo.BecomeInactive	=  todayAndNow.AddHours(3);
         *
         *          mEventBaseBO.Save(newEvent);
         *  AddNewItemToEvent(newEvent, userBase, "Banana", "banana_24.png", 1);
         *  AddNewItemToEvent(newEvent, userBase, "Apple juice", "apple_juice_24.png", 2);
         *  AddNewItemToEvent(newEvent, userBase, "Cake", "cake_24.png", 3);
         *  AddNewItemToEvent(newEvent, userBase, "Cheese", "cheese_24.png", 2);
         *  AddNewItemToEvent(newEvent, userBase, "Club sandwich", "club_sandwich_24.png", 4);
         *
         *          userBase.Events.Add(newEvent);
         *
         *          mUserBaseBO.Save(userBase);
         * }*/

        public void CreateUser(UserBase userBase,
                               string password, string email,
                               string firstName, string lastName, EGender gender, ECountry country)
        {
            if (EmailExists(email))
            {
                throw new System.ArgumentException("Email Exists already", "email");
            }

            UserLoginInfo userLoginInfo = new UserLoginInfo(password, email, 0);

            AddUser(userLoginInfo);

            userBase.UniqueID         = userLoginInfo.UniqueID;
            userBase.FirstName        = firstName;
            userBase.LastName         = lastName;
            userBase.Email            = email;
            userBase.Gender           = gender;
            userBase.Location.Country = country;
            //userInfo.Phone;
            //userInfo.Title;

            mUserBaseBO.Save(userBase);
        }
Ejemplo n.º 20
0
        private Image GetFlag(ECountry country)
        {
            switch (country)
            {
            case ECountry.France:
                return(Resources.France);

            case ECountry.Germany:
                return(Resources.Germany);

            case ECountry.Italy:
                return(Resources.Italy);

            case ECountry.Japan:
                return(Resources.Japan);

            case ECountry.SouthCorea:
                return(Resources.SouthCorea);

            case ECountry.USA:
                return(Resources.USA);
            }
            return(null);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Asynchronous method to generate an iban code.
        /// </summary>
        /// <param name="countryCode">Country for which the code should be generated.</param>
        /// <param name="bankIdent">Band ident for which the code should be generated.</param>
        /// <param name="accountNumber">Account number for which the code should be generated.</param>
        /// <returns>The generated iban code and bic code.</returns>
        public async Task <IbanBic> GenerateIbanAsync(ECountry countryCode, string bankIdent, string accountNumber)
        {
            _manager = ContainerBootstrapper.Resolve <IIbanManager>(countryCode.ToString());

            return(await _manager.GenerateIbanAsync(countryCode, bankIdent, accountNumber));
        }
Ejemplo n.º 22
0
 public void setCountry(ECountry country)
 {
     this.country = country;
 }
Ejemplo n.º 23
0
 public BranchCountryPair(EBranch branch, ECountry country)
 {
     Branch  = branch;
     Country = country;
 }
 /// <summary> Initializes the class with the given values. </summary>
 /// <param name="nation"> The nation. </param>
 /// <param name="country"> The country. </param>
 private void Initialise(ENation nation, ECountry country)
 {
     Nation  = nation;
     Country = country;
 }
 /// <summary> Creates a new nation-country pair. </summary>
 /// <param name="nation"> The nation. </param>
 /// <param name="country"> The country. </param>
 public NationCountryPair(ENation nation, ECountry country)
 {
     Initialise(nation, country);
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Synchronous method to generates an iban code and get the bic for that code.
        /// </summary>
        /// <param name="countryCode">The country for which the iban should be generated.</param>
        /// <param name="bankIdent">The bank ident for which the iban should be generated.</param>
        /// <param name="accountNumber">The account number for which the iban should be generated.</param>
        /// <returns>The generated result which contains iban and bic.</returns>
        /// <exception cref="IbanException">
        /// <list type="table">
        ///     <item>
        ///         <term><see cref="RuleType"/></term>
        ///         <description>NoCalculation</description>
        ///         <description>When iban calculation is not allowed.</description>
        ///     </item>
        /// </list>
        /// </exception>
        public IbanBic GenerateIban(ECountry countryCode, string bankIdent, string accountNumber)
        {
            Country country = null;
            Bank bank = null;
            Rule rule = null;

            IbanBic result = null;

            //  1. load country
            country = _dataService.LoadCountry(countryCode);

            //  1.2 Check bank ident
            if (!this.CheckBankIdent(country, bankIdent))
                throw new IbanException(IbanExceptionType.BankIdentNotValid);

            //  2. load bank
            bank = _dataService.LoadBank(bankIdent);

            //  3. load rule
            rule = _dataService.LoadRule(bank.Rule);

            //  4. take care of rule
            result = this.ConsiderRule(bank, rule, country, accountNumber);

            //  4.1 check if account number fits maximum length
            result.IBAN.AccountNumber = this.CheckAccountNumber(country, result.IBAN.AccountNumber);

            //  5. Generate iban
            result.IBAN.BBAN = this.GetBBAN(result.IBAN);
            result.IBAN.Country = country;
            result.IBAN.CheckDigit = (98 - this.Modulo97(result.IBAN)).ToString("00");
            result.IBAN.IBAN = this.GetIban(result.IBAN);

            return result;
        }
Ejemplo n.º 27
0
 /// <summary> Checks whether the country is valid. </summary>
 /// <param name="country"> The country to check. </param>
 /// <returns></returns>
 public static bool IsValid(this ECountry country) =>
 country.CastTo <int>() > EInteger.Number.NinetyNine;
Ejemplo n.º 28
0
 /// <summary> Returns all nations that have vehicles of the given <paramref name="country"/>. </summary>
 /// <param name="country"> The country to search by. </param>
 /// <returns></returns>
 public static IEnumerable <ENation> GetNations(this ECountry country) =>
 EReference.NationsByCountry.TryGetValue(country, out var nations)
         ? nations
         : new List <ENation>();
Ejemplo n.º 29
0
        /// <summary>
        /// Asynchronous method to generate an iban code.
        /// </summary>
        /// <param name="countryCode">Country for which the code should be generated.</param>
        /// <param name="bankIdent">Band ident for which the code should be generated.</param>
        /// <param name="accountNumber">Account number for which the code should be generated.</param>
        /// <returns>The generated iban code and bic code.</returns>
        public async Task<IbanBic> GenerateIbanAsync(ECountry countryCode, string bankIdent, string accountNumber)
        {
            _manager = ContainerBootstrapper.Resolve<IIbanManager>(countryCode.ToString());

            return await _manager.GenerateIbanAsync(countryCode, bankIdent, accountNumber);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Synchronous method to generate an iban code.
        /// </summary>
        /// <param name="countryCode">Country for which the code should be generated.</param>
        /// <param name="bankIdent">Band ident for which the code should be generated.</param>
        /// <param name="accountNumber">Account number for which the code should be generated.</param>
        /// <returns>The generated iban code and bic code.</returns>
        public IbanBic GenerateIban(ECountry countryCode, string bankIdent, string accountNumber)
        {
            _manager = ContainerBootstrapper.Resolve <IIbanManager>(countryCode.ToString());

            return(_manager.GenerateIban(countryCode, bankIdent, accountNumber));
        }
Ejemplo n.º 31
0
        /// <summary>
        /// Synchronous method to generate an iban code.
        /// </summary>
        /// <param name="countryCode">Country for which the code should be generated.</param>
        /// <param name="bankIdent">Band ident for which the code should be generated.</param>
        /// <param name="accountNumber">Account number for which the code should be generated.</param>
        /// <returns>The generated iban code and bic code.</returns>
        public IbanBic GenerateIban(ECountry countryCode, string bankIdent, string accountNumber)
        {
            _manager = ContainerBootstrapper.Resolve<IIbanManager>(countryCode.ToString());

            return _manager.GenerateIban(countryCode, bankIdent, accountNumber);
        }
Ejemplo n.º 32
0
    /// <summary>
    /// this method is used for adding new and updating the information regarding the city which is
    /// called on clicking save button.
    /// </summary>
    private void UpdateCity()
    {
        Int64 returnresult = 0;

        //CityService service = new CityService();

        string ZipCode = txtZip.Text;

        //HealthYes.Web.UI.CityService.ECity city = new HealthYes.Web.UI.CityService.ECity();
        var city = new ECity();

        city.Description = txtDescription.Text;
        city.Name        = txtName.Text;

        //city.State = new HealthYes.Web.UI.CityService.EState();
        //city.Zipcode = new HealthYes.Web.UI.CityService.EZip();

        city.State   = new EState();
        city.Zipcode = new EZip();

        if (ViewState["stateid"] != null)
        {
            city.State.StateID = Convert.ToInt32(ViewState["stateid"]);
        }

        //HealthYes.Web.UI.CityService.ECountry country = new HealthYes.Web.UI.CityService.ECountry();
        ECountry country = new ECountry();

        country.CountryID = Convert.ToInt32(ddlcountry.SelectedValue);
        city.Active       = true;
        city.Country      = country;

        city.Zipcode.ZipCode = ZipCode;

        MasterDAL masterDAL = new MasterDAL();

        if (hfCityID.Value.ToString().Equals(""))
        {
            city.Zipcode.ZipID = 0;
            //service.AddCity(city, "1", "1", "1", out returnresult, out temp);

            returnresult = masterDAL.SaveCity(city, Convert.ToInt32(EOperationMode.Insert));
            if (returnresult == 0)
            {
                returnresult = 9999990;
            }
        }
        else
        {
            city.Zipcode.ZipID =
                Convert.ToInt32(
                    ((DataTable)(ViewState["DSGRID"])).Rows[grdCity.Rows[Convert.ToInt32(hfCityID.Value)].DataItemIndex
                    ]["ZipId"]);
            city.CityID =
                Convert.ToInt32(
                    ((DataTable)(ViewState["DSGRID"])).Rows[grdCity.Rows[Convert.ToInt32(hfCityID.Value)].DataItemIndex
                    ]["CityID"]);

            returnresult = masterDAL.SaveCity(city, Convert.ToInt32(EOperationMode.Update));
            if (returnresult == 0)
            {
                returnresult = 9999991;
            }

            //service.UpdateCity(city, "1", "1", "1", out returnresult, out temp);
            hfCityID.Value = "";
        }

        errordiv.InnerHtml = (String)GetGlobalResourceObject("Resource", "msgDatabaseResult" + returnresult.ToString());

        if (Request.QueryString["searchtext"] != null)
        {
            SearchCity(Request.QueryString["searchtext"].ToString());
        }
        else
        {
            GetCity();
        }
        //GetCity();
    }
Ejemplo n.º 33
0
        /// <summary>
        /// Loads a Country to a given country code.
        /// </summary>
        /// <param name="country_code">The given country code.</param>
        /// <returns>The loaded country.</returns>
        public Country LoadCountry(ECountry country_code)
        {
            //  Load searched format from file
            IEnumerable<XElement> format = LoadData(_fileNameIbanFormat, "country", new KeyValuePair<string, string>("countryCode", country_code.ToString()));

            //  convert data in class object
            var result = (from ibanFormat in format
                          select new Country
                          {
                              AccountNumberLength = ibanFormat.Element(XmlNamespace + "ktoIdentLength").Value,
                              BankIdentLength = ibanFormat.Element(XmlNamespace + "bankIdentLength").Value,
                              CountryCode = country_code.ToString(),
                              Name = ibanFormat.Element(XmlNamespace + "name").Value,
                              RegExp = ibanFormat.Element(XmlNamespace + "regexp").Value,
                              CountryType = country_code
                          });

            return result.First();
        }
Ejemplo n.º 34
0
        /// <summary>
        /// Synchronous method to generates an iban code and get the bic for that code.
        /// </summary>
        /// <param name="countryCode">The country for which the iban should be generated.</param>
        /// <param name="bankIdent">The bank ident for which the iban should be generated.</param>
        /// <param name="accountNumber">The account number for which the iban should be generated.</param>
        /// <returns>The generated result which contains iban and bic.</returns>
        /// <exception cref="IbanException">
        /// <list type="table">
        ///     <item>
        ///         <term><see cref="RuleType"/></term>
        ///         <description>BankIdentNotValid</description>
        ///         <description>When a given bank id is not valid (no results in datastore).</description>
        ///     </item>
        /// </list>
        /// </exception>
        public IbanBic GenerateIban(ECountry countryCode, string bankIdent, string accountNumber)
        {
            Country country = null;
            Bank bank = null;

            IbanBic result = null;

            //  1. load country
            country = _dataService.LoadCountry(countryCode);

            //  1.2 Check bank ident
            if (!this.CheckBankIdent(country, bankIdent))
                throw new IbanException(IbanExceptionType.BankIdentNotValid);

            //  2. load bank
            bank = _dataService.LoadBank(bankIdent);

            //  3. create default Iban
            Iban iban = new Iban() { AccountNumber = accountNumber, Country = country };

            //  3.1 create default  bank
            iban.Bank = new Bank() { BankIdentification = bankIdent };

            //  4 check if account number fits maximum length
            result = new IbanBic();
            result.IBAN = iban;
            result.IBAN.AccountNumber = this.CheckAccountNumber(country, result.IBAN.AccountNumber);

            //  5. Generate iban
            result.IBAN.BBAN = this.GetBBAN(result.IBAN);
            result.IBAN.Country = country;
            result.IBAN.CheckDigit = (98 - this.Modulo97(result.IBAN)).ToString("00");
            result.IBAN.IBAN = this.GetIban(result.IBAN);

            //  6. bic is null
            result.BIC = null;

            return result;
        }
Ejemplo n.º 35
0
        /// <summary>
        /// Generates an iban code.
        /// </summary>
        /// <param name="countryCode">The country for which the iban should be generated.</param>
        /// <param name="bankIdent">The bank ident for which the iban should be generated.</param>
        /// <param name="accountNumber">The account number for which the iban should be generated.</param>
        /// <returns>The generated result.</returns>
        public async Task<IbanBic> GenerateIbanAsync(ECountry countryCode, string bankIdent, string accountNumber)
        {
            IbanBic result = null;

            await Task.Run(() =>
                {
                    result = this.GenerateIban(countryCode, bankIdent, accountNumber);
                });

            return result;
        }
 public FlagControl(ECountry country, Thickness margin, MouseButtonEventHandler mouseDownHandler, HorizontalAlignment horizontalAlignment = HorizontalAlignment.Center, double?panelWidth = null, bool setTag = true)
 {
     InitializeComponent();
     Initialise(country, margin, mouseDownHandler, horizontalAlignment, panelWidth, setTag);
 }
 public static Image CreateFlag(this ECountry country, Style flagStyle, Thickness margin, HorizontalAlignment horizontalAlignment = HorizontalAlignment.Left)
 {
     return(new NationCountryPair(ENation.None, country).CreateFlag(flagStyle, margin, false, horizontalAlignment: horizontalAlignment));
 }