Example #1
0
        public ActionResult <IDataPacker> DeleteSalesOrderByKey(IDataUnpacker unpacker)
        {
            var packer      = new DataPacker();
            var modelName   = unpacker.GetValue <string>("arm1");
            var saleOrderId = unpacker.GetValue <int>("arm2");
            var status      = "Success";

            try
            {
                switch (modelName)
                {
                case "SaleOrder":
                    status = _saleService.DeleteSalesOrder(saleOrderId);
                    break;

                case "OrderDetail":
                    var saleDetailId = unpacker.GetValue <int>("arm3");
                    status = _saleService.Delete("d_order_detail_list", true,
                                                 "SalesOrderDetailID = " + saleDetailId.ToString(), saleOrderId);
                    break;
                }
            }
            catch (Exception e)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
            }

            packer.AddValue("Status", status);

            return(packer);
        }
        public ActionResult <IDataPacker> DeleteSalesOrderByKey(IDataUnpacker unpacker)
        {
            var packer      = new DataPacker();
            var modelName   = unpacker.GetValue <string>("arm1");
            var saleOrderId = unpacker.GetValue <int>("arm2");
            var status      = "Success";

            try
            {
                switch (modelName)
                {
                case "SaleOrder":
                    status = _saleService.DeleteSalesOrder(saleOrderId);
                    break;

                case "OrderDetail":
                    var saleDetailId = unpacker.GetValue <int>("arm3");
                    status = _saleService.Delete <SalesOrderDetail>(true,
                                                                    m => m.SalesOrderDetailID == saleDetailId, saleOrderId);
                    break;
                }
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }

            packer.AddValue("Status", status);

            return(packer);
        }
Example #3
0
        protected virtual void btnDelete_Click(object sender, EventArgs e)
        {
            ISalesOrderService svcSalesOrder = DI.Resolve <ISalesOrderService>();

            try
            {
                using (TimeTracker.ServiceCall)
                    svcSalesOrder.Delete((int)obj.SalesOrderIdProperty.TransportValue);
                obj.SetModified(false, true);
                OnDeleted(EventArgs.Empty);
                Hide();
            }
            catch (Exception ex)
            {
                errors.List.DataSource = ErrorList.FromException(ex).Errors;
                errors.List.DataBind();
            }
            if (svcSalesOrder is IDisposable)
            {
                ((IDisposable)svcSalesOrder).Dispose();
            }
        }
Example #4
0
        public ActionResult Delete([FromRoute] int _salesOrderId)
        {
            ActionResult response = null;

            try
            {
                if (ModelState.IsValid)
                {
                    Output output = svc.Delete(_salesOrderId);
                    response = StatusCode((int)output.HttpStatus, output);
                    return(response);
                }
                else
                {
                    ModelValidation.AddModelErrors(currentErrors, ModelState);
                }
            }
            catch (Exception ex)
            {
                currentErrors.MergeWith(errorsParser.FromException(ex));
            }
            response = StatusCode((int)currentErrors.HttpStatus, new Output(currentErrors));
            return(response);
        }
Example #5
0
 public ActionResult Delete(int saleOrderId)
 {
     service.Delete(saleOrderId);
     return(RedirectToAction("Index"));
 }
Example #6
0
 public void Delete(int id)
 {
     _salesorderService.Delete(id);
 }