Beispiel #1
0
        public int SellGoodsUpdate(getMaihuo tbChGood)
        {
            int intFalg = 0;

            try
            {
                string str_Update = "update SellGoods set ";
                str_Update += "KcID='" + tbChGood.getKcID + "',GoodsID='" + tbChGood.getGoodsID + "',";
                str_Update += "EmpId='" + tbChGood.getEmpId + "',GoodsName='" + tbChGood.getGoodsName + "',SellGoodsNum=" + tbChGood.getSellGoodsNum + ",";
                str_Update += "SellGoodsTime='" + tbChGood.getSellGoodsTime + "',SellPrice=" + tbChGood.getSellPrice + ",";
                str_Update += "SellFalg=" + tbChGood.getSellFalg + "";
                str_Update += " where  SellID= '" + tbChGood.getSellID + "'";

                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Update, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Beispiel #2
0
        public int SellGoodsAdd(getMaihuo tbChGood)
        {
            int intFalg = 0;

            try
            {
                string str_Add = "insert into SellGoods values( ";
                str_Add += "'" + tbChGood.getSellID + "','" + tbChGood.getKcID + "','" + tbChGood.getGoodsID + "',";
                str_Add += "'" + tbChGood.getEmpId + "','" + tbChGood.getGoodsName + "'," + tbChGood.getSellGoodsNum + ",";
                str_Add += "'" + tbChGood.getSellGoodsTime + "'," + tbChGood.getSellPrice + ",";
                str_Add += tbChGood.getSellFalg + ")";
                str_Add += "update  KcGoods set KcNum=KcNum-" + tbChGood.getSellGoodsNum + "where KcGoodsName='" + tbChGood.getGoodsName + "'";
                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Add, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Beispiel #3
0
        public int SellGoodsDelete(getMaihuo tbChGood)
        {
            int intFalg = 0;

            try
            {
                string str_Del = "update SellGoods set ";

                str_Del += "SellFalg=" + tbChGood.getSellFalg + "";
                str_Del += " where  SellID= '" + tbChGood.getSellID + "'";

                getSqlConnection getConnection = new getSqlConnection();
                conn    = getConnection.GetCon();
                cmd     = new SqlCommand(str_Del, conn);
                intFalg = cmd.ExecuteNonQuery();
                conn.Dispose();
                return(intFalg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return(intFalg);
            }
        }
Beispiel #4
0
        public void SellGoodsFind(object DataObject, int intFalg, getMaihuo SellGoods)
        {
            string strSecar = null;

            try
            {
                switch (intFalg)
                {
                case 1:
                    strSecar = "select * from SellGoods where GoodsName like  '%" + SellGoods.getGoodsName + "%'";
                    break;

                case 2:
                    strSecar = "select * from SellGoods where GoodsName like '%" + SellGoods.getEmpId + "%'";
                    break;
                }

                getSqlConnection getConnection = new getSqlConnection();
                conn = getConnection.GetCon();
                cmd  = new SqlCommand(strSecar, conn);
                int ii = 0;
                hs = cmd.ExecuteReader();
                while (hs.Read())
                {
                    ii++;
                }
                hs.Close();


                System.Windows.Forms.DataGridView dv = (DataGridView)DataObject;

                if (ii != 0)
                {
                    int i = 0;
                    dv.RowCount = ii;
                    hs          = cmd.ExecuteReader();
                    while (hs.Read())
                    {
                        dv[0, i].Value = hs[4].ToString();
                        dv[1, i].Value = hs[7].ToString();
                        dv[2, i].Value = hs[5].ToString();
                        dv[3, i].Value = hs[3].ToString();
                        i++;
                    }
                    hs.Close();
                }
                else
                {
                    if (dv.RowCount != 0)
                    {
                        int i = 0;
                        do
                        {
                            dv[0, i].Value = "";
                            dv[1, i].Value = "";
                            dv[2, i].Value = "";
                            dv[3, i].Value = "";
                            i++;
                        } while (i < dv.RowCount);
                    }
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
            }
        }