public virtual JsonResult CheckandGetOrderJson(Hl7JsonloadViewModel hl7Jsonload) { var data = ViewBag.UserData; var orderFormPost = new LabQueryModel { OrderId = hl7Jsonload.OrderId, UserRole = data.Role != "Maker" ? (data.Role == "Checker" ? Checker : SuperAdmin) : Maker, Email = data.Email }; var getJson = _getPayerResponse.CheckUserDataExist(orderFormPost); return(Json(new { Success = true, OrderFormData = getJson })); }
public virtual JsonResult PostHl7OrderForm(HL7EntryFormViewModel orderFormData) { var data = ViewBag.UserData; var orderFormPost = new LabQueryModel { Status = orderFormData.Status, Hl7Stream = orderFormData.HL7Stream, OrderId = orderFormData.OrderId, UserRole = data.Role != "Maker" ? (data.Role == "Checker" ? Checker : SuperAdmin) : Maker, EntryOption = orderFormData.EntryOption }; return(Json( _getPayerResponse.PostHl7OrderForm(orderFormPost) ? new { Success = true } : new { Success = false })); }
public bool PostHl7OrderForm(LabQueryModel queryModel) { var orderformEntity = new Entity("lab_orderscan"); orderformEntity["lab_orderscanid"] = new Guid(queryModel.OrderId); try { if (queryModel.EntryOption != null && (queryModel.Status != (int)Open || queryModel.UserRole != Maker || (int)queryModel.EntryOption.Value != 1)) { if (queryModel.Status == (int)Open && queryModel.UserRole == Maker && (int)queryModel.EntryOption.Value == 2) { orderformEntity["lab_json_maker"] = queryModel.Hl7Stream; orderformEntity["statuscode"] = new OptionSetValue((int)PendingforApproval); } } else { orderformEntity["lab_json_maker"] = queryModel.Hl7Stream; } if (queryModel.EntryOption != null && (queryModel.Status == (int)PendingforApproval && queryModel.UserRole == Checker && (int)queryModel.EntryOption.Value == 2)) { orderformEntity["lab_json_checker"] = queryModel.Hl7Stream; orderformEntity["statuscode"] = new OptionSetValue((int)Closed); } else if (queryModel.EntryOption != null && (queryModel.Status == (int)PendingforApproval && queryModel.UserRole == Checker && (int)queryModel.EntryOption.Value == 1)) { orderformEntity["lab_json_checker"] = queryModel.Hl7Stream; } Service.Update(orderformEntity); return(true); } catch (Exception) { return(false); // throw ex; } }
public string CheckUserDataExist(LabQueryModel queryModel) { var isvalidate = new JsonValidator(); var querybyattribute = new QueryByAttribute("lab_orderscan") { ColumnSet = new ColumnSet("lab_json_checker", "lab_json_maker", "lab_orderscanid") }; try { querybyattribute.AddAttributeValue("lab_orderscanid", queryModel.OrderId); var labscanGuid = Guid.Parse(queryModel.OrderId); var orderCollection = Service.Retrieve("lab_orderscan", labscanGuid, new ColumnSet(true)); var statuscode = orderCollection.GetEntityReferenceValue <OptionSetValue>("statuscode").Value; return(queryModel.UserRole == Maker && (int)Open == statuscode && orderCollection.Contains("lab_json_maker") ? (isvalidate.IsValidJson(orderCollection["lab_json_maker"].ToString()) ? orderCollection["lab_json_maker"].ToString() : "") : (queryModel.UserRole != null && (queryModel.UserRole == Checker && (int)PendingforApproval == statuscode && !orderCollection.Contains("lab_json_checker") && orderCollection.Contains("lab_json_maker")) ? (isvalidate.IsValidJson(orderCollection["lab_json_maker"].ToString()) ? orderCollection["lab_json_maker"].ToString() : "") : (queryModel.UserRole == Checker && (int)PendingforApproval == statuscode && orderCollection.Contains("lab_json_checker") ? (isvalidate.IsValidJson(orderCollection["lab_json_checker"].ToString()) ? orderCollection[$"lab_json_checker"].ToString() : "") : ""))); } catch (Exception) { return(""); } }