示例#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("pdctId", pdct.id, "tabproducts"))
         {
             MessageBox.Show("Delete ok !", "delete product");
             parent.resetPdctList();
         }
         else
         {
             MessageBox.Show("Delete failed !", "delete product");
         }
     }
 }
示例#2
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");
                }
            }
        }