Example #1
0
 private void btDel_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure delete this record ?", "Warning", MessageBoxButtons.YesNo)
         == DialogResult.Yes)
     {
         if (service.delete("pltfmId", pltfm.id, "tabplatforms"))
         {
             MessageBox.Show("Delete ok !", "delete platform");
             parent.resetPltfmList();
         }
         else
         {
             MessageBox.Show("Delete failed !", "delete platform");
         }
     }
 }
Example #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");
                }
            }
        }