public HttpResponseMessage Delete([FromBody] Models.receive receive, long updated_by) { try { long deletePayment = receiveRepository.DeleteReceive(receive.receive_id, updated_by); if (deletePayment == 1) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "warning", msg = "Sorry! You can not delete receivd amount that already received!" }, formatter)); } if (deletePayment == 2) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "success", msg = "Received Amount Deleted Successfully." }, formatter)); } else { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "success", msg = "Received Amount Deleted Successfully." }, formatter)); } } catch (Exception ex) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = ex.ToString() }, formatter)); } }
public HttpResponseMessage Post([FromBody] Models.receive receive) { try { if (string.IsNullOrEmpty(receive.receive_date.ToString())) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "warning", msg = "Please Select Receive Date" }, formatter)); } if (string.IsNullOrEmpty(receive.party_id.ToString())) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "warning", msg = "Please Select Channel Name" }, formatter)); } if (string.IsNullOrEmpty(receive.payment_method_id.ToString())) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "warning", msg = "Please Select Payment Method" }, formatter)); } if (receive.payment_method_id == 1 || receive.payment_method_id == 3) { if (string.IsNullOrEmpty(receive.bank_account_id.ToString())) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "warning", msg = "Please Enter Account Number" }, formatter)); } } if (receive.amount < 0) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "warning", msg = "Please Enter Amount Number" }, formatter)); } if (receive.amount < 0) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "warning", msg = "Please Enter Amount Number" }, formatter)); } //if (receive.payment_method_id == 3 && string.IsNullOrEmpty(receive.cheque_no)) //{ // var checkNoFormatter = RequestFormat.JsonFormaterString(); // return Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "warning", msg = "Please Insert Check Or Slip No" }, checkNoFormatter); //} if (receive.payment_method_id == 3 && receive.bank_id == null) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "warning", msg = "Please Select Bank Name" }, formatter)); } if (receive.payment_method_id == 3 && receive.bank_branch_id == null) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "warning", msg = "Please Select Bank Branch Name" }, formatter)); } if (string.IsNullOrEmpty(receive.amount.ToString())) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "warning", msg = "Please Insert Amount" }, formatter)); } else { receive insertPayment = new receive { receive_date = receive.receive_date, party_id = receive.party_id, payment_method_id = receive.payment_method_id, cheque_no = receive.cheque_no, bank_id = receive.bank_id, bank_branch_id = receive.bank_branch_id, last_invoice_balance = receive.last_invoice_balance, bank_account_id = receive.bank_account_id, amount = receive.amount, invoice_no = receive.invoice_no, representative = receive.representative, remarks = receive.remarks, payment_req_id = receive.payment_req_id, document_attachment = receive.document_attachment, bank_charge = receive.bank_charge, is_varified = receive.is_varified, created_date = DateTime.Now, created_by = receive.created_by, is_active = true, is_deleted = false }; /*receive table added by Kiron*/ receiveRepository.AddReceive(insertPayment); /* receive table added by Kiron*/ var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "success", msg = " Amount Received successfully" }, formatter)); } } catch (Exception ex) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = ex.ToString() }, formatter)); } }