Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (combPltfm.Text.Equals("") || txtName.Text.Equals("") ||
                txtInfo.Text.Equals(""))
            {
                MessageBox.Show("Complete the blank space !", "waraing");
                return;
            }
            else
            {
                Dictionary <string, string> dict = new Dictionary <string, string>();
                dict.Add("pltfmname", combPltfm.Text);
                dict.Add("pdctname", txtName.Text.Trim());
                dict.Add("pdctinfo", txtInfo.Text.Trim());

                if (service.add(dict, "tabproducts"))
                {
                    MessageBox.Show("Save record ok !", "Add Product");
                    parent.resetPdctList();

                    //创建平台下的产品文件夹
                    string pdctPath = ContantInfo.Fs.path + combPltfm.Text + "\\" + txtName.Text.Trim();
                    if (!Directory.Exists(pdctPath))
                    {
                        try
                        {
                            Directory.CreateDirectory(pdctPath);
                        }catch (Exception ex)
                        {
                            LogEx.log("create pdct directory exception:\n" + ex.Message);
                        }
                    }

                    this.Close();
                }
                else
                {
                    MessageBox.Show("Save record failed !", "Add Product");
                }
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Equals("") || txtInfo.Text.Equals(""))
            {
                MessageBox.Show("Please complete the blank space !", "warning");
                return;
            }
            else
            {
                Dictionary <string, string> dict = new Dictionary <string, string>();
                dict.Add("pltfmName", txtName.Text.Trim());
                dict.Add("pltfmInfo", txtInfo.Text.Trim());

                if (service.add(dict, "tabplatforms"))
                {
                    MessageBox.Show("Save record ok !", "Add Platform");
                    parent.resetPltfmList();

                    //在文件系统中创建文件夹
                    string pltfmPath = ContantInfo.Fs.path + txtName.Text.Trim();
                    if (!Directory.Exists(pltfmPath))
                    {
                        try
                        {
                            Directory.CreateDirectory(pltfmPath);
                        }catch (Exception ex)
                        {
                            LogEx.log("create pltfm path exception:\n" + ex.Message);
                        }
                    }

                    this.Close();
                }
                else
                {
                    MessageBox.Show("Save record failed !", "Add Platform");
                }
            }
        }