コード例 #1
0
 /// <summary>
 /// Create a new DomesticWHTRate object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="code">Initial value of the Code property.</param>
 /// <param name="countryId">Initial value of the countryId property.</param>
 public static DomesticWHTRate CreateDomesticWHTRate(global::System.Int32 id, global::System.String code, global::System.Int32 countryId)
 {
     DomesticWHTRate domesticWHTRate = new DomesticWHTRate();
     domesticWHTRate.Id = id;
     domesticWHTRate.Code = code;
     domesticWHTRate.countryId = countryId;
     return domesticWHTRate;
 }
コード例 #2
0
        private IEnumerable<PublisherStatus> PublishContent(DataRowCollection contentRows, string sheetName)
        {
            var allStatus = new List<PublisherStatus>();
            if (contentRows.Count >= 1)
            {

                using (var work = new UnitOfWork())
                {
                    var countryRepo = RepositoryContainer.GetRepository<Nest.DataAccess.Country>(work);
                    var domesticRateRepo = RepositoryContainer.GetRepository<Nest.DataAccess.DomesticWHTRate>(work);
                    var allCountries = countryRepo.All().ToList();
                    var dbHostCountry = allCountries.FirstOrDefault(b => b.Code == contentRows[1].ItemArray[0].ToString().Trim());

                    if (dbHostCountry == null)
                    {
                        allStatus.Add(new PublisherStatus() { Message = "Host Country Name Doesn't Exist In DataBase", Status = false });
                        allStatus.Add(new PublisherStatus
                        {
                            Status = false,
                            Message = "Data uploading failed for sheet " + sheetName
                        });
                        return allStatus;
                    }
                    //var conceptIdExistStatus = CheckConceptIdInfo(contentRows);
                    //var idExistStatus =  conceptIdExistStatus.ToList();
                    //allStatus.AddRange(idExistStatus);
                    //if (idExistStatus.Any(b => b.Status == false))
                    //{
                    //    allStatus.Add(new PublisherStatus
                    //    {
                    //        Status = false,
                    //        Message = "Data uploading failed for sheet " + sheetName
                    //    });
                    //    return allStatus;
                    //}
                 //   HostCountry = dbHostCountry;
                    if (contentRows.Count >= 2)
                    {
                        for (var index = 1; index < contentRows.Count; index++)
                        {
                            if (string.IsNullOrEmpty(contentRows[index].ItemArray[0].ToString().Trim())) continue;
                            var dbPartenerCountry = allCountries.FirstOrDefault(b => b.Code == contentRows[index].ItemArray[0].ToString().Trim());

                            if (dbPartenerCountry == null)
                            {
                                allStatus.Add(new PublisherStatus() { Message = "Partner Country Code " + contentRows[index].ItemArray[0].ToString().Trim() + " Doesn't Exist In DataBase", Status = false });
                            }
                            if (dbPartenerCountry != null)
                            {
                                var dbTpTreaty = domesticRateRepo.Filter(b => b.Code == dbHostCountry.Code).FirstOrDefault();
                                if (dbTpTreaty == null)
                                {
                                    dbTpTreaty = new Nest.DataAccess.DomesticWHTRate();
                                    domesticRateRepo.Add(dbTpTreaty);
                                }

                                dbTpTreaty.Code = contentRows[index].ItemArray[0].ToString().Trim();
                                dbTpTreaty.countryId = int.Parse(contentRows[index].ItemArray[1].ToString().Trim());
                                dbTpTreaty.DividendRate = contentRows[index].ItemArray[2].ToString().Trim();
                                dbTpTreaty.InterestRate = contentRows[index].ItemArray[3].ToString().Trim();
                                dbTpTreaty.RoyalityRate=contentRows[index].ItemArray[4].ToString().Trim();

                            }

                        }
                        if (allStatus.Any(b => b.Status == false) == false)
                        {
                            work.SaveChanges();
                            allStatus.Add(new PublisherStatus() { Message = "Data uploaded sucessfully for sheet " + sheetName, Status = true });
                        }
                        else
                        {
                            allStatus.Add(new PublisherStatus
                            {
                                Status = false,
                                Message = "Data uploading failed for sheet " + sheetName
                            });
                        }
                    }
                }
            }
            return allStatus;
        }
コード例 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the DomesticWHTRates EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDomesticWHTRates(DomesticWHTRate domesticWHTRate)
 {
     base.AddObject("DomesticWHTRates", domesticWHTRate);
 }