Exemplo n.º 1
0
        public static object ApiOrdersRemove(IRequest context)
        {
            if (context.IsUserLoggin)
            {
                var orderId = context.GetPostInt("orderId");
                OrderDao.Delete(orderId);
            }

            return(new { });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Obsługa przycisku usuwania
        /// </summary>
        /// <param name="sender">Obiekt wywołujący zdarzenie</param>
        /// <param name="e">Obiekt zawierający parametry zdarzenia</param>
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            long           id      = (long)(sender as Button).Tag;
            OrderModel     model   = OrderDao.LoadById(id);
            WarehouseModel product = WarehouseDao.LoadById(model.ProductId);

            product.Amount += model.Amount; // Przywrócenie produktu do magazynu
            WarehouseDao.Update(product);
            OrderDao.Delete(id);

            RefreshGrid();
        }
Exemplo n.º 3
0
 /// <summary>
 /// 删除订单
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DeleteButton_Click(object sender, EventArgs e)
 {
     //获取是否可用并删除
     if (dataGridView.CurrentRow != null)
     {
         int    index    = dataGridView.CurrentRow.Index;
         string order_id = (string)dataGridView.Rows[index].Cells["order_id"].Value;
         orderDao.Delete(new { order_id = order_id });
         this.DataRefresh();
     }
     else
     {
         MessageBox.Show("尚未选择数据");
     }
 }
Exemplo n.º 4
0
        public ActionResult Delete(int id = 1)
        {
            var dao            = new OrderDao();
            var orderDetailDao = new OrderDetailDao();

            orderDetailDao.DeleteAllByOrderId(id);
            if (dao.Delete(id))
            {
                TempData["Success"] = "Xóa đơn hàng hoàn tất";
            }
            else
            {
                TempData["Error"] = "Xóa đơn hàng thất bại";
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteReport(int id)
        {
            var orderDao       = new OrderDao();
            var orderDetailDao = new OrderDetailDao();
            var userID         = (UserLogin)Session[Common.CommonConstants.USER_SESSION];
            var userM          = new UserDao();
            var moneyCur       = userM.ViewDetail(userID.UserID);
            var money          = orderDao.ViewDetail(id);
            var a = (moneyCur.Money + money.Price);

            if (orderDao.ViewDetail(id).Status == 0)
            {
                var checkView = new ProductDao().DownViewCount(id);
                orderDetailDao.Delete(id);
                orderDao.Delete(id);
                var userMon = new User();
                userMon.Money = a;
                userM.UpdateMoney(userMon.Money, userID.UserID);

                return(Json(new { isok = true, message = "Hoàn trả thành công." }));
            }
            return(Json(new { isok = false, message = "Hoàn trả thất bại." }));
        }
Exemplo n.º 6
0
        public ActionResult DeleteReportAdmin(int id)
        {
            var orderDao       = new OrderDao();
            var orderDetailDao = new OrderDetailDao();
            var userID         = (UserLogin)Session[Common.CommonConstants.USER_SESSION];
            var userM          = new UserDao();

            // 0: Dang xu ly
            // 1: Dang van chuyen
            // 2: Da hoan thanh
            // 3: Da hoan tra
            if (orderDao.ViewDetail(id).Status == 1)
            {
                var checkView = new ProductDao().DownViewCount(id);
                orderDetailDao.Delete(id);
                orderDao.Delete(id);
                return(Json(new { isok = true, message = "Xóa thành công." }));
            }
            else if (orderDao.ViewDetail(id).Status == 0)
            {
                return(Json(new { isok = false, message = "Không thể xóa đơn hàng đang xử lý." }));
            }
            return(Json(new { isok = false, message = "Xóa thất bại." }));
        }
Exemplo n.º 7
0
        public void Page_Load(object sender, EventArgs e)
        {
            var request = SiteServer.Plugin.Context.GetCurrentRequest();

            _siteId     = request.GetQueryInt("siteId");
            _deliveryId = request.GetQueryInt("deliveryId");
            _areaId     = request.GetQueryInt("areaId");

            if (!request.AdminPermissions.HasSitePermissions(_siteId, Main.PluginId))
            {
                Response.Write("<h1>未授权访问</h1>");
                Response.End();
                return;
            }

            if (!string.IsNullOrEmpty(Request.QueryString["delete"]) &&
                !string.IsNullOrEmpty(Request.QueryString["idCollection"]))
            {
                var array = Request.QueryString["idCollection"].Split(',');
                var list  = array.Select(s => Utils.ParseInt(s)).ToList();
                OrderDao.Delete(list);
                LtlMessage.Text = Utils.GetMessageHtml("删除成功!", true);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["addArea"]))
            {
                var areaInfo = new AreaInfo
                {
                    DeliveryId = _deliveryId
                };
                areaInfo.Id = AreaDao.Insert(areaInfo);
                Response.Redirect($@"{GetRedirectUrl(_siteId, _deliveryId)}");
                return;
            }
            if (!string.IsNullOrEmpty(Request.QueryString["removeArea"]))
            {
                AreaDao.Delete(_areaId);
                Response.Redirect($@"{GetRedirectUrl(_siteId, _deliveryId)}");
                return;
            }
            if (!string.IsNullOrEmpty(Request.QueryString["saveCities"]))
            {
                var areaInfo = AreaDao.GetAreaInfo(_areaId);
                areaInfo.Cities = Request.QueryString["selectedCities"];
                AreaDao.Update(areaInfo);
                Response.Redirect($@"{GetRedirectUrl(_siteId, _deliveryId)}");
                return;
            }

            if (IsPostBack)
            {
                return;
            }

            var deliveryInfo = DeliveryDao.GetDeliveryInfo(_deliveryId);

            TbDeliveryName.Text = deliveryInfo.DeliveryName;
            Utils.SelectListItems(DdlDeliveryType, deliveryInfo.DeliveryType);
            TbStartStandards.Text = deliveryInfo.StartStandards.ToString();
            TbStartFees.Text      = deliveryInfo.StartFees.ToString("N2");
            TbAddStandards.Text   = deliveryInfo.AddStandards.ToString();
            TbAddFees.Text        = deliveryInfo.AddFees.ToString("N2");

            RptAreas.DataSource     = AreaDao.GetAreaInfoList(_deliveryId);
            RptAreas.ItemDataBound += RptAreas_ItemDataBound;
            RptAreas.DataBind();

            BtnAreaAdd.Attributes.Add("onclick", $@"location.href = '{GetRedirectUrl(_siteId, _deliveryId)}&addArea={true}';return false;");

            if (!string.IsNullOrEmpty(Request.QueryString["areas"]) && !string.IsNullOrEmpty(Request.QueryString["areaId"]))
            {
                PhModalAreas.Visible = true;
                BtnAreas.Attributes.Add("onclick", $"location.href='{GetRedirectUrl(_siteId, _deliveryId)}&saveCities={true}&areaId={_areaId}&selectedCities=' + selectedCities.join(',');return false;");
            }
        }
Exemplo n.º 8
0
        public void Page_Load(object sender, EventArgs e)
        {
            var request = SiteServer.Plugin.Context.GetCurrentRequest();

            _siteId  = request.GetQueryInt("siteId");
            _isPaied = request.GetQueryBool("isPaied");
            _state   = request.GetQueryString("state");
            _keyword = request.GetQueryString("keyword");

            if (!request.AdminPermissions.HasSitePermissions(_siteId, Main.PluginId))
            {
                Response.Write("<h1>未授权访问</h1>");
                Response.End();
                return;
            }

            if (!string.IsNullOrEmpty(Request.QueryString["delete"]) &&
                !string.IsNullOrEmpty(Request.QueryString["idCollection"]))
            {
                var array = Request.QueryString["idCollection"].Split(',');
                var list  = array.Select(s => Utils.ParseInt(s)).ToList();
                OrderDao.Delete(list);
                LtlMessage.Text = Utils.GetMessageHtml("删除成功!", true);
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = 30;
            SpContents.SelectCommand     = OrderDao.GetSelectStringBySearch(_siteId, _isPaied, _state, _keyword);
            SpContents.SortField         = nameof(OrderInfo.Id);
            SpContents.SortMode          = "DESC";
            RptContents.ItemDataBound   += RptContents_ItemDataBound;

            if (IsPostBack)
            {
                return;
            }

            LtlPageTitle.Text = Utils.GetStateText(_isPaied, _state) + "订单管理";

            DdlSearchState.Items.Add(new ListItem(Utils.GetStateText(false, string.Empty), $"{false}_"));
            DdlSearchState.Items.Add(new ListItem(Utils.GetStateText(true, string.Empty), $"{true}_"));
            DdlSearchState.Items.Add(new ListItem(Utils.GetStateText(true, nameof(OrderState.Done)), $"{true}_{nameof(OrderState.Done)}"));
            Utils.SelectListItems(DdlSearchState, $"{_isPaied}_{_state}");
            TbSearchKeyword.Text = _keyword;

            SpContents.DataBind();

            BtnDelete.Attributes.Add("onclick", Utils.ReplaceNewline($@"
var ids = [];
$(""input[name='idCollection']:checked"").each(function () {{
    ids.push($(this).val());}}
);
if (ids.length > 0){{
    {Utils.SwalWarning("删除订单", "此操作将删除所选订单,确定吗?", "取 消", "删 除",
                $"location.href='{GetRedirectUrl(_siteId, _isPaied, _state, _keyword)}&delete={true}&idCollection=' + ids.join(',')")}
}} else {{
    {Utils.SwalError("请选择需要删除的订单!", string.Empty)}
}}
;return false;", string.Empty));

            BtnStateAll.Attributes.Add("onclick", Utils.ReplaceNewline($@"
var ids = [];
$(""input[name='idCollection']:checked"").each(function () {{
    ids.push($(this).val());}}
);
if (ids.length > 0){{
    location.href = '{GetRedirectUrl(_siteId, _isPaied, _state, _keyword)}&state={true}&idCollection=' + ids.join(',')
}} else {{
    {Utils.SwalError("请选择需要更改状态的订单!", string.Empty)}
}}
;return false;", string.Empty));

            if (!string.IsNullOrEmpty(Request.QueryString["view"]))
            {
                PhModalView.Visible = true;

                var id = Utils.ParseInt(Request.QueryString["id"]);

                var orderInfo = OrderDao.GetOrderInfo(id);
                if (!string.IsNullOrEmpty(orderInfo.Message))
                {
                    LtlModalViewMessage.Text = Utils.GetMessageHtml(orderInfo.Message);
                }

                LtlGuid.Text     = orderInfo.Guid;
                LtlRealName.Text = orderInfo.RealName;
                LtlMobile.Text   = orderInfo.Mobile;
                LtlTel.Text      = orderInfo.Tel;
                LtlLocation.Text = orderInfo.Location;
                LtlAddress.Text  = orderInfo.Address;
                LtlZipCode.Text  = orderInfo.ZipCode;
                LtlChannel.Text  = Utils.GetChannelText(orderInfo.Channel);
                LtlAmount.Text   =
                    $@"商品金额:¥{orderInfo.TotalFee:N2}元 运费:¥{orderInfo.ExpressCost:N2}元 合计:¥{orderInfo.TotalFee +
	                                                                                       orderInfo.ExpressCost:N2}元"    ;
                LtlAddDate.Text = orderInfo.AddDate.ToString("yyyy-MM-dd HH:mm:ss");
                LtlState.Text   = Utils.GetStateText(orderInfo.IsPaied, orderInfo.State);

                RptCarts.DataSource     = CartDao.GetCartInfoList(orderInfo.Id);
                RptCarts.ItemDataBound += RptCarts_ItemDataBound;
                RptCarts.DataBind();

                BtnState.Attributes.Add("onclick", Utils.ReplaceNewline($@"
location.href = '{GetRedirectUrl(_siteId, _isPaied, _state, _keyword)}&setState={true}&idCollection={id}';
return false;", string.Empty));
            }
            else if (!string.IsNullOrEmpty(Request.QueryString["setState"]) &&
                     !string.IsNullOrEmpty(Request.QueryString["idCollection"]))
            {
                PhModalState.Visible = true;
                DdlState.Items.Add(new ListItem(Utils.GetStateText(false, string.Empty), $"{false}_"));
                DdlState.Items.Add(new ListItem(Utils.GetStateText(true, string.Empty), $"{true}_"));
                DdlState.Items.Add(new ListItem(Utils.GetStateText(true, nameof(OrderState.Done)),
                                                $"{true}_{nameof(OrderState.Done)}"));
            }
        }
Exemplo n.º 9
0
 public bool Delete(int id)
 {
     return(OrderDao.Delete(id));
 }
Exemplo n.º 10
0
 public Boolean DeleteOrder(int _Id)
 {
     return(OrderDao.Delete(_Id));
 }