protected void btnDelete_Click(object sender, EventArgs e)
    {
        string         whcode   = this.txtWhCode.Text;
        string         areaCode = this.txtAreaCode.Text;
        int            areaid   = Convert.ToInt32(this.txtAreaID.Text);
        WarehouseShelf objShelf = new WarehouseShelf();
        int            count    = objShelf.QueryShelfByAreaCode(areaCode).Tables[0].Rows.Count;

        if (count > 0)
        {
            JScript.Instance.ShowMessage(this, areaCode + "库区还有下属货架,不能删除!");
            return;
        }
        else
        {
            objArea.Delete(areaid);
            this.txtAreaID.Text          = "";
            this.txtAreaCode.Text        = objArea.GetNewAreaCode(this.txtWhCode.Text);
            this.txtAreaName.Text        = "";
            this.txtShortName.Text       = "";
            this.ddlActive.SelectedIndex = 0;
            this.txtAreaType.Text        = "";
            this.txtMemo.Text            = "";
            this.txtAreaCode.ReadOnly    = false;
            this.btnDelete.Enabled       = false;
            //JScript.Instance.ShowMessage(this, "库区删除成功!");
            string path = whcode + "/" + areaCode;
            JScript.Instance.RegisterScript(this, "RefreshParent('" + path + "');");
        }
    }
Exemple #2
0
    protected void dgArea_DeleteCommand(object source, DataGridCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
            string whcode   = dsArea.Tables[0].Rows[e.Item.ItemIndex]["WH_CODE"].ToString();
            string areaCode = dsArea.Tables[0].Rows[e.Item.ItemIndex]["AREACODE"].ToString();
            int    areaid   = Convert.ToInt32(dsArea.Tables[0].Rows[e.Item.ItemIndex]["AREA_ID"].ToString());
            int    count    = objShelf.QueryShelfByAreaCode(areaCode).Tables[0].Rows.Count;
            if (count > 0)
            {
                JScript.Instance.ShowMessage(this.UpdatePanel1, areaCode + "库区还有下属货架,不能删除!");
                return;
            }
            else
            {
                objArea.Delete(areaid);

                TreeNode nodeArea = tvWarehouse.FindNode(whcode + "/" + areaCode);
                if (nodeArea != null)
                {
                    nodeArea.Parent.ChildNodes.Remove(nodeArea);
                }
                //LoadHouseTree();
            }
        }
    }