Esempio n. 1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RemoveData(object sender, CommandEventArgs e)
        {
            if (!string.IsNullOrEmpty(e.CommandArgument.ToString()))
            {
                DataTable dt = _AreaBLL.SelectSystemAreaForCity(e.CommandArgument.ToString());

                SystemArea _SystemArea = new SystemArea();
                _SystemArea.GA03001 = e.CommandArgument.ToString();
                _SystemArea.GA03997 = 1;
                int num = Math.Abs(_AreaBLL.RemoveSystemArea(_SystemArea));
                new Sinoo.Common.MessageShow().RemoveMessage(this, num, "");

                if (num < 1)
                {
                    return;
                }

                int CurrentPageIndex = this.AspNetPager1.CurrentPageIndex; //当前页
                int PageCount        = this.AspNetPager1.PageCount;        //页总数
                int RecordCount      = this.AspNetPager1.RecordCount;      //记录数
                int PageSize         = this.AspNetPager1.PageSize;         //第页条数

                int PageIndex = CurrentPageIndex == PageCount ? (PageCount * PageSize - RecordCount == (PageSize - 1) ? CurrentPageIndex - 1 : CurrentPageIndex) : CurrentPageIndex;

                InitData(PageIndex);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RemoveData(object sender, CommandEventArgs e)
        {
            if (!string.IsNullOrEmpty(e.CommandArgument.ToString()))
            {
                DataTable dt = _AreaBLL.SelectSystemAreaForCity(e.CommandArgument.ToString());
                if (dt.Rows.Count > 0)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType()
                                                            , "message"
                                                            , "<script language='javascript' defer> "
                                                            + "alert('被删除省份存在关联的城市,请先删除城市后,再尝试删除该省份'); "
                                                            + " </script>");
                }
                else
                {
                    SystemArea _SystemArea = new SystemArea();
                    _SystemArea.GA03001 = e.CommandArgument.ToString();
                    _SystemArea.GA03997 = 1;
                    int num = Math.Abs(_AreaBLL.RemoveSystemArea(_SystemArea));
                    new Sinoo.Common.MessageShow().RemoveMessage(this, num, "");

                    if (num < 1)
                    {
                        return;
                    }

                    int CurrentPageIndex = this.AspNetPager1.CurrentPageIndex; //当前页
                    int PageCount        = this.AspNetPager1.PageCount;        //页总数
                    int RecordCount      = this.AspNetPager1.RecordCount;      //记录数
                    int PageSize         = this.AspNetPager1.PageSize;         //第页条数

                    int PageIndex = CurrentPageIndex == PageCount ? (PageCount * PageSize - RecordCount == (PageSize - 1) ? CurrentPageIndex - 1 : CurrentPageIndex) : CurrentPageIndex;

                    InitData(PageIndex);
                }
            }
        }