コード例 #1
0
 partial void DeletenationalityDef(nationalityDef instance);
コード例 #2
0
 partial void InsertnationalityDef(nationalityDef instance);
コード例 #3
0
 partial void UpdatenationalityDef(nationalityDef instance);
コード例 #4
0
        public ActionResult InsertCSV(string fileName)
        {
            string path = Server.MapPath("~/pdf/" + "countries.csv");
            AdminClass adminClass = new AdminClass();
            int largestId = adminClass.getLargestIdValue(1);

            StreamReader sr = new StreamReader(path);
            string strline = "";
            string[] _values = null;
            int x = 0;
            while (!sr.EndOfStream)
            {
                x++;
                strline = sr.ReadLine();
                _values = strline.Split(',');

                for (int i = 0; i < _values.Length; i++)
                {
                    if (_values[i].Trim().Length > 0)
                    {
                        //subscribedEmail se = new subscribedEmail();
                        //countryDef countries = new countryDef();
                        nationalityDef countries = new nationalityDef();
                        countries.createdDate = DateTime.Now;
                        countries.nationality = _values[i];
                        countries.nationalityId = adminClass.getLargestIdValue(1) + 1;
                        //se.name = subEmail.name;
                        //se.mobileNo = subEmail.phoneNumber;

                        db2.nationalityDefs.InsertOnSubmit(countries);
                        db2.SubmitChanges();
                        //db2.countryDefs.InsertOnSubmit(countries);
                        //db2.SubmitChanges();
                    }
                }
                //if (_values[0].Trim().Length > 0)
                //{
                //    //MessageBox.show(_values[1]);
                //}
            }
            sr.Close();
            return View();
        }