protected void Page_Load(object sender, EventArgs e)
    {
        objCell.UpdateCellEx();
        objCell.UpdateCell();
        if (!IsPostBack)
        {
            //
            pager.PageSize = pageSize;

            DataSet dsTemp = objHouse.QueryAllWarehouse();
            this.ddlWarehouse.DataSource     = dsTemp.Tables[0].DefaultView;
            this.ddlWarehouse.DataTextField  = "WH_NAME";
            this.ddlWarehouse.DataValueField = "WH_CODE";
            this.ddlWarehouse.DataBind();
            dsTemp = objArea.QueryAreaByWHCODE(this.ddlWarehouse.Items[0].Value);
            this.ddlArea.DataSource     = dsTemp.Tables[0].DefaultView;
            this.ddlArea.DataTextField  = "AREANAME";
            this.ddlArea.DataValueField = "AREACODE";
            this.ddlArea.DataBind();
            //
            filter = string.Format("CURRENTPRODUCT IS NOT NULL AND CURRENTPRODUCT<>'' AND  WH_CODE='{0}' and AREACODE='{1}'", this.ddlWarehouse.SelectedValue, this.ddlArea.SelectedValue);
        }
        else
        {
            filter    = ViewState["filter"].ToString();
            pageIndex = Convert.ToInt32(ViewState["pageIndex"]);
        }
        GridDataBind();
    }
Exemple #2
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        string        whcode  = this.txtWhCode.Text;
        WarehouseArea objArea = new WarehouseArea();
        int           count   = objArea.QueryAreaByWHCODE(whcode).Tables[0].Rows.Count;

        if (count > 0)
        {
            JScript.Instance.ShowMessage(this, whcode + "还有下属库区,不能删除!");
            return;
        }
        else
        {
            objHouse.Delete(whcode);

            this.txtWHID.Text            = "";
            this.txtWhCode.Text          = objHouse.GetNewCode(this.ddlType.SelectedValue);
            this.txtWhName.Text          = "";
            this.txtShortName.Text       = "";
            this.txtDEFAULTUNIT.Text     = "";
            this.txtUNITNAME.Text        = "";
            this.ddlType.SelectedIndex   = 0;
            this.txtArea.Text            = "0";
            this.txtCapacity.Text        = "0";
            this.ddlActive.SelectedIndex = 0;
            this.txtMemo.Text            = "";
            this.txtWhCode.ReadOnly      = false;
            this.btnDelete.Enabled       = false;
            string path = whcode;
            JScript.Instance.RegisterScript(this, "RefreshParent('" + path + "');");
        }
    }
Exemple #3
0
 protected void dgHouse_DeleteCommand(object source, DataGridCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         string whcode = dsHouse.Tables[0].Rows[e.Item.ItemIndex]["WH_CODE"].ToString();
         int    count  = objArea.QueryAreaByWHCODE(whcode).Tables[0].Rows.Count;
         if (count > 0)
         {
             JScript.Instance.ShowMessage(this.UpdatePanel1, whcode + "还有下属库区,不能删除!");
             return;
         }
         else
         {
             objHouse.Delete(whcode);
             LoadHouseTree();
         }
     }
 }
    protected void GridDataBind()
    {
        BindWarehouse();
        if (this.hdnShelfCode.Value != "")
        {
            dsArea = objArea.QueryAreaByWHCODE(this.hdnWarehouseCode.Value);
            this.dgArea.DataSource = dsArea.Tables[0];
            this.dgArea.DataBind();

            dsShelf = objShelf.QueryShelfByAreaCode(this.hdnAreaCode.Value);
            this.dgShelf.DataSource = dsShelf.Tables[0].DefaultView;
            this.dgShelf.DataBind();

            dsCell            = objCell.QueryWarehouseCell("SHELFCODE='" + this.hdnShelfCode.Value + "'");
            dgCell.DataSource = dsCell.Tables[0].DefaultView;
            dgCell.DataBind();
        }

        if (this.hdnAreaCode.Value != "" && this.hdnShelfCode.Value == "")
        {
            dsArea = objArea.QueryAreaByWHCODE(this.hdnWarehouseCode.Value);
            this.dgArea.DataSource = dsArea.Tables[0];
            this.dgArea.DataBind();

            dsShelf = objShelf.QueryShelfByAreaCode(this.hdnAreaCode.Value);
            this.dgShelf.DataSource = dsShelf.Tables[0].DefaultView;
            this.dgShelf.DataBind();

            dsCell            = objCell.QueryWarehouseCell("AREACODE='" + this.hdnAreaCode.Value + "'");
            dgCell.DataSource = dsCell.Tables[0].DefaultView;
            dgCell.DataBind();
        }


        if (this.hdnWarehouseCode.Value != "" && this.hdnAreaCode.Value == "")
        {
            dsArea = objArea.QueryAreaByWHCODE(this.hdnWarehouseCode.Value);
            this.dgArea.DataSource = dsArea.Tables[0];
            this.dgArea.DataBind();

            dsShelf = objShelf.QueryShelfByWHCODE(this.hdnWarehouseCode.Value);
            this.dgShelf.DataSource = dsShelf.Tables[0].DefaultView;
            this.dgShelf.DataBind();

            dsCell            = objCell.QueryWarehouseCell("WH_CODE='" + this.hdnWarehouseCode.Value + "'");
            dgCell.DataSource = dsCell.Tables[0].DefaultView;
            dgCell.DataBind();
        }
    }