示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (TbUserName.Text.Trim() == "" || TbPWS.Text.Trim() == "")
            {
                MessageBox.Show("请正确输入账号和密码");
                return;
            }
            List <SqlParameter> sqlList = new List <SqlParameter>()
            {
                GuGuGuHelper.CreatePara("@EmployeeID", SqlDbType.Char, ParameterDirection.Input, TbUserName.Text.Trim(), 10),
                GuGuGuHelper.CreatePara("@password", SqlDbType.Char, ParameterDirection.Input, TbPWS.Text.Trim(), 16),
                GuGuGuHelper.CreatePara("@returnValue", SqlDbType.Int, ParameterDirection.ReturnValue),
            };

            GuGuGuHelper.ExecuteNonQuery("prcLogin", sqlList, CommandType.StoredProcedure);
            int returnValue = Convert.ToInt32(sqlList.ElementAt(2).Value);

            if (returnValue == 1)
            {
                MessageBox.Show("登陆成功!");
                GuGuGu fm = new GuGuGu(TbUserName.Text.Trim());
                Hide();
                fm.ShowDialog();
                Close();
            }
            else
            {
                MessageBox.Show("登陆失败!");
            }
        }
示例#2
0
 private void BtnChangePassWord_Click(object sender, EventArgs e)
 {
     if (TbxNewPassword.Text.Trim() == "" || TbxPassWord.Text.Trim() == "")
     {
         MessageBox.Show("密码不能为空!!");
         return;
     }
     if (TbxPassWord.Text.Trim() == TbxNewPassword.Text.Trim())
     {
         string sql = "Update Login set Password = '******' where EmployeeID = '" + TbxEmployeeID.Text.Trim() + "'";
         sql = string.Format(sql, this.TbxNewPassword.Text);
         int cnt = GuGuGuHelper.ExecuteNonQuery(sql);
         if (cnt >= 1)
         {
             MessageBox.Show("修改成功");
         }
         else
         {
             MessageBox.Show("修改失败");
         }
     }
     else
     {
         MessageBox.Show("两次输入的密码不一致,请重新输入");
     }
 }
示例#3
0
 private void Delete()
 {
     if (GuGuGuHelper.IsInDataGridView(selectRow, DGVCategories))
     {
         string id = DGVCategories.Rows[selectRow].Cells["商品类别编号"].Value.ToString();
         {
             string sql = "select * from Products where CategoryID = " + id + "'";
             if (GuGuGuHelper.ExcuteExist(sql))
             {
                 MessageBox.Show("该类别下含有商品,禁止删除!");
                 return;
             }
         }
         {
             string sql = "delete from Categories where CategoryID = '" + id + "'";
             int    cnt = GuGuGuHelper.ExecuteNonQuery(sql);
             if (cnt >= 1)
             {
                 MessageBox.Show("删除成功");
             }
             else
             {
                 MessageBox.Show("删除失败");
             }
             CateRefresh();
         }
     }
     else
     {
         MessageBox.Show("请选择正确的行");
     }
 }
示例#4
0
        private void Updates()
        {
            string sql = @"update dbo.Customers set CustomerName='{0}',Address='{1}',Phone='{2}',Credits='{3}',Notes='{4}' where CustomerID='{5}'";

            sql = string.Format(sql, TbCustomerID.Text.Trim(), TbCustomerName.Text.Trim(), TbCustomerAddr.Text.Trim(), TbCustomerTel.Text.Trim(), TbCustomerCre.Text.Trim(), TbCustomerNote.Text.Trim());
            int cnt = GuGuGuHelper.ExecuteNonQuery(sql);

            MessageBox.Show((cnt >= 1) ? "修改成功" : "修改失败");
        }
示例#5
0
        private void Insert()
        {
            string sql = @"INSERT INTO dbo.Customers VALUES( '{0}','{1}','{2}','{3}','{4}','{5}')";

            sql = string.Format(sql, TbCustomerID.Text.Trim(), TbCustomerName.Text.Trim(), TbCustomerAddr.Text.Trim(), TbCustomerTel.Text.Trim(), TbCustomerCre.Text.Trim(), TbCustomerNote.Text.Trim());
            int cnt = GuGuGuHelper.ExecuteNonQuery(sql);

            MessageBox.Show((cnt >= 1) ? "添加成功" : "添加失败");
        }
示例#6
0
        private new void Update()
        {
            string sql = string.Format("update Products set ThrValue = '{0}' where ProductID = '{1}'", TbThrValue.Text.Trim(), TbProID.Text.Trim());
            int    cnt = GuGuGuHelper.ExecuteNonQuery(sql);

            if (cnt >= 1)
            {
                MessageBox.Show("修改成功");
            }
            else
            {
                MessageBox.Show("修改失败");
            }
        }
示例#7
0
        private void Insert()
        {
            string sql = string.Format("insert into Categories values('{0}','{1}','{2}')", TbID.Text.Trim(), TbName.Text.Trim(), TbDe.Text);
            int    cnt = GuGuGuHelper.ExecuteNonQuery(sql);

            if (cnt >= 1)
            {
                MessageBox.Show("插入成功");
            }
            else
            {
                MessageBox.Show("插入失败");
            }
            TbID.Text = GuGuGuHelper.GetCategoryID();
            CateRefresh();
        }
示例#8
0
 private void Delete()
 {
     if (GuGuGuHelper.IsInDataGridView(selectRow, CustomerMain))
     {
         string id  = CustomerMain.Rows[selectRow].Cells["客户编号"].Value.ToString();
         string sql = "delete from Customers where CustomerID = '" + id + "'";
         int    cnt = GuGuGuHelper.ExecuteNonQuery(sql);
         if (cnt >= 1)
         {
             MessageBox.Show("删除成功");
         }
         else
         {
             MessageBox.Show("删除失败,该用户存在订单或者其他未知错误");
         }
     }
     else
     {
         MessageBox.Show("请选择正确的行");
     }
 }
示例#9
0
 private void Updates()
 {
     if (GuGuGuHelper.IsInDataGridView(selectRow, DGVProduct))
     {
         string sql = "Update Products set ProductName = '" + TbProductName.Text.Trim() + "',SupplierID = '" + CbxCompanyName.SelectedValue + "',CategoryID = '" + CbxCategoryName.SelectedValue + "',UnitPrice = '" + TbUnitPrice.Text.Trim() + "', ThrValue = '" + TbValue.Text + "', Discont = '" + RbOK.Checked + "' where ProductID = '" + TbProductID.Text.Trim() + "'";
         int    cnt = GuGuGuHelper.ExecuteNonQuery(sql);
         if (cnt >= 1)
         {
             MessageBox.Show("修改成功");
         }
         else
         {
             MessageBox.Show("修改失败");
         }
         ProRefresh();
     }
     else
     {
         MessageBox.Show("请选择正确的行");
     }
 }
示例#10
0
 private void Updates()
 {
     if (GuGuGuHelper.IsInDataGridView(selectRow, DGVCategories))
     {
         string id  = DGVCategories.Rows[selectRow].Cells["商品类别编号"].Value.ToString();
         string sql = "update Categories set CategoryName = '" + TbName.Text.Trim() + "',Description = '" + TbDe.Text.Trim() + "' where CategoryID = '" + id + "'";
         int    cnt = GuGuGuHelper.ExecuteNonQuery(sql);
         if (cnt >= 1)
         {
             MessageBox.Show("更新成功");
         }
         else
         {
             MessageBox.Show("更新失败");
         }
         CateRefresh();
     }
     else
     {
         MessageBox.Show("请选择正确的行");
     }
 }