Ejemplo n.º 1
0
        /// <summary>
        /// データの読み込み
        /// </summary>
        public void read_data()
        {
            string str;
            string[] sstr;

            if( File.Exists( file_name ) ){
            }else{
                FileStream fs = new FileStream( file_name, FileMode.Create );
                fs.Close();
            }
            StreamReader sr = new StreamReader(file_name, System.Text.Encoding.GetEncoding("shift_jis"));

            while (sr.Peek() > -1)
            {
                str = sr.ReadLine();
                sstr = str.Split(',');
                Data temp = new Data();
                temp.createDate = DateTime.Parse(sstr[0]);
                temp.limitDate = DateTime.Parse(sstr[1]);
                temp.exitDate = DateTime.Parse(sstr[2]);
                if( COLOR_FLAG.DATE.ToString() == sstr[3] ){
                    temp.now_status = COLOR_FLAG.DATE;
                }
                else if (COLOR_FLAG.EMERGENCY.ToString() == sstr[3])
                {
                    temp.now_status = COLOR_FLAG.EMERGENCY;
                }
                else if (COLOR_FLAG.FINISH.ToString() == sstr[3])
                {
                    temp.now_status = COLOR_FLAG.FINISH;
                }
                else if (COLOR_FLAG.MEMO1.ToString() == sstr[3])
                {
                    temp.now_status = COLOR_FLAG.MEMO1;
                }
                else if (COLOR_FLAG.MEMO2.ToString() == sstr[3])
                {
                    temp.now_status = COLOR_FLAG.MEMO2;
                }
                else if (COLOR_FLAG.MEMO3.ToString() == sstr[3])
                {
                    temp.now_status = COLOR_FLAG.MEMO3;
                }
                else if (COLOR_FLAG.UNLIMITED.ToString() == sstr[3])
                {
                    temp.now_status = COLOR_FLAG.UNLIMITED;
                }
                else if (COLOR_FLAG.OTHER.ToString() == sstr[3])
                {
                    temp.now_status = COLOR_FLAG.OTHER;
                }
                temp.name = sstr[4];
                temp.memo = sstr[5];
                for(int i=6; i < sstr.Length; i++ ){
                    temp.memo += ",";
                    temp.memo += sstr[ i ];
                }

                temp.memo = temp.memo.Replace("<br>", Environment.NewLine );

                this.data.Add(temp);
            }
            sr.Close();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 新規作成
        /// </summary>
        public void create()
        {
            Form2 form2 = new Form2("", "", DateTime.Today.ToString());
            form2.ShowDialog( this );

            if( form2.status ){
                //データの更新
                Data tD = new Data();
                //data.add( form2.name, form2.memo, data.data[0].status( form2.date ) );
                data.add(form2.name, form2.memo, tD.status(form2.date));
                int num = data.data.Count - 1;
                if( data.data[ num ].now_status == COLOR_FLAG.DATE ) data.data[ num ].setStatus( form2.date );

                //画面へ描画
                data.MySort();
                this.reDraw();
                data.write_data();
            }
            //殺す
            form2.Dispose();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// データの追加
        /// ※
        /// </summary>
        /// <param name="name">やること</param>
        /// <param name="memo">メモ</param>
        /// <param name="now_status">期限の状態</param>
        public void add(string name, string memo, COLOR_FLAG now_status)
        {
            Data temp = new Data();
            temp.createDate = DateTime.Now;
            temp.limitDate = DateTime.Now;
            temp.exitDate = DateTime.Now;
            temp.name = name;
            temp.memo = memo;
            temp.now_status = now_status;

            this.data.Add(temp);
            this.MySort();
        }