コード例 #1
0
        /// <summary>
        /// Delete InvoiceDetail by Id
        /// </summary>
        /// <param name="id">ID of InvoiceDetail</param>
        /// <returns></returns>
        public ApiResponseViewModel Delete(int id)
        {
            var result   = new InvoiceDetail();
            var response = new ApiResponseViewModel
            {
                Code    = CommonConstants.ApiResponseSuccessCode,
                Message = null,
                Result  = null
            };

            try
            {
                var exists = _InvoiceDetailRepository.CheckContains(m => m.ID == id);
                if (exists)
                {
                    result = _InvoiceDetailRepository.Delete(id);
                    _unitOfWork.Commit();
                    response.Message = CommonConstants.DeleteSuccess;
                    response.Result  = result;
                }
                else
                {
                    response.Code    = CommonConstants.ApiResponseNotFoundCode;
                    response.Message = CommonConstants.NotFoundMessage;
                }
            }
            catch (Exception ex)
            {
                response.Code    = CommonConstants.ApiResponseExceptionCode;
                response.Message = CommonConstants.ErrorMessage + " " + ex.Message;
            }
            return(response);
        }
コード例 #2
0
        private void dataGridView1_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            //Get Item
            if (pItemsBindingSource.DataSource == null)
            {
                e.Cancel = true;
            }
            if (dataGridView1.CurrentRow == null)
            {
                e.Cancel = true;
            }

            DataGridViewRow row  = dataGridView1.CurrentRow;
            InvoiceDetail   item = row.DataBoundItem as InvoiceDetail;

            //Confirm Delete
            if (DialogHelper.DeleteDialog(item.itemCode) != 0)
            {
                if (item != null)
                {
                    if (isAddNew != true)
                    {
                        invoiceDetailRepository.Delete(item);
                    }
                    productBindingSource.Remove(item);
                }
            }
            else
            {
                e.Cancel = true;
            }
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            invoicedetailRepository.Delete(id);
            invoicedetailRepository.Save();

            return(RedirectToAction("Index"));
        }
コード例 #4
0
        public void Delete(Guid id)
        {
            var entity = invoiceDetailRepository.GetById(id);

            dataAccess.SubInvoiceTotalPrice(entity.InvoiceId.Value, entity.TotalPrice.Value);
            invoiceDetailRepository.Delete(entity);
            invoiceDetailRepository.SaveChanges();
        }
コード例 #5
0
ファイル: HomeController.cs プロジェクト: ElhamAbdelMged/test
        public IActionResult Delete(int Id)
        {
            var detailsList = _invoiceDetailRepository.GetByInvoiceHeaderID(Id);

            foreach (var item in detailsList)
            {
                _invoiceDetailRepository.Delete(item.ID);
            }
            _invoiceHeaderRepository.Delete(Id);


            return(View("Index"));
        }
コード例 #6
0
        public void RemoveTest()
        {
            var getInvoice = invoice.GetInvoiceByNomor("9000");
            var detail     = getInvoice.detail.First(s => s.invoiceID == getInvoice.invoiceID);

            var result = invoiceDetail.Delete(detail);

            Assert.IsTrue(result != 0);

            var result2 = invoice.Delete(getInvoice);

            Assert.IsTrue(result != 0);
        }
コード例 #7
0
        public IActionResult Delete(int ID)
        {
            string note   = AppGlobal.InitString;
            int    result = _invoiceDetailResposistory.Delete(ID);

            if (result > 0)
            {
                note = AppGlobal.Success + " - " + AppGlobal.DeleteSuccess;
            }
            else
            {
                note = AppGlobal.Success + " - " + AppGlobal.DeleteFail;
            }
            return(Json(note));
        }
コード例 #8
0
        public ActionResult <string> Delete(int ID)
        {
            Result routeResult;

            int result = _invoiceDetailResposistory.Delete(ID);

            if (result > 0)
            {
                routeResult = new Result()
                              .setResultType(ResultType.Success)
                              .setMessage(AppGlobal.DeleteSuccess);
            }
            else
            {
                routeResult = new Result()
                              .setResultType(ResultType.Error)
                              .setErrorType(ErrorType.DeleteError)
                              .setMessage(AppGlobal.DeleteFail);
            }
            return(ObjectToJson(routeResult));
        }
コード例 #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="objInvoiceDetail"></param>
 public void DeleteInvoiceDetail(InvoiceDetail objInvoiceDetail)
 {
     _roleRepository.Delete(objInvoiceDetail);
     _unitOfWork.Commit();
 }