Example #1
0
 public static void Import(string filename)
 {
     IEnumerable<Todo> todos = GetImportTodos(filename);
     //TODO 全体的に、変数定義をvarで行うべき
     using (TodoDataClassesDataContext d = new  TodoDataClassesDataContext())
     {
         foreach (Todo x in todos) d.Todo.InsertOnSubmit(x);
         d.SubmitChanges();
     }
 }
Example #2
0
        static public void Import(string filename)
        {
            IEnumerable <Todo> todos = GetImportTodos(filename);

            //TODO 全体的に、変数定義をvarで行うべき
            using (TodoDataClassesDataContext d = new  TodoDataClassesDataContext())
            {
                foreach (Todo x in todos)
                {
                    d.Todo.InsertOnSubmit(x);
                }
                d.SubmitChanges();
            }
        }
Example #3
0
 public static void Export(string filename)
 {
     Encoding encode = Encoding.GetEncoding("Shift_Jis");
     //TODO 全体的に、変数定義をvarで行うべき
     using(StreamWriter w = new StreamWriter(filename, false, encode))
     {
         //TODO 全体的に、変数定義をvarで行うべき
         using(TodoDataClassesDataContext d = new TodoDataClassesDataContext())
         {
             foreach(Todo x in d.Todo)
             {
                 string s = string.Format(
                     "\"{0}\",\"{1}\",\"{2}\",{3}",
                     x.Title,
                     x.Contents,
                     x.Limit.Value.ToString("yyyy/MM/dd"),
                     x.IsFinished);
                 w.WriteLine(s);
             }
         }
     }
 }
Example #4
0
        static public void Export(string filename)
        {
            Encoding encode = Encoding.GetEncoding("Shift_Jis");

            //TODO 全体的に、変数定義をvarで行うべき
            using (StreamWriter w = new StreamWriter(filename, false, encode))
            {
                //TODO 全体的に、変数定義をvarで行うべき
                using (TodoDataClassesDataContext d = new TodoDataClassesDataContext())
                {
                    foreach (Todo x in d.Todo)
                    {
                        string s = string.Format(
                            "\"{0}\",\"{1}\",\"{2}\",{3}",
                            x.Title,
                            x.Contents,
                            x.Limit.Value.ToString("yyyy/MM/dd"),
                            x.IsFinished);
                        w.WriteLine(s);
                    }
                }
            }
        }
Example #5
0
 public TodoLogic()
 {
     _dataContext = new TodoDataClassesDataContext();
     FillItems();
 }
Example #6
0
 public TodoLogic()
 {
     _dataContext = new TodoDataClassesDataContext();
     FillItems();
 }