コード例 #1
0
    /// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        TSOutInTypeBB noPassReasonBB = new TSOutInTypeBB();
        DataSet ds = new DataSet();

        try
        {
            string strWhere = this.StrWhere;

            strWhere = "1=1";

            ds = noPassReasonBB.GetList(strWhere);
            this.grid.DataSource = ds.Tables[0];
            this.grid.DataBind();

            //赋值记录条数、页面总数
            this.Label3.Text = ds.Tables[0].Rows.Count.ToString();
            this.Label2.Text = this.grid.PageCount.ToString();
            this.currPage.Text = (this.grid.PageIndex + 1).ToString();
        }
        finally
        {
            noPassReasonBB.Dispose();
        }
    }
コード例 #2
0
    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDel_Click(object sender, EventArgs e)
    {
        bool retChecked = false;
        TSOutInTypeBB noPassReasonBB = new TSOutInTypeBB();
        try
        {
            //获取选中的数据Id
            foreach (GridViewRow gvrow in this.grid.Rows)
            {
                CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
                if (chkId.Checked == true)
                {
                    retChecked = true;
                    int id = int.Parse(chkId.ValidationGroup);
                    noPassReasonBB.DeleteRecord(id);
                }
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            noPassReasonBB.Dispose();
        }

        if (retChecked)
        {
            this.BindGrid();
        }
    }
コード例 #3
0
    /// <summary>
    /// 数据保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string strInfo = "";

        if (!this.ValidateData(out strInfo))
        {
            strInfo = strInfo.Replace("\"", "'").Replace("\n", "");
            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + strInfo + "');", true);
            return;
        }

        TSOutInTypeData model = new TSOutInTypeData();
        TSOutInTypeBB tsOutInTypeBB = new TSOutInTypeBB();

        try
        {
            if (this.State == "1")
            {
                this.SetModel(ref model);
                this.IdValue = tsOutInTypeBB.AddRecord(model);
            }
            else if (this.State == "2")
            {
                model = tsOutInTypeBB.GetModel(this.IdValue);
                this.SetModel(ref model);

                tsOutInTypeBB.ModifyRecord(model);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            tsOutInTypeBB.Dispose();
        }

        Response.Redirect("LTsOutInList.aspx?&itemno=" + this.itemNo + "&pTypeNo=main", false);
    }
コード例 #4
0
    /// <summary>
    /// 展示数据
    /// </summary>
    /// <param name="id">记录Id</param>
    private void ShowInfo(int id)
    {
        TSOutInTypeBB noPassReasonBB = new TSOutInTypeBB();
        TSOutInTypeData model = new TSOutInTypeData();
        try
        {
            model = noPassReasonBB.GetModel(id);
            this.tbOutInName.Text = model.outInTypeName;

            this.ddlCheckItem.SelectedValue = model.outInType;
        }
        finally
        {
            noPassReasonBB.Dispose();
        }
    }
コード例 #5
0
    //2015-09-30 添加 用于增加选择出库原因
    //2015-09-29 进行添加 增加有关于其他入库类型选择的功能
    /// <summary>
    /// 绑定特殊入库原因
    /// </summary>
    protected void BindReson()
    {
        string strWhere = "1=1 and outInType = '02'";
        DataSet ds = new DataSet();
        TSOutInTypeBB outinTypeBB = new TSOutInTypeBB();

        //物料
        if (this.tbTSReason.Text.Trim() != "")
        {
            strWhere += " and (outIntypeName like '%" + this.tbTSReason.Text.Replace("'", "''") + ")";
        }
        ds = outinTypeBB.GetList(strWhere);//获取所有的入库原因
        this.grvReason.DataSource = ds.Tables[0];
        this.grvReason.DataBind();

        //赋值记录条数、页面总数
        this.Label1.Text = ds.Tables[0].Rows.Count.ToString();
        this.Label4.Text = this.grvReason.PageCount.ToString();
        this.currPage.Text = (this.grvReason.PageIndex + 1).ToString();
    }