Example #1
0
        //↓添加更改或删除界面_添加按钮
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox2.Text.Length == 0)
            {
                MessageBox.Show("订单号不可为空!");
            }
            else if (textBox3.Text.Length == 0)
            {
                MessageBox.Show("送货日期不可为空!");
            }

            else
            {
                string sql            = "SELECT orderNumber FROM Goods WHERE id = " + id;
                string orderNumber_01 = (string)GM_DM.FindData(sql);
                if (orderNumber_01 == textBox2.Text)
                {
                    MessageBox.Show("添加失败,订单号重复!");
                }
                else
                {
                    GetProductsNumber();
                    int num = GM_AOA.GetProductsNumber();
                    GM_DM.GetData_Operation(num, MainSystem.thisAdmin, "管理员:" + MainSystem.thisAdmin + "添加了订单号为 " + textBox2.Text + "的送货信息", DateTime.Now.ToString());

                    GM_DM.GetData_Goods(Num, dataGridView4.Rows[0].Cells[1].Value.ToString(), dataGridView4.Rows[0].Cells[2].Value.ToString(), dataGridView4.Rows[0].Cells[3].Value.ToString(), dataGridView4.Rows[0].Cells[4].Value.ToString(), dataGridView4.Rows[0].Cells[5].Value.ToString(), textBox3.Text, "否", textBox2.Text);
                    MessageBox.Show("添加成功!");
                    dataGridView4.DataSource = null;
                    textBox3.Text            = null;
                }
            }
            string sql_01 = "SELECT * FROM Goods";

            UpdateDataView_GM(sql_01);
        }
Example #2
0
        //↓确认添加时的按钮响应事件
        private void button6_Click(object sender, EventArgs e)
        {
            bool IsHave = false;

            if (textBox2.Text.Length == 0)
            {
                MessageBox.Show("创建失败,功能分类不能为空");
            }
            else if (textBox3.Text.Length == 0)
            {
                MessageBox.Show("创建失败,种类分类不能为空");
            }
            else if (textBox4.Text.Length == 0)
            {
                MessageBox.Show("创建失败,品牌分类不能为空");
            }
            else if (textBox5.Text.Length == 0)
            {
                MessageBox.Show("创建失败,价格不能为空");
            }
            else if (textBox6.Text.Length == 0)
            {
                MessageBox.Show("创建失败,产品名不能为空");
            }
            else if (textBox7.Text.Length == 0)
            {
                MessageBox.Show("创建失败,序列号不能为空");
            }
            else
            {
                GetProductsNumber();                                                                                                                        //得到产品数目
                IsHave = PM_DM.GetData_Product(Num, textBox2.Text, textBox3.Text, textBox4.Text, float.Parse(textBox5.Text), textBox6.Text, textBox7.Text); //向产品库中添加数据
            }
            if (!IsHave)
            {
                MessageBox.Show("创建失败,序列号重复");
            }
            else
            {
                int num = PM_AOA.GetProductsNumber();
                PM_DM.GetData_Operation(num, MainSystem.thisAdmin, "管理员:" + MainSystem.thisAdmin + "向产品库中添加序列号为 " + textBox7.Text + "的产品", DateTime.Now.ToString());              //向操作记录库中添加数据
                int num_01 = PM_AOA.GetAllProductNumber();
                PM_DM.GetData_AllProduct(num_01, textBox2.Text, textBox3.Text, textBox4.Text, float.Parse(textBox5.Text), textBox6.Text, textBox7.Text, DateTime.Now.ToString()); //向所有产品库中添加数据
                textBox2.Text = null;
                textBox3.Text = null;
                textBox4.Text = null;
                textBox5.Text = null;
                textBox6.Text = null;
                textBox7.Text = null;
                MessageBox.Show("创建成功!");

                string sql_01 = "SELECT * FROM Product";
                UpdateDataView(sql_01);
            }
        }
Example #3
0
        //↓添加页面_确认添加
        private void button6_Click(object sender, EventArgs e)
        {
            if (textBox2.Text.Length == 0)
            {
                MessageBox.Show("添加失败,姓名不能为空");
            }
            else if (textBox3.Text.Length == 0)
            {
                MessageBox.Show("添加失败,性别分类不能为空");
            }
            else if (textBox4.Text.Length == 0)
            {
                MessageBox.Show("添加失败,电话不能为空");
            }
            else if (textBox5.Text.Length == 0)
            {
                MessageBox.Show("添加失败,住址不能为空");
            }
            else if (textBox6.Text.Length == 0)
            {
                MessageBox.Show("添加失败,商品名不能为空");
            }

            else
            {
                string        sql  = "SELECT name FROM Product";
                List <string> Name = CM_DM.GetNoRepeatList(sql);
                bool          Have = false;
                foreach (string i in Name)
                {
                    if (i.Contains(textBox6.Text))
                    {
                        Have = true;
                        break;
                    }
                }
                if (Have)
                {
                    GetProductsNumber();
                    CM_DM.GetData_Customer(Num, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, textBox6.Text, textBox7.Text);

                    int num = CM_AOA.GetProductsNumber();                     //向操作记录库中添加信息
                    CM_DM.GetData_Operation(num, MainSystem.thisAdmin, "管理员:" + MainSystem.thisAdmin + "添加了订单号为 " + textBox7.Text + "的顾客信息", DateTime.Now.ToString());

                    int num_01 = CM_AOA.GetAllCustomerNumber();              //向所有顾客信息库中添加信息
                    CM_DM.GetData_AllCustomer(num_01, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, textBox6.Text, textBox7.Text, DateTime.Now.ToString());
                    AddAll();
                    MessageBox.Show("创建成功!");
                    textBox2.Text = null;
                    textBox3.Text = null;
                    textBox4.Text = null;
                    textBox5.Text = null;
                    textBox6.Text = null;
                    textBox7.Text = null;

                    string sql_01 = "SELECT * FROM Customer";
                    UpdateDataView_CM(sql_01);
                }
                else
                {
                    MessageBox.Show("创建失败!商品名不存在!");
                }
            }
        }
Example #4
0
 //↓点击登录,进行用户名和密码的判断
 private void button1_Click(object sender, EventArgs e)
 {
     if (WhichScript == "ChooseSever")
     {
         string sql  = "SELECT * FROM ExAdmin WHERE name = " + "'" + textBox1.Text + "'";
         bool   flag = AD_DM.RunSql(sql);
         if (flag)
         {
             string sql_01  = "SELECT * FROM ExAdmin WHERE name = " + "'" + textBox1.Text + "'AND key LIKE " + "'" + textBox2.Text + "'";
             bool   flag_01 = AD_DM.RunSql(sql_01);
             if (flag_01)
             {
                 MessageBox.Show("登录成功!");
                 MainSystem.thisAdmin = textBox1.Text;
                 this.Visible         = false;
                 ChooseSever.GetResult(AD_CS, WhichScreen);
             }
             else
             {
                 MessageBox.Show("密码错误!");
             }
         }
         else
         {
             MessageBox.Show("用户名错误!");
         }
     }
     else
     {
         string sql  = "SELECT * FROM Admin WHERE name = " + "'" + textBox1.Text + "'";
         bool   flag = AD_DM.RunSql(sql);
         if (flag)
         {
             string sql_01  = "SELECT * FROM Admin WHERE name = " + "'" + textBox1.Text + "'AND key LIKE " + "'" + textBox2.Text + "'";
             bool   flag_01 = AD_DM.RunSql(sql_01);
             if (flag_01)
             {
                 MessageBox.Show("登录成功!");
                 MainSystem.thisAdmin = textBox1.Text;
                 AD_AOA = new AllOfAll();
                 int num = AD_AOA.GetProductsNumber();
                 AD_DM.GetData_Operation(num, textBox1.Text, "管理员:" + textBox1.Text + "登录", DateTime.Now.ToString());
                 if (WhichScript == "ProductManager")
                 {
                     ProductManager.GetResult(AD_PM, WhichScreen);
                     this.Visible = false;
                 }
                 if (WhichScript == "CustomerManager")
                 {
                     CustomerManager.GetResult_CM(AD_CM, WhichScreen);
                     this.Visible = false;
                 }
                 if (WhichScript == "GoodsManager")
                 {
                     GoodsManager.GetResult_GM(AD_GM, WhichScreen);
                     this.Visible = false;
                 }
                 if (WhichScript == "InstallManager")
                 {
                     InstallManager.GetResult_IM(AD_IM, WhichScreen);
                     this.Visible = false;
                 }
                 if (WhichScript == "MaintainManager")
                 {
                     MaintainManager.GetResult_MM(AD_MM, WhichScreen);
                     this.Visible = false;
                 }
             }
             else
             {
                 MessageBox.Show("密码错误!");
             }
         }
         else
         {
             MessageBox.Show("用户名错误!");
         }
     }
 }