コード例 #1
0
ファイル: ItemList.aspx.cs プロジェクト: ZB347954263/RailExam
        protected void itemsGrid_DeleteCommand(object sender, GridItemEventArgs e)
        {
            ItemBLL itemBLL = new ItemBLL();

            itemBLL.DeleteItem(int.Parse(e.Item["ItemId"].ToString()));
            itemsGrid.DataBind();
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            hfChapterID.Value = Request.QueryString["id"];

            if (fvBookChapter.CurrentMode == FormViewMode.Insert)
            {
                if (hfInsert.Value == "-1")
                {
                    ((HiddenField)fvBookChapter.FindControl("hfParentID")).Value = Request.QueryString["ParentID"];
                    ((HiddenField)fvBookChapter.FindControl("hfBookID")).Value   = Request.QueryString["BookID"];
                }
                else
                {
                    ((HiddenField)fvBookChapter.FindControl("hfParentId")).Value = hfInsert.Value;
                    ((HiddenField)fvBookChapter.FindControl("hfBookID")).Value   = Request.QueryString["BookID"];
                }
                if (Request.QueryString["Mode"] == "Edit")
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "true";
                }
                else
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "false";
                }
            }
            else if (fvBookChapter.CurrentMode == FormViewMode.Edit)
            {
                if (Request.QueryString["Mode"] == "Edit")
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "true";
                }
                else
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "false";
                }
            }

            if (!IsPostBack)
            {
                BindGrid();
            }

            string strRefreshGrid = Request.Form.Get("RefreshGrid");

            if (strRefreshGrid != null & strRefreshGrid != "")
            {
                fvBookChapter.DataBind();
                BindGrid();
            }

            string strRefresh = Request.Form.Get("Refresh");

            if (strRefresh != null & strRefresh != "")
            {
                ItemBLL objItemBll = new ItemBLL();
                objItemBll.DeleteItem(Convert.ToInt32(strRefresh));
                BindGrid();
            }
        }
コード例 #3
0
ファイル: ItemList.aspx.cs プロジェクト: ZB347954263/RailExam
        public static int DeleteItem(string itemIds)
        {
            int nAffectedRecord = 0;

            if (!string.IsNullOrEmpty(itemIds))
            {
                string[] strIds = itemIds.Split('|');
                int[]    nIds   = new int[strIds.Length];

                for (int i = 0; i < nIds.Length; i++)
                {
                    nIds[i] = int.Parse(strIds[i]);
                }

                ItemBLL itemBLL = new ItemBLL();
                nAffectedRecord = itemBLL.DeleteItem(nIds);
            }

            return(nAffectedRecord);
        }