示例#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();
     }
 }
示例#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();
            }
        }
示例#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);
             }
         }
     }
 }
示例#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);
                    }
                }
            }
        }
示例#5
0
 public TodoLogic()
 {
     _dataContext = new TodoDataClassesDataContext();
     FillItems();
 }
示例#6
0
 public TodoLogic()
 {
     _dataContext = new TodoDataClassesDataContext();
     FillItems();
 }