Example #1
0
 //メニューバーの「メニュー」下アイテムをクリックした際の処理
 private void menuToolStripMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) {
     DialogResult result;
     switch (e.ClickedItem.Name) {
         //環境設定
         case "tsmiSettings":
             if (tabs.Count>1)
                 result = MessageBox.Show("環境設定を開く前に開いているプロジェクトを閉じる必要があります。よろしいですか?", "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
             else
                 result = DialogResult.Yes;
             if (result == DialogResult.Yes) {
                 ClearTabs();
                 next_step = NextStep.PROJECT;
                 frm_sub = new frmSubWindow(env_data, log, OpenWindowType.ENV_SETTINGS);
                 frm_sub.FormClosed += new FormClosedEventHandler(frmSubWindow_Closed);
                 frm_sub.Show();
                 this.Enabled = false;
             }  
             break;
         //事業所マスタを編集
         case "tsmiOfficeMaster":
             try {
                 frm_sub = new frmSubWindow(env_data, log, OpenWindowType.OFFICE_MASTER);
             } catch (Exception ex) {
                 if (MessageBox.Show(ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK) {
                     break;
                 }
             }
             frm_sub.FormClosed += new FormClosedEventHandler(frmSubWindow_Closed);
             frm_sub.Show();
             this.Enabled = false;
             break;
         //担当者マスタを編集
         case "tsmiPersonMaster":
             try {
                 frm_sub = new frmSubWindow(env_data, log, OpenWindowType.PERSON_MASTER);
             } catch (Exception ex) {
                 if (MessageBox.Show(ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK) {
                     break;
                 }
             }
             frm_sub.FormClosed += new FormClosedEventHandler(frmSubWindow_Closed);
             frm_sub.Show();
             this.Enabled = false;
             break;
         //処理内容マスタを編集
         case "tsmiTaskMaster":
             try {
                 frm_sub = new frmSubWindow(env_data, log, OpenWindowType.CATEGORY_MASTER);
             } catch (Exception ex) {
                 if (MessageBox.Show(ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK) {
                     break;
                 }
             }
             frm_sub.FormClosed += new FormClosedEventHandler(frmSubWindow_Closed);
             frm_sub.Show();
             this.Enabled = false;
             break;
         //状態マスタを編集
         case "tsmiProgressMaster":
             try {
                 frm_sub = new frmSubWindow(env_data, log, OpenWindowType.STATUS_MASTER);
             } catch (Exception ex) {
                 if (MessageBox.Show(ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK) {
                     break;
                 }
             }
             frm_sub.FormClosed += new FormClosedEventHandler(frmSubWindow_Closed);
             frm_sub.Show();
             this.Enabled = false;
             break;
         //画面関係ユーティリティ
         case "tsmiUtilities":
             break;
         //画面解像度
         case "tsmiScreenResolution":
             MessageBox.Show("画面の解像度:" + Screen.PrimaryScreen.Bounds.Width + "×" + Screen.PrimaryScreen.Bounds.Height,"画面の解像度");
             break;
         //リポジトリ
         case "tsmiRepository":
             SvnManager svn = new SvnManager(env_data);
             svn.TortoiseSvn("Project", "repobrowser", env_data.Project.Folder, env_data.Project.URL);
             break;
         //質問受付フォーム
         case "tsmiInquiry":
             string strMyURL = "http://www.docmaker.net/contact_us.html";
             Process.Start(GetDefaultBrowser(), strMyURL);
             break;
         //docmaker.net メンバー検索
         case "tsmiMember":
             string strMyURL2 = "http://www.docmaker.net/member/";
             Process.Start(GetDefaultBrowser(), strMyURL2);
             break;
         //バージョン情報
         case "tsmiVersion":
             frm_sub = new frmSubWindow(env_data, log, OpenWindowType.VERSION);
             frm_sub.FormClosed += new FormClosedEventHandler(frmSubWindow_Closed);
             frm_sub.Show();
             this.Enabled = false;
             break;
         //docmaker.netホームページ
         case "tsmiHomepage":
             string strMyURL3 = "http://www.docmaker.net/";
             Process.Start(GetDefaultBrowser(), strMyURL3);
             break;
     }
 }
Example #2
0
 //アプリケーションの終了
 private void CloseApplication() {
     if (MessageBox.Show("アプリケーションを終了してよろしいですか", "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) return;
     SvnManager svn = new SvnManager(env_data);
     svn.TortoiseSvn("Project", "commit", env_data.Project.Folder, "");
     this.Close();
 }
Example #3
0
        //タスク一覧の表示
        private void ShowDetail() {
            dgvMain.MultiSelect = true;
            log.Write("ShowDetailBEGIN");
            log.Write("Step1");
            log.Close();
            if (env_data.Project.SelectedFolder == "") {
                MessageBox.Show("プロジェクトが選択されていません。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            string task = env_data.Project.Folder + env_data.Project.SelectedFolder + @"\task.xml";
            if (!File.Exists(task)) {
                string excel = task.Replace(".xml", ".xls");
                if (!File.Exists(excel)) {
                    MessageBox.Show("タスクマスタが見つかりません", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabs[tabs.Count - 1].Controls.Remove(mainView);
                    DeleteTab(tabs.Count - 1);
                    tabs[0].Controls.Add(mainView);
                    tabControl.SelectedIndex = 0;
                    ShowProjectData();
                    return;
                } else {
                    XMLConverter xml = new XMLConverter(XmlType.TaskList, excel);
                    xml.Convert();
                }
            }

            if (env_data.Project.TortoiseSVN) {
                if (svn == null) svn = new SvnManager(env_data);
                if (task == "")
                    svn.TortoiseSvn("Project", "checkout", env_data.Project.Folder + @"\" + env_data.Project.SelectedFolder, env_data.Project.URL + env_data.Project.SelectedFolder);
                else
                    svn.TortoiseSvn("Project", "update", env_data.Project.Folder + @"\" + env_data.Project.SelectedFolder, "");
            }
            log.Write("Step2");
            log.Close();
            ds_main = new DataSet();
            ds_main.ReadXml(task);
            DataView dv = new DataView(ds_main.Tables["Task"].Copy());
            InitDatagridView(dv);
            dgvMain.DataSource = dv;
            DataGridViewTextBoxColumn dvc = new DataGridViewTextBoxColumn();
            dvc.ValueType = Type.GetType("System.Datetime");
            dvc.Name = "最終更新日";
            dgvMain.Columns.Insert(5, dvc);
            int[] widths = {60, 345, 80, 60, 80, 100, 85, 85, 60 };
            while (dgvMain.Columns.Count > 9) { dgvMain.Columns.RemoveAt(dgvMain.Columns.Count - 1); }
            for (int i = 0; i < dgvMain.Columns.Count; i++) {
                dgvMain.Columns[i].Width = widths[i];
                if (i == 3) {
                    dgvMain.Columns[i].HeaderText="様式";
                    foreach (DataGridViewRow dr in dgvMain.Rows) {
                        if (dr.Cells[i].Value != null)
                            dr.Cells[i].Value = Path.GetExtension(dr.Cells[i].Value.ToString());
                    }
                } else if (i == 5) {
                    string f_name;
                    foreach (DataGridViewRow dr in dgvMain.Rows) {
                        if (dr.Cells[3].Value == null) continue;
                        f_name = env_data.Project.Folder + env_data.Project.SelectedFolder + @"\" + ds_main.Tables["Task"].Rows[dr.Index][3];
                        if (File.Exists(f_name))
                            dr.Cells[i].Value = File.GetLastAccessTime(f_name).ToString(@"yyyy/MM/dd");
                    }
                }
            }
            dgvMain.Rows[0].Selected = true;
            SetTaskRowsColor();
            SetButtons();
            log.Write("ShowDetailEND");
            log.Close();
            
        }
 //業務パックフォルダ情報の設定変更
 private void SetMasterFolder() {
     Master master = env.Master;
     master.Folder = tbxWizard02Master.Text;
     master.TortoiseSVN = cbxWizard03Master.Checked;
     master.URL = tbxWizard03Master.Text;
     env.Master = master;
     env.SaveEnvData();
     string[] directories = Directory.GetDirectories(master.Folder);
     SvnManager svn = new SvnManager(env);
     if (directories.Length > 0)
         svn.TortoiseSvn("Master", "update", master.Folder, "");
      else 
         svn.TortoiseSvn("Master", "checkout", master.Folder, master.URL);
 }
        //プロジェクトの追加
        private void AddProject() {
            log.Write("AddProjectBegin");
            log.Write("Step0");

            data_set = new DataSet();
            data_set.ReadXml(master_file, XmlReadMode.ReadSchema);
            Random rnd = new Random();
            Project pj = env.Project;
            log.Write("Step1");
            pj.SelectedFolder = DateTime.Now.ToString("yyyyMMddhhmmss") + rnd.Next(100).ToString("d2");
            env.Project = pj;
            env.SaveEnvData();
            Directory.CreateDirectory(env.Project.Folder + pj.SelectedFolder);
            log.Write("Step2");
            string strApplicationName = data_set.Tables["申請一覧表"].Rows[cmbWizard0301.SelectedIndex][1].ToString();
            DataTable dt_tasks = data_set.Tables[strApplicationName];
            DataView dv = new DataView(dt_tasks);
            string filter = "";
            string tag = "";
            int idx = 1;
            ComboBox cmb;
            //オプションの情報から、master.xmlをフィルタリングする
            foreach (DataRow dr in data_set.Tables["オプション一覧"].Rows) {
                if (tbcWizard10.TabPages[dr[2].ToString()] == null) { idx++; continue; }
                cmb = (ComboBox)tbcWizard10.TabPages[dr[2].ToString()].Controls[dr[2].ToString()];
                filter += filter.Length > 0 ? " AND " : "";
                tag = tbcWizard10.TabPages[dr[2].ToString()].Tag.ToString();
                filter += "[" +tag  + "] IN(" + (cmb.SelectedIndex + 1).ToString() + ",9) ";
                idx++;
            }
            dv.RowFilter = filter;
            log.Write("Step3");
            //フィルタリングした情報を元にTaskテーブルを作成する
            DataSet ds_new_task = new DataSet();
            ds_new_task.Tables.Add(dv.ToTable());
            ds_new_task.Tables[0].TableName = "Task";
            for (int i = 0; i < ds_new_task.Tables["Task"].Rows.Count; i++) {
                ds_new_task.Tables["Task"].Rows[i][0] = (i + 1) * 10;
                if (ds_new_task.Tables["Task"].Rows[i][4].ToString() == "未定") ds_new_task.Tables["Task"].Rows[i][4] = cmbWizard0302.Text;
            }
            ds_new_task.Tables.Add(CreateNewCompanyTable());
            ds_new_task.WriteXml(env.Project.Folder + pj.SelectedFolder + @"\task.xml", XmlWriteMode.WriteSchema);

            log.Write("Step4");
            log.Write("Step5");

            foreach (DataRow dr in ds_new_task.Tables["Task"].Rows) {
                if (dr[3] != null && dr[3].ToString() != "" && !File.Exists(env.Project.Folder + pj.SelectedFolder + @"\" + dr[3].ToString()))
                    File.Copy(Path.GetDirectoryName(master_file) + @"\" + dr[3].ToString(), env.Project.Folder + pj.SelectedFolder + @"\" + dr[3].ToString());
            }
            SvnManager svn = new SvnManager(env);
            svn.TortoiseSvn("Project", "add", env.Project.Folder + pj.SelectedFolder, "");

            //index.xmlへ追加したプロジェクトの情報を追加する
            log.Write("Step6");
            DataSet ds_index = new DataSet();
            ds_index.ReadXml(env.Documents.Path, XmlReadMode.ReadSchema);
            DataRow dr_new = ds_index.Tables["ProjectData"].NewRow();
            dr_new[0] = pj.SelectedFolder;
            dr_new[1] = tbxWizard0201.Text + "-" + cmbWizard0301.Text;
            dr_new[2] = pj.SelectedFolder;
            dr_new[3] = cmbWizard0302.Text;
            dr_new[4] = DateTime.Now.ToString("yyyy/MM/dd");
            dr_new[5] = "";
            dr_new[6] = "";
            dr_new[7] = "作業中";
            ds_index.Tables["ProjectData"].Rows.InsertAt(dr_new, 0);
            ds_index.WriteXml(env.Documents.Path, XmlWriteMode.WriteSchema);

            log.Write("Step7");
            log.Write("Step8");
            log.Write("AddProjectEnd");
            log.Close();
            this.Close();
        }
        //プロジェクトファイルの保存
        private bool SaveProject() {
            bool flag = true;
            if (tbxProjectName.Text == "") {
                flag = false;
                MessageBox.Show("プロジェクト名が設定されていません", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
            } else {
                if (c_window == OpenWindowType.PROJECT_DATA) {
                    data_set.Tables["ProjectData"].Select("項番='" + project_no + "'")[0][1] = tbxProjectName.Text;
                    data_set.Tables["ProjectData"].Select("項番='" + project_no + "'")[0][3] = cmbPerson.Text;
                    data_set.Tables["ProjectData"].Select("項番='" + project_no + "'")[0][4] = tbxStartDate.Text;
                    data_set.Tables["ProjectData"].Select("項番='" + project_no + "'")[0][5] = tbxEndDate.Text;
                    data_set.Tables["ProjectData"].Select("項番='" + project_no + "'")[0][6] = tbxRenewalDate.Text;
                    data_set.Tables["ProjectData"].Select("項番='" + project_no + "'")[0][7] = cmbStatus.Text;
                } else if (c_window == OpenWindowType.GET_PROJECT) {
                    Project pj = env.Project;
                    if (tbxProjectFolder.Text.IndexOf(".dpr") == -1) {
                        Random rnd = new Random();
                        pj.SelectedFolder = DateTime.Now.ToString("yyyyMMddhhmmss") + rnd.Next(100).ToString("d2");
                        env.Project = pj;
                        env.SaveEnvData();

                        Microsoft.VisualBasic.FileIO.FileSystem.CopyDirectory(tbxProjectFolder.Text, pj.Folder + pj.SelectedFolder, Microsoft.VisualBasic.FileIO.UIOption.AllDialogs, Microsoft.VisualBasic.FileIO.UICancelOption.DoNothing);
                        if (File.Exists(pj.Folder + pj.SelectedFolder + @"\.svn")) File.Delete(pj.Folder + pj.SelectedFolder + @"\.svn");
                        SvnManager svn = new SvnManager(env);
                        svn.TortoiseSvn("Project", "add", pj.Folder + pj.SelectedFolder, "");
                    } else {
                        try {
                            pj.SelectedFolder = tbxProjectFolder.Text.Split(';')[1];
                            env.Project = pj;
                            env.SaveEnvData();
                        } catch (Exception ex) {
                            MessageBox.Show(ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return false;
                        }
                        if (data_set.Tables["ProjectData"].Select("項番=" + pj.SelectedFolder).Length > 0) {
                            MessageBox.Show("すでにリスト中に同じ項番のプロジェクトが存在します。\nプロジェクト取込を中止しました。", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return false;
                        }
                    }

                    if (tbxProjectName.Text == "") {
                        MessageBox.Show("プロジェクト名を入力してください。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return false;
                    } else {
                        DataRow dr = data_set.Tables["ProjectData"].NewRow();
                        dr[0] = env.Project.SelectedFolder;
                        dr[1] = tbxProjectName.Text;
                        dr[2] = env.Project.SelectedFolder;
                        dr[3] = cmbPerson.Text;
                        dr[4] = tbxStartDate.Text;
                        dr[5] = tbxEndDate.Text;
                        dr[6] = tbxRenewalDate.Text;
                        dr[7] = cmbStatus.Text;
                        data_set.Tables["ProjectData"].Rows.InsertAt(dr, 0);
                    }
                }
                data_set.WriteXml(env.Documents.Path, XmlWriteMode.WriteSchema);
            }
            return flag;
        }