示例#1
0
    public static repertory Findname(string name)
    {
        string          sql;
        OleDbConnection conn = new OleDbConnection(db.constring());

        sql = string.Format("select * from mtl_on_hand where sub_inventory='" + name + "'");
        OleDbCommand command = new OleDbCommand(sql, conn);

        conn.Open();
        OleDbDataReader dr = command.ExecuteReader();

        if (dr.Read() == false)
        {
            dr.Close();
            conn.Close();
            return(null);
        }
        else
        {
            repertory reper = new repertory();
            reper.name = name;
            reper.num  = dr[1].ToString();
            reper.qty  = dr[2].ToString();
            dr.Close();
            conn.Close();
            return(reper);
        }
    }
示例#2
0
    protected void btnaddpost_Click(object sender, EventArgs e)
    {
        string    mess;
        repertory reper = new repertory();

        reper.name = txbname.Text;
        reper.num  = txbnum.Text;
        reper.qty  = txbqty.Text;
        if (txbname.Text == "" || txbnum.Text == "" || txbqty.Text == "")
        {
            mess = "请将信息填写完整!!!";
            Response.Write(message.goBack(mess));
        }
        else
        {
            try
            {
                int.Parse(txbnum.Text);
                repertory findreper = new repertory();
                findreper = repertory.Findname(txbname.Text);
                if (findreper != null)
                {
                    mess = "库存名称已经存在!!!";
                    Response.Write(message.goBack(mess));
                }
                else
                {
                    if (repertory.FindUpnum(txbnum.Text))
                    {
                        if (repertory.Findnum(txbnum.Text) == false)
                        {
                            repertory.InsertRepertory(reper);
                            mess = "新库存添加成功!!!";
                            string url = "repertoryManage.aspx";
                            Response.Write(message.MessageAndUrl(mess, url));
                        }
                        else
                        {
                            mess = "该物品编号已经在看库存中!!!";
                            Response.Write(message.goBack(mess));
                        }
                    }
                    else
                    {
                        mess = "该编号的物品不存在不能入库!!!";
                        Response.Write(message.goBack(mess));
                    }
                }
            }
            catch
            {
                mess = "物品编号只能是数字!!!";
                Response.Write(message.goBack(mess));
            }
        }
    }
示例#3
0
    public static void UpdateRepertory(repertory reper)
    {
        string          sql;
        OleDbConnection conn = new OleDbConnection(db.constring());

        sql = string.Format("update  mtl_on_hand set item_num='" + reper.num + "',qty='" + reper.qty + "' where sub_inventory= '" + reper.name + "'");
        OleDbCommand command = new OleDbCommand(sql, conn);

        conn.Open();
        command.ExecuteNonQuery();
        conn.Close();
    }
示例#4
0
    public static void InsertRepertory(repertory reper)
    {
        string          sql;
        OleDbConnection conn = new OleDbConnection(db.constring());

        sql = string.Format("insert into mtl_on_hand(sub_inventory,item_num,qty)values('" + reper.name + "','" + reper.num + "','" + reper.qty + "')");
        OleDbCommand command = new OleDbCommand(sql, conn);

        conn.Open();
        command.ExecuteNonQuery();
        conn.Close();
    }
示例#5
0
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        txbname.Text = GridView1.SelectedDataKey.Values[0].ToString();
        repertory reper = new repertory();

        reper = repertory.Findname(txbname.Text);
        if (reper == null)
        {
            string mess = "选择数据出错!!";
            string url  = "repertoryManage.aspx";
            Response.Write(message.MessageAndUrl(mess, url));
        }
        else
        {
            txbnum.Text = reper.num;
            txbqty.Text = reper.qty;
        }
    }