public void GUIDTest()
        {
            ProductCategory item0 = new ProductCategory()
            {
                ID = "ewoftogoeo", Name = "镀锌钢板", Memo = "厂家:正泰"
            };
            ProductCategoryBLL bll = new ProductCategoryBLL(StaticConnectString.ConnectString);
            CommandResult      ret = bll.Insert(item0);

            Assert.IsTrue(ret.Result == ResultCode.Successful);

            List <ProductCategory> items = bll.GetAll().QueryObjects;

            Assert.IsTrue(items.Count > 0);
            Assert.IsTrue(items.SingleOrDefault(item => item.ID == item0.ID) != null);

            item0.Name += "123";
            item0.Memo += "123";
            ret         = bll.Update(item0);
            Assert.IsTrue(ret.Result == ResultCode.Successful);
            ProductCategory item1 = bll.GetByID(item0.ID).QueryObject;

            Assert.IsTrue(item0.Name == item1.Name);
            Assert.IsTrue(item0.Memo == item1.Memo);

            ret = bll.Delete(item0);
            Assert.IsTrue(ret.Result == ResultCode.Successful);
            item1 = bll.GetByID(item0.ID).QueryObject;
            Assert.IsTrue(item1 == null);
        }
示例#2
0
    protected void btnDel_Click(object sender, EventArgs e)
    {
        int delcount = 0;

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            CheckBox chkSel = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("chkSelect");
            if (chkSel.Checked == true)
            {
                delcount++;
                pcBLL.Delete((int)GridView1.DataKeys[i].Value);
            }
        }
        if (delcount != 0)
        {
            this.ShowMessage(this.Getmessage("30014") + " 刪除數:" + delcount);
        }
        else
        {
            this.ShowMessage(this.Getmessage("30013") + " 請至少選擇一筆資料");
        }
        GridView1.DataBind();
    }
        protected override bool DeletingItem(object item)
        {
            ProductCategoryBLL bll = new ProductCategoryBLL(AppSettings.Current.ConnStr);
            CommandResult      ret = bll.Delete(item as ProductCategory);

            if (ret.Result == ResultCode.Successful)
            {
                return(true);
            }
            else
            {
                MessageBox.Show(ret.Message);
                return(false);
            }
        }