Exemplo n.º 1
0
    //删除区间
    protected void Button2_Command(object sender, CommandEventArgs e)
    {
        int regionId = Convert.ToInt32(e.CommandArgument);

        bool success = false;

        using (TransactionScope ts = new TransactionScope())
        {
            DataTable lists = item_bll.GetItemListByRegionId(userId, regionId);
            foreach (DataRow dr in lists.Rows)
            {
                int itemId    = Convert.ToInt32(dr["ItemID"]);
                int itemAppId = Convert.ToInt32(dr["ItemAppID"]);

                success = item_bll.DeleteItem(userId, itemId, itemAppId);
                if (!success)
                {
                    break;
                }
            }

            ts.Complete();
        }

        if (success)
        {
            Utility.Alert(this, "删除成功。", "QuJianTongJi.aspx");
        }
        else
        {
            Utility.Alert(this, "删除失败!");
        }
    }
Exemplo n.º 2
0
    //删除操作
    protected void ItemGrid_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int itemId    = Convert.ToInt32(this.ItemGrid.DataKeys[e.RowIndex].Value);
        int regionId  = Convert.ToInt32(((HiddenField)this.ItemGrid.Rows[e.RowIndex].FindControl("RegionIDHid")).Value);
        int itemAppId = Convert.ToInt32(((HiddenField)this.ItemGrid.Rows[e.RowIndex].FindControl("ItemAppIDHid")).Value);

        bool success = false;

        using (TransactionScope ts = new TransactionScope())
        {
            if (regionId > 0)
            {
                DataTable items = bll.GetItemListByRegionId(userId, regionId);
                foreach (DataRow dr in items.Rows)
                {
                    itemId    = Convert.ToInt32(dr["ItemID"]);
                    itemAppId = Convert.ToInt32(dr["ItemAppID"]);

                    success = bll.DeleteItem(userId, itemId, itemAppId);
                }
            }
            else
            {
                success = bll.DeleteItem(userId, itemId, itemAppId);
            }

            ts.Complete();
        }

        if (success)
        {
            this.ItemGrid.EditIndex = -1;
            BindItemGrid();
        }
        else
        {
            //Utility.Alert(this, "删除失败!");
        }
    }
Exemplo n.º 3
0
    //删除操作
    protected void List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int itemId    = Convert.ToInt32(List.DataKeys[e.RowIndex].Value);
        int itemAppId = Convert.ToInt32(((HiddenField)List.Rows[e.RowIndex].FindControl("ItemAppIDHid")).Value);

        bool success = item_bll.DeleteItem(userId, itemId, itemAppId);

        if (success)
        {
            List.EditIndex = -1;
            BindGrid();
        }
        else
        {
            Utility.Alert(this, "删除失败!");
            return;
        }
    }
Exemplo n.º 4
0
    //删除操作
    protected void List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int    ztId         = Convert.ToInt32(List.DataKeys[e.RowIndex].Value);
        string zhuanTiImage = ((HiddenField)List.Rows[e.RowIndex].FindControl("ZhuanTiImageHid")).Value;

        ZhuanTiInfo zhuanTi = bll.GetZhuanTiByZhuanTiId(userId, ztId);

        zhuanTi.ZhuanTiLive = 0;
        zhuanTi.Synchronize = 1;
        zhuanTi.ModifyDate  = DateTime.Now;

        using (TransactionScope ts = new TransactionScope())
        {
            bool success = false;

            DataTable lists = item_bll.GetItemListAllByZhuanTiId(userId, ztId);
            if (lists.Rows.Count > 0)
            {
                foreach (DataRow dr in lists.Rows)
                {
                    int itemId    = Convert.ToInt32(dr["ItemID"]);
                    int itemAppId = Convert.ToInt32(dr["ItemAppID"]);

                    success = item_bll.DeleteItem(userId, itemId, itemAppId);
                    if (!success)
                    {
                        break;
                    }
                }
            }
            else
            {
                success = true;
            }

            if (success)
            {
                success = bll.UpdateZhuanTi(zhuanTi);
            }
            else
            {
                Utility.Alert(this, "消费删除失败!");
                return;
            }

            if (success)
            {
                Utility.Alert(this, "删除成功。");

                List.EditIndex = -1;
                BindGrid();
            }
            else
            {
                Utility.Alert(this, "专题删除失败!");
            }

            ts.Complete();
        }

        //删除专题图片
        if (ImageHelper.CanDelete(zhuanTiImage))
        {
            try
            {
                ImageHelper.DeleteZhuanTiImage(zhuanTiImage);
            }
            catch { }
        }
    }