Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Pdetails.Contacts = null;
            List <string> contacts = new List <string>();

            foreach (DataGridViewRow r in dataGridView1.Rows)
            {
                string tmp_str = "";
                for (int i = 0; i <= 5; i++)
                {
                    string v = "";
                    if (r.Cells[i].Value != null)
                    {
                        v = r.Cells[i].Value.ToString();
                    }
                    tmp_str += v + ",";
                }
                tmp_str = tmp_str.Remove(tmp_str.Length - 1, 1);
                if (tmp_str.Replace(",", "") != "")
                {
                    contacts.Add(tmp_str);
                }
            }
            Pdetails.Contacts = contacts.ToArray();

            XML_Class XmlFile = new XML_Class();

            XmlFile.FilePath = currentXMLpath;
            XmlFile.WriteXml(Pdetails);
            XmlFile.SaveXml();

            this.Close();
        }
Example #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            getPdetailsFromTexts();
            //DirectoryInfo Dinfo = new DirectoryInfo(@"E:\项目文件\" + Pdetails.FolderName());//创建文件夹地址字符串
            XML_Class XmlFile = new XML_Class();

            XmlFile.FilePath = xmlPath;
            this.Text        = Pdetails.Pnote;
            XmlFile.WriteXml(Pdetails);
            this.Text = this.Text + " " + Pdetails.Pnote;
            XmlFile.SaveXml();

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Example #3
0
        private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.CurrentCell.ColumnIndex == 0)
            {
                listView1.Focus(); return;
            }
            switch (dataGridView1.CurrentCell.RowIndex)
            {
            case 0:
                pd.Pname = dataGridView1.CurrentCell.Value.ToString();
                break;

            case 1:
                pd.Pindex = dataGridView1.CurrentCell.Value.ToString();
                break;

            case 2:
                pd.P = dataGridView1.CurrentCell.Value.ToString();
                break;

            case 3:
                pd.C = dataGridView1.CurrentCell.Value.ToString();
                break;

            case 4:
                pd.Pincharge = dataGridView1.CurrentCell.Value.ToString();
                break;

            case 5:
                pd.Cincharge = dataGridView1.CurrentCell.Value.ToString();
                break;

            case 6:
                pd.Pdep = dataGridView1.CurrentCell.Value.ToString();
                break;

            case 7:
                pd.Pnote = dataGridView1.CurrentCell.Value.ToString();
                break;
            }

            XML_Class XmlFile = new XML_Class();

            XmlFile.FilePath = @"E:\项目文件\" + pd.FolderName(1) + @"\" + pd.Pname + @".xml";
            XmlFile.WriteXml(pd);
            XmlFile.SaveXml();
            listView1.Focus();
        }
Example #4
0
        private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.CurrentCell.ColumnIndex == 0)
            {
                listView1.Focus(); return;
            }
            switch (dataGridView1.CurrentCell.RowIndex)
            {
            case 0:
                currentPD.Pname = dataGridView1.CurrentCell.Value.ToString();
                break;

            case 1:
                currentPD.Pindex = dataGridView1.CurrentCell.Value.ToString();
                break;

            case 2:
                currentPD.P = dataGridView1.CurrentCell.Value.ToString();
                break;

            case 3:
                currentPD.C = dataGridView1.CurrentCell.Value.ToString();
                break;

            case 4:
                currentPD.Pincharge = dataGridView1.CurrentCell.Value.ToString();
                break;

            case 5:
                currentPD.Cincharge = dataGridView1.CurrentCell.Value.ToString();
                break;

            case 6:
                currentPD.Pdep = dataGridView1.CurrentCell.Value.ToString();
                break;

            case 7:
                currentPD.Pnote = dataGridView1.CurrentCell.Value.ToString();
                break;
            }
            msc_FolderList.updatePD(currentPD, currentFolder);
            XML_Class XmlFile = new XML_Class();

            XmlFile.FilePath = currentXMLpath;
            XmlFile.WriteXml(currentPD);
            XmlFile.SaveXml();
            listView1.Focus();
        }
Example #5
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            getPdetailsFromTexts();

            //DirectoryInfo Dinfo = new DirectoryInfo(@"E:\项目文件\" + Pdetails.FolderName());//创建文件夹地址字符串
            DirectoryInfo Dinfo = new DirectoryInfo(msc_FolderList.defaultPath + @"\" + Pdetails.FolderName()); //创建文件夹地址字符串

            Dinfo.Create();                                                                                     //创建文件夹

            XML_Class XmlFile = new XML_Class();

            XmlFile.FilePath = xmlPath == null ? msc_FolderList.defaultPath + Pdetails.FolderName() + @"\foldersPD.xml" : xmlPath;
            XmlFile.WriteXml(Pdetails);
            XmlFile.SaveXml();

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Example #6
0
        private void dataGridView2_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView2.CurrentCell.Value == null)
            {
                return;
            }
            try
            {
                string tmp = currentPD.Contacts[dataGridView2.CurrentCell.RowIndex];
            }
            catch
            {
                List <string> contacts = new List <string>();
                foreach (string str in currentPD.Contacts)
                {
                    contacts.Add(str);
                }
                contacts.Add(",,,,,");
                currentPD.Contacts = contacts.ToArray();
            }

            string tmp_str = currentPD.Contacts[dataGridView2.CurrentCell.RowIndex];

            string[] sArray = Regex.Split(tmp_str, ",", RegexOptions.IgnoreCase);
            sArray[dataGridView2.CurrentCell.ColumnIndex] = dataGridView2.CurrentCell.Value.ToString();
            tmp_str = "";
            for (int i = 0; i <= sArray.GetUpperBound(0); i++)
            {
                tmp_str += sArray[i] + ",";
            }
            currentPD.Contacts[dataGridView2.CurrentCell.RowIndex] = tmp_str.Remove(tmp_str.Length - 1, 1);

            msc_FolderList.updatePD(currentPD, currentFolder);
            XML_Class XmlFile = new XML_Class();

            XmlFile.FilePath = currentXMLpath;
            XmlFile.WriteXml(currentPD);
            XmlFile.SaveXml();
            listView1.Focus();
        }