Ejemplo n.º 1
0
        public List <string> GetListOfProperty(CountryProperty prop)
        {
            if (dataStore == null || dataStore.Accumulated == null)
            {
                throw new FieldAccessException(
                          "Data cannot be accessed, since it was not loaded yet.\n" +
                          "Please call DataLoader.LoadAllData() first.");
            }

            List <string> available = new List <string>();

            foreach (var item in dataStore.Accumulated.Countries)
            {
                switch (prop)
                {
                case CountryProperty.CODE:
                    if (item.CountryCode != null)
                    {
                        available.Add(item.CountryCode);
                    }
                    break;

                case CountryProperty.SLUG:
                    if (item.Slug != null)
                    {
                        available.Add(item.Slug);
                    }
                    break;

                case CountryProperty.NAME:
                    if (item.Country != null)
                    {
                        available.Add(item.Country);
                    }
                    break;

                default:
                    throw new NotImplementedException(
                              "Property specified in APIHandler.GetListOfProperty()" +
                              "is not implemented yet.");
                }
            }

            if (available.Count == 0)
            {
                throw new FieldAccessException(
                          "Data cannot be accessed. There are no available country datapoints.\n" +
                          "Please try to call DataLoader.LoadAllData() again.");
            }

            return(available);
        }
Ejemplo n.º 2
0
        private void OnAddressChanged(object sender, PropertyChangeEventArgs e)
        {
            if (!e.Change.IncludesValue() || DataProperty.Equals(e.OldValue, e.NewValue))
            {
                return;
            }

            Header addr = AddressIdProperty.Value;

            AddressLine1Property.SetValue(addr?[Enumerations.BusinessEntityAddress.Attributes.AddressLine1]);
            AddressLine2Property.SetValue(addr?[Enumerations.BusinessEntityAddress.Attributes.AddressLine2]);
            CityStateProperty.SetValue(addr == null ? null : addr[Enumerations.BusinessEntityAddress.Attributes.City]
                                       + ", " + addr[Enumerations.BusinessEntityAddress.Attributes.State]);
            PostalCodeProperty.SetValue(addr?[Enumerations.BusinessEntityAddress.Attributes.PostalCode]);
            CountryProperty.SetValue(addr?[Enumerations.BusinessEntityAddress.Attributes.Country]);
        }
Ejemplo n.º 3
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            var errMsg = "";

            _objCommon = new Common();
            try
            {
                _objCountryProperty = new CountryProperty();
                DataSet _ds = new DataSet();
                var     _objClsOledbdatalayer = new ClsOleDBDataWrapper();
                var     excelSheets           = new String[0];
                string  path = MapPath(fileUploadExcel.FileName);
                fileUploadExcel.SaveAs(path);
                excelSheets = _objClsOledbdatalayer.CountTotalSheets(path);
                if (excelSheets.Length > 0)
                {
                    foreach (string t in excelSheets)
                    {
                        _ds = _objClsOledbdatalayer.getdata(path, t);
                        if (_ds.Tables[0].Rows.Count > 0)
                        {
                            for (int j = 0; j <= _ds.Tables[0].Rows.Count - 1; j++)
                            {
                                int result = CountryProvider.Instance.InsertCountry(_ds.Tables[0].Rows[j]["CountryName"].ToString(),
                                                                                    LoggedInUserId, out errMsg, _ds.Tables[0].Rows[j]["CountryCode"].ToString());
                                if (result > 0)
                                {
                                    lblRecordsInserted.Text = "";
                                    lblRecordsInserted.Text = j + " row inserted out of " + _ds.Tables[0].Rows.Count;
                                }
                            }
                            lblSuccess.Text    = _objCommon.GetErrorMessage("lblSucessMsg");
                            lblSuccess.Visible = true;
                            //CountryMasterBind();
                        }
                    }
                }
                else
                {
                    lblError.Text = _objCommon.GetErrorMessage("lblErrMsg");
                }
            }
            catch (Exception ex)
            { }
        }
Ejemplo n.º 4
0
        private List <CountryProperty> BindCountryObject(DataTable dataTable)
        {
            if (dataTable == null)
            {
                throw new ArgumentNullException("dataTable");
            }
            var objCountryList = new List <CountryProperty>();


            try
            {
                if (dataTable.Rows.Count > 0)
                {
                    for (var j = 0; j < dataTable.Rows.Count; j++)
                    {
                        var objCountry = new CountryProperty
                        {
                            CountryId   = Convert.ToInt32(dataTable.Rows[j]["AjCountryId"]),
                            CountryCode = Convert.ToString(dataTable.Rows[j]["AjCountryCode"]),
                            CountryName = Convert.ToString(dataTable.Rows[j]["AjCountryName"])
                        };
                        objCountryList.Add(objCountry);
                    }
                }
            }
            catch (Exception ex)
            {
                var err = ex.Message;
                if (ex.InnerException != null)
                {
                    err = err + " :: Inner Exception :- " + ex.ToString();
                }
                const string addInfo = "Error while executing BindCountryObject in Country.cs  :: -> ";
                var          objPub  = new ClsExceptionPublisher();
                objPub.Publish(err, addInfo);
            }
            return(objCountryList);
        }
Ejemplo n.º 5
0
 set => SetValue(CountryProperty, value);