예제 #1
0
    /// <summary>
    /// 数据保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        LTagData model = new LTagData();
        LTagBB tagBB = new LTagBB();
        try
        {
            if (this.State == "1")
            {
                this.SetModel(ref model);
                model.isrtDt = DateTime.Now.ToString();
                model.isrtEmpId = this.currentUser.empId;
                this.IdValue = tagBB.AddRecord(model);
            }
            else if (this.State == "2")
            {
                model = tagBB.GetModel(this.IdValue);
                this.SetModel(ref model);
                model.updtDt = DateTime.Now.ToString();
                model.updtEmpId = this.currentUser.empId;
                tagBB.ModifyRecord(model);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            tagBB.Dispose();
        }

        Response.Redirect("LTagList.aspx?&itemno=" + this.itemNo + "&pTypeNo=main", false);
    }
예제 #2
0
    /// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        LTagBB tagBB = new LTagBB();
        DataSet ds = new DataSet();

        try
        {
            ds = tagBB.GetVList(this.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
        {
            tagBB.Dispose();
        }
    }
예제 #3
0
 /// <summary>
 /// 展示数据
 /// </summary>
 /// <param name="id">记录Id</param>
 private void ShowInfo(int id)
 {
     LTagBB tagBB = new LTagBB();
     vLTagData model = new vLTagData();
     try
     {
         model = tagBB.GetVModel(id);
         this.tagNm.Text = model.tagNm;
         this.material.Text = model.material;
         this.tagType.Text = model.tagType;
     }
     finally
     {
         tagBB.Dispose();
     }
 }
예제 #4
0
    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDel_Click(object sender, EventArgs e)
    {
        bool retChecked = false;
        LTagBB tagBB = new LTagBB();
        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);
                    tagBB.DeleteRecord(id);
                }
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            tagBB.Dispose();
        }

        if (retChecked)
        {
            this.BindGrid();
        }
    }