Beispiel #1
0
        public static long Add(DateTime valueDate, string referenceNumber, int costCenterId, GridView grid)
        {
            Collection <TransactionDetailModel> details = new Collection <TransactionDetailModel>();

            if (grid != null)
            {
                if (grid.Rows.Count > 0)
                {
                    foreach (GridViewRow row in grid.Rows)
                    {
                        TransactionDetailModel detail = new TransactionDetailModel();
                        detail.AccountCode        = row.Cells[0].Text;
                        detail.CashRepositoryName = row.Cells[2].Text;
                        detail.StatementReference = row.Cells[3].Text.Replace("&nbsp;", " ").Trim();
                        detail.Debit  = Conversion.TryCastDecimal(row.Cells[4].Text);
                        detail.Credit = Conversion.TryCastDecimal(row.Cells[5].Text);

                        details.Add(detail);
                    }
                }
            }


            long transactionMasterId = DatabaseLayer.Transactions.Transaction.Add(valueDate, SessionHelper.GetOfficeId(), SessionHelper.GetUserId(), SessionHelper.GetLogOnId(), costCenterId, referenceNumber, details);

            DatabaseLayer.Transactions.Verification.CallAutoVerification(transactionMasterId);
            return(transactionMasterId);
        }
Beispiel #2
0
        public ActionResult GetTransaction()
        {
            var results      = new List <TransactionModel>();
            var transactions = _db.Transaction.Where(c => c.Type == 2).ToList();

            foreach (var tran in transactions)
            {
                var result = new TransactionModel();
                result.Id = tran.Id;
                var details = _db.TransactionDetail.Where(c => c.TracsactionId == tran.Id).ToList();
                result.Details = new List <TransactionDetailModel>();
                foreach (var elm in details)
                {
                    var tranDetail = new TransactionDetailModel();
                    var product    = _db.Product.Find(elm.Barcode);
                    tranDetail.Amount   = elm.Amount ?? 0;
                    tranDetail.Barcode  = elm.Barcode;
                    tranDetail.Name     = product.Name;
                    tranDetail.Price    = product.Price ?? 0;
                    tranDetail.Quantity = elm.Quantity;
                    result.Details.Add(tranDetail);
                }
                results.Add(result);
            }
            return(Content(JsonConvert.SerializeObject(new { data = results })));
        }
Beispiel #3
0
 public IHttpActionResult Put(TransactionDetailModel entity)
 {
     return(TryResult(
                ResponseMessage(Request
                                .CreateResponse(HttpStatusCode.OK,
                                                _TransactionDetailCRUDService.Update(entity) &&
                                                _TransactionDetailCRUDService.Save()))));
 }
Beispiel #4
0
 public async Task <IActionResult> SearchAllTransaction([FromBody] TransactionDetailModel model)
 {
     try
     {
         List <TransactionReturnModel> response = await new TransactionManager().SearchAllTransactionDetails(model);
         return(Ok(response));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Beispiel #5
0
        public ActionResult IsUserApproved(int UserId, string Address)
        {
            var data = "Failed";
            TransactionDetailModel _TransactionDetailModel = new TransactionDetailModel();
            TransactionDetail      _TransactionDetail      = _TransactionDetailModel.GetList(" IsApproved,Amount ", " UserId = " + UserId + " and Address = '" + Address + "' and IsApproved <> 'F' and TransactionType = 'A'").FirstOrDefault();

            if (_TransactionDetail != null)
            {
                //data = new JavaScriptSerializer().Serialize(_ContractDetail);
                return(Json(_TransactionDetail, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(data, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #6
0
 public async Task <IActionResult> SearchTransactionwithPagination([FromBody] TransactionDetailModel model)
 {
     try
     {
         if (string.IsNullOrEmpty(model.pageno.ToString()) && string.IsNullOrEmpty(model.pagesize.ToString()))
         {
             string msg = "pageNo & pageSize should not be null or empty";
             return(BadRequest(msg));
         }
         var response = await new TransactionManager().SearchTransactionWithPagination(model);
         return(Ok(response));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Beispiel #7
0
 public async Task <IActionResult> GetTransaction([FromBody] TransactionDetailModel model)
 {
     try
     {
         if (string.IsNullOrEmpty(model.transactionRefNum))
         {
             string msg = "transactionRefNum should not be empty.";
             return(BadRequest(msg));
         }
         dynamic response = await new TransactionManager().GetTransactionDetails(model);
         return(Ok(response));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Beispiel #8
0
        public AddTransactionViewModel(IUnitOfWork unitOfWork)
        {
            TransactionModel.unitOfWork = unitOfWork;
            RatesModel.unitOfWork       = unitOfWork;
            _transaction             = new TransactionModel();
            _transaction.IsNewObject = true;
            _transactionDetail       = new TransactionDetailModel();
            _rates           = new RatesModel();
            _ratesCollection = RatesModel.GetAllData();

            #region Initialize Commands
            AddTransaction = new DelegatingCommand((o) => {
                TransactionModel.AddItem(_transaction);
                Transaction = new TransactionModel();
                Transaction.TransactionDetails = new ObservableCollection <TransactionDetailModel>();
                Transaction.IsNewObject        = true;
            });
            AddItemTransaction    = new DelegatingCommand((o) => ToolbarButtonMethod(new AddItemTransactionAction(this)));
            RemoveItemTransaction = new DelegatingCommand((o) => ToolbarButtonMethod(new RemoveItemTransactionAction(this)));
            #endregion
        }
        public async Task <IActionResult> Index(string patientId)
        {
            try
            {
                PatientViewModel model = new PatientViewModel();
                if (!string.IsNullOrEmpty(patientId))
                {
                    ExplorerRequestModel request = new ExplorerRequestModel();
                    request.PatientId = patientId;
                    model.PatientId   = patientId;

                    ExplorerService service = new ExplorerService();
                    var             data    = await service.GetAllPatientTrxns(configuration, request);

                    foreach (var d in data)
                    {
                        switch (d.TransactionType)
                        {
                        case Constants.TransactionType.CreatePatient:
                            model.Patient.TransactionId        = d.TransactionId;
                            model.Patient.TransactionTimestamp = d.TransactionTimestamp;
                            model.Patient.TransactionType      = d.TransactionType;
                            model.Patient.Events = new List <PatientModel>();
                            foreach (var e in d.Events)
                            {
                                var p = JsonConvert.DeserializeObject <ApiResponse>(e.ToString());
                                model.Patient.Events.Add(p.Patient);
                            }

                            model.PatientTrxns.Add(model.Patient);
                            break;

                        case Constants.TransactionType.ChangePatient:
                            TransactionDetailModel <PatientModel> patient = new TransactionDetailModel <PatientModel>();
                            patient.TransactionId        = d.TransactionId;
                            patient.TransactionTimestamp = d.TransactionTimestamp;
                            patient.TransactionType      = d.TransactionType;
                            patient.Events = new List <PatientModel>();
                            foreach (var e in d.Events)
                            {
                                var p = JsonConvert.DeserializeObject <ApiResponse>(e.ToString());
                                patient.Events.Add(p.Patient);
                            }

                            model.PatientTrxns.Add(patient);
                            break;

                        case Constants.TransactionType.Consult:
                            TransactionDetailModel <ConsultationModel> consult = new TransactionDetailModel <ConsultationModel>();
                            consult.TransactionId        = d.TransactionId;
                            consult.TransactionTimestamp = d.TransactionTimestamp;
                            consult.TransactionType      = d.TransactionType;
                            consult.Events = new List <ConsultationModel>();
                            foreach (var e in d.Events)
                            {
                                var p = JsonConvert.DeserializeObject <ApiResponse>(e.ToString());
                                consult.Events.Add(p.Consultation);
                            }

                            model.ConsultTrxns.Add(consult);
                            break;

                        case Constants.TransactionType.Prescription:
                            TransactionDetailModel <PrescriptionModel> prescript = new TransactionDetailModel <PrescriptionModel>();
                            prescript.TransactionId        = d.TransactionId;
                            prescript.TransactionTimestamp = d.TransactionTimestamp;
                            prescript.TransactionType      = d.TransactionType;
                            prescript.Events = new List <PrescriptionModel>();
                            foreach (var e in d.Events)
                            {
                                var p = JsonConvert.DeserializeObject <ApiResponse>(e.ToString());
                                prescript.Events.Add(p.Prescription);
                            }

                            model.PrescriptTrxns.Add(prescript);
                            break;

                        case Constants.TransactionType.CreateIssue:
                            TransactionDetailModel <IssueModel> issue = new TransactionDetailModel <IssueModel>();
                            issue.TransactionId        = d.TransactionId;
                            issue.TransactionTimestamp = d.TransactionTimestamp;
                            issue.TransactionType      = d.TransactionType;
                            issue.Events = new List <IssueModel>();
                            foreach (var e in d.Events)
                            {
                                var p = JsonConvert.DeserializeObject <ApiResponse>(e.ToString());
                                issue.Events.Add(p.Issue);
                            }

                            model.IssueTrxns.Add(issue);
                            break;

                        case Constants.TransactionType.CreateTest:
                            break;

                        case Constants.TransactionType.CreateTriage:
                            TransactionDetailModel <TriageModel> triage = new TransactionDetailModel <TriageModel>();
                            triage.TransactionId        = d.TransactionId;
                            triage.TransactionTimestamp = d.TransactionTimestamp;
                            triage.TransactionType      = d.TransactionType;
                            triage.Events = new List <TriageModel>();
                            foreach (var e in d.Events)
                            {
                                var p = JsonConvert.DeserializeObject <ApiResponse>(e.ToString());
                                triage.Events.Add(p.Triage);
                            }

                            model.TriageTrxns.Add(triage);
                            break;

                        case Constants.TransactionType.CreateProcedure:
                            break;
                        }
                    }
                }

                return(View(model));
            }
            catch (Exception ex)
            {
                ViewData["Message"] = "Could not get patient data. Please try again later.";
            }

            return(View());
        }