public int CancelBothOrder(int orderId) { try { CusManageBusiness cmb = new CusManageBusiness(); var orderCheck = cmb.GetOrderDetail(orderId); if (orderCheck.CustomerUserId != Convert.ToInt32(Session["UserId"])) { return -2; } OrderBusiness ob = new OrderBusiness(); int userId = Convert.ToInt32(Session["UserId"]); if (orderCheck.OrderStatus != 0) { string dependencyCheckSql = string.Format("{0}{1}", "SELECT OrderId FROM dbo.[Orders] WHERE CustomerUserId = ", userId); MvcApplication.lowQuantityNotifer.Dispose(); MvcApplication.cancelOrderNotifier.Start("BMAChangeDB", dependencyCheckSql); MvcApplication.cancelOrderNotifier.Change += this.CancelOnChange; } ob.Cancel(orderId, 0, 0, userId); //MvcApplication.lowQuantityNotifer.Start("BMAChangeDB", "SELECT ProductMaterialId,CurrentQuantity,StandardQuantity FROM dbo.[ProductMaterial] WHERE (CurrentQuantity < StandardQuantity AND IsActive = 'True')"); //MvcApplication.lowQuantityNotifer.Change += this.OnChange2; return 1; } catch (DataException) { return -1; } }
public int Cancel(int orderId, int isReturnDeposit, int returnDeposit, string url) { try { // Check autherization User staffUser = Session["User"] as User; if (staffUser == null || Session["UserRole"] == null || (int)Session["UserRole"] != 2) { return -7; } OrderBusiness orderBusiness = new OrderBusiness(); bool rs = orderBusiness.Cancel(orderId, returnDeposit, isReturnDeposit, staffUser.UserId); return rs ? 1 : 0; } catch (Exception) { return 0; } }
public ActionResult CancelOrderConfirm(int orderId, string strURL) { try { CusManageBusiness cmb = new CusManageBusiness(); var orderCheck = cmb.GetOrderDetail(orderId); if (orderCheck.CustomerUserId != Convert.ToInt32(Session["UserId"])) { return RedirectToAction("Index", "Home"); } OrderBusiness ob = new OrderBusiness(); int userId = Convert.ToInt32(Session["UserId"]); if (orderCheck.OrderStatus != 0) { string dependencyCheckSql = string.Format("{0}{1}", "SELECT OrderId FROM dbo.[Orders] WHERE CustomerUserId = ", userId); MvcApplication.lowQuantityNotifer.Dispose(); MvcApplication.cancelOrderNotifier.Start("BMAChangeDB", dependencyCheckSql); MvcApplication.cancelOrderNotifier.Change += this.CancelOnChange; } ob.Cancel(orderId, 0, 0, userId); return Redirect(strURL); } catch (DataException) { return RedirectToAction("Index"); } }