예제 #1
0
        private void lkbtnDeleteCheck_Click(object sender, System.EventArgs e)
        {
            int?num = null;

            foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdGroupBuyList.Rows)
            {
                System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)gridViewRow.FindControl("checkboxCol");
                if (checkBox.Checked)
                {
                    num = new int?(num.GetValueOrDefault());
                    int          groupBuyId = System.Convert.ToInt32(this.grdGroupBuyList.DataKeys[gridViewRow.RowIndex].Value, System.Globalization.CultureInfo.InvariantCulture);
                    GroupBuyInfo groupBuy   = PromoteHelper.GetGroupBuy(groupBuyId);
                    if (groupBuy.Status != GroupBuyStatus.UnderWay && groupBuy.Status != GroupBuyStatus.EndUntreated)
                    {
                        num = new int?(num.GetValueOrDefault() + 1);
                        PromoteHelper.DeleteGroupBuy(groupBuyId);
                    }
                }
            }
            if (num.HasValue)
            {
                this.BindGroupBuy();
                this.ShowMsg(string.Format("成功删除{0}条团购活动", num), true);
                return;
            }
            this.ShowMsg("请先选择需要删除的团购活动", false);
        }
예제 #2
0
        private void lkbtnDeleteCheck_Click(object sender, System.EventArgs e)
        {
            int num = 0;

            foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdGroupBuyList.Rows)
            {
                System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)gridViewRow.FindControl("checkboxCol");
                if (checkBox.Checked)
                {
                    num++;
                    int groupBuyId = System.Convert.ToInt32(this.grdGroupBuyList.DataKeys[gridViewRow.RowIndex].Value, System.Globalization.CultureInfo.InvariantCulture);
                    PromoteHelper.DeleteGroupBuy(groupBuyId);
                }
            }
            if (num != 0)
            {
                this.BindGroupBuy();
                this.ShowMsg(string.Format(System.Globalization.CultureInfo.InvariantCulture, "成功删除\"{0}\"条团购活动", new object[]
                {
                    num
                }), true);
                return;
            }
            this.ShowMsg("请先选择需要删除的团购活动", false);
        }
예제 #3
0
파일: GroupBuys.cs 프로젝트: tyriankid/WFX
        private void lkbtnDeleteCheck_Click(object sender, EventArgs e)
        {
            int?nullable = null;

            foreach (GridViewRow row in this.grdGroupBuyList.Rows)
            {
                CheckBox box = (CheckBox)row.FindControl("checkboxCol");
                if (box.Checked)
                {
                    nullable = new int?(nullable.GetValueOrDefault());
                    int          groupBuyId = Convert.ToInt32(this.grdGroupBuyList.DataKeys[row.RowIndex].Value, CultureInfo.InvariantCulture);
                    GroupBuyInfo groupBuy   = PromoteHelper.GetGroupBuy(groupBuyId);
                    if ((groupBuy.Status != GroupBuyStatus.UnderWay) && (groupBuy.Status != GroupBuyStatus.EndUntreated))
                    {
                        nullable = new int?(nullable.GetValueOrDefault() + 1);
                        PromoteHelper.DeleteGroupBuy(groupBuyId);
                    }
                }
            }
            if (nullable.HasValue)
            {
                this.BindGroupBuy();
                this.ShowMsg(string.Format("成功删除{0}条团购活动", nullable), true);
            }
            else
            {
                this.ShowMsg("请先选择需要删除的团购活动", false);
            }
        }
예제 #4
0
        private void grdGroupBuyList_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy((int)this.grdGroupBuyList.DataKeys[e.RowIndex].Value);

            if (groupBuy.Status == GroupBuyStatus.UnderWay || groupBuy.Status == GroupBuyStatus.EndUntreated)
            {
                this.ShowMsg("团购活动正在进行中或结束未处理,不允许删除", false);
                return;
            }
            if (PromoteHelper.DeleteGroupBuy((int)this.grdGroupBuyList.DataKeys[e.RowIndex].Value))
            {
                this.BindGroupBuy();
                this.ShowMsg("成功删除了选择的团购活动", true);
                return;
            }
            this.ShowMsg("删除失败", false);
        }
예제 #5
0
        private void grdGroupBuyList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy((int)grdGroupBuyList.DataKeys[e.RowIndex].Value);

            if ((groupBuy.Status == GroupBuyStatus.UnderWay) || (groupBuy.Status == GroupBuyStatus.EndUntreated))
            {
                ShowMsg("团购活动正在进行中或结束未处理,不允许删除", false);
            }
            else if (PromoteHelper.DeleteGroupBuy((int)grdGroupBuyList.DataKeys[e.RowIndex].Value))
            {
                BindGroupBuy();
                ShowMsg("成功删除了选择的团购活动", true);
            }
            else
            {
                ShowMsg("删除失败", false);
            }
        }
예제 #6
0
        private void lkbtnDeleteCheck_Click(object sender, EventArgs e)
        {
            int num2 = 0;

            foreach (GridViewRow row in this.grdGroupBuyList.Rows)
            {
                CheckBox box = (CheckBox)row.FindControl("checkboxCol");
                if (box.Checked)
                {
                    num2++;
                    PromoteHelper.DeleteGroupBuy(Convert.ToInt32(this.grdGroupBuyList.DataKeys[row.RowIndex].Value, CultureInfo.InvariantCulture));
                }
            }
            if (num2 != 0)
            {
                this.BindGroupBuy();
                this.ShowMsg(string.Format(CultureInfo.InvariantCulture, "成功删除\"{0}\"条团购活动", new object[] { num2 }), true);
            }
            else
            {
                this.ShowMsg("请先选择需要删除的团购活动", false);
            }
        }
예제 #7
0
        public void Delete(HttpContext context)
        {
            string text = context.Request["GroupBuyIds"];

            if (string.IsNullOrWhiteSpace(text))
            {
                throw new HidistroAshxException("错误的活动编号");
            }
            int[] array = (from d in text.Split(',')
                           select int.Parse(d)).ToArray();
            int num  = 0;
            int num2 = array.Count();

            int[] array2 = array;
            foreach (int groupBuyId in array2)
            {
                GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(groupBuyId);
                if ((groupBuy.Status == GroupBuyStatus.UnderWay && groupBuy.StartDate <= DateTime.Now && groupBuy.EndDate >= DateTime.Now) || groupBuy.Status == GroupBuyStatus.EndUntreated)
                {
                    if (num2 == 1)
                    {
                        throw new HidistroAshxException("团购活动正在进行中或结束未处理,不允许删除!");
                    }
                }
                else
                {
                    num++;
                    PromoteHelper.DeleteGroupBuy(groupBuyId);
                }
            }
            if (num > 0)
            {
                base.ReturnSuccessResult(context, $"成功删除{num}条团购活动!", 0, true);
                return;
            }
            throw new HidistroAshxException("选择的团购活动暂不可删除!");
        }