/// <summary>
 /// Create a new EURCurve object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 public static EURCurve CreateEURCurve(global::System.Int32 id)
 {
     EURCurve eURCurve = new EURCurve();
     eURCurve.ID = id;
     return eURCurve;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the EURCurves EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToEURCurves(EURCurve eURCurve)
 {
     base.AddObject("EURCurves", eURCurve);
 }
        public static List<EURCurve> ExtractEURCurveList(DataTable csvData, List<string> columnNames)
        {
            List<EURCurve> importedList = new List<EURCurve>();
            for (int i = 9; i < csvData.Rows.Count; i++)
            {
                try
                {
                    EURCurve model = new EURCurve();
                    model.UploadDate = DateTime.Now;
                    string strSummitText = csvData.Columns[0].ToString();
                    string[] strSplit = strSummitText.Replace(" ", "").Replace("Runat", " ").Split('/');
                    string strDay = strSplit[1].ToString();
                    string strMonth = strSplit[0].ToString();
                    string[] str = strSplit[2].ToString().Split(' ');
                    string strYear = str[0].ToString();
                    if (Convert.ToInt16(strYear) > 50)
                    {
                        strYear = "19" + strYear;
                    }
                    else if (strYear.Length == 1)
                    {
                        strYear = "200" + strYear;
                    }
                    else if (strYear.Length == 4)
                    {
                        strYear = strYear;
                    }
                    else
                        strYear = "20" + strYear;

                    DateTime summitGenDate = Convert.ToDateTime(strYear + "/" + strMonth + "/" + strDay);
                    model.SummitGenDate = summitGenDate;
                    model.CCY = csvData.Rows[3].ItemArray[0].ToString().Replace("Ccy:", "").Trim();
                    model.CurveIndex = csvData.Rows[3].ItemArray[2].ToString().Replace("Index:", "").Trim();
                    if (csvData.Rows[i].ItemArray[2].ToString() != string.Empty)
                        model.DiscFreq = Convert.ToDecimal(csvData.Rows[i].ItemArray[2].ToString());
                    if (csvData.Rows[i].ItemArray[1].ToString() != string.Empty)
                        model.Rate = Convert.ToDecimal(csvData.Rows[i].ItemArray[1].ToString());
                    if (csvData.Rows[i].ItemArray[0].ToString() != string.Empty)
                        model.RateDate = Convert.ToDateTime(csvData.Rows[i].ItemArray[0].ToString());
                    if (csvData.Rows[i].ItemArray[0].ToString().Trim() != string.Empty)
                    {
                        if (csvData.Rows[i].ItemArray[0].ToString().Contains('*'))
                        {
                        }
                        else
                        {
                            model.Days = (Convert.ToDateTime(csvData.Rows[i].ItemArray[0]) - summitGenDate).Days;
                        }
                    }
                    model.IsNew = true;
                    if ((csvData.Rows[i].ItemArray[0].ToString() != string.Empty && csvData.Rows[i].ItemArray[1].ToString() != string.Empty) && csvData.Rows[i].ItemArray[2].ToString() != string.Empty)
                    {
                        importedList.Add(model);
                    }

                }
                catch (Exception ex)
                {

                }
            }
            //foreach (DataRow row in csvData.Rows)
            //{
            //    EURCurve model = new EURCurve();
            //    // Get All properties
            //    //PropertyInfo[] properties = model.GetType().GetProperties();
            //    //foreach (PropertyInfo pInfo in properties)
            //    //{
            //    //    if (columnNames.Contains(pInfo.Name))
            //    //    {
            //    //        object value = row[pInfo.Name];
            //    //        TypeConverter typeConverter = TypeDescriptor.GetConverter(pInfo.PropertyType);
            //    //        object propValue = null;
            //    //        if (typeConverter.GetType().FullName == "System.ComponentModel.NullableConverter")
            //    //        {
            //    //            if (value.ToString().Trim() == "1")
            //    //            {
            //    //                propValue = typeConverter.ConvertFromString(("True"));
            //    //            }
            //    //        }
            //    //        else
            //    //            propValue = typeConverter.ConvertFromString((value.ToString()));

            //    //        // Set value on the property
            //    //        pInfo.SetValue(model, propValue, null);
            //    //    }
            //    //}
            //    model.UploadDate = DateTime.Now;
            //    string strSummitText = csvData.Columns[0].ToString();

            //}
            return importedList;
        }