public static List <Etrans835Attach> GetForEtrans(bool isSimple, params long[] listEtrans835Nums) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <Etrans835Attach> >(MethodBase.GetCurrentMethod(), isSimple, listEtrans835Nums)); } if (listEtrans835Nums.Length == 0) { return(new List <Etrans835Attach>()); } string command = "SELECT etrans835attach.* " + (isSimple?"":",etrans.DateTimeTrans ") + "FROM etrans835attach " + (isSimple?"":"INNER JOIN etrans ON etrans.EtransNum=etrans835attach.EtransNum ") + "WHERE etrans835attach.EtransNum IN (" + String.Join(",", listEtrans835Nums.Select(x => POut.Long(x))) + ")"; DataTable table = Db.GetTable(command); if (isSimple) { return(Crud.Etrans835AttachCrud.TableToList(table)); } List <Etrans835Attach> listAttaches = Crud.Etrans835AttachCrud.TableToList(table); for (int i = 0; i < listAttaches.Count; i++) { Etrans835Attach attach = listAttaches[i]; DataRow row = table.Rows[i]; attach.DateTimeTrans = PIn.DateT(row["DateTimeTrans"].ToString()); } return(listAttaches); }
///<summary>Create a single attachment for a claim to an 835.</summary> public static long Insert(Etrans835Attach etrans835Attach) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { etrans835Attach.Etrans835AttachNum = Meth.GetLong(MethodBase.GetCurrentMethod(), etrans835Attach); return(etrans835Attach.Etrans835AttachNum); } return(Crud.Etrans835AttachCrud.Insert(etrans835Attach)); }
public static void DetachEraClaim(Hx835_Claim claimPaid) { Etrans835Attaches.DeleteMany(claimPaid.ClpSegmentIndex, claimPaid.Era.EtransSource.EtransNum); Etrans835Attach attach = new Etrans835Attach(); attach.EtransNum = claimPaid.Era.EtransSource.EtransNum; attach.ClaimNum = 0; attach.ClpSegmentIndex = claimPaid.ClpSegmentIndex; Etrans835Attaches.Insert(attach); claimPaid.IsAttachedToClaim = true; claimPaid.ClaimNum = 0; }
///<summary>Returns a list of Etrans835Attach for the given list of etransNums and/or listClaimNums. ///Set isSimple to false to run a simpiler query and if attach.DateTimeTrans is not needed. ///Returned list is ordered by Etrans835Attach.DateTimeEntry, this is very important when identifying claims split from an ERA.</summary> public static List <Etrans835Attach> GetForEtransNumOrClaimNums(bool isSimple, List <long> listEtransNum = null, params long[] listClaimNums) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <Etrans835Attach> >(MethodBase.GetCurrentMethod(), isSimple, listEtransNum, listClaimNums)); } if ((listEtransNum == null || listEtransNum.Count == 0) && (listClaimNums == null || listClaimNums.Length == 0)) { return(new List <Etrans835Attach>()); //Both are either not defined or contain no information, there would be no WHERE clause. } List <string> listWhereClauses = new List <string>(); if (listClaimNums.Length != 0) { listWhereClauses.Add("etrans835attach.ClaimNum IN (" + String.Join(",", listClaimNums.Select(x => POut.Long(x))) + ")"); } if (!isSimple && listEtransNum != null && listEtransNum.Count > 0) //Includes manually detached and split attaches created when spliting procs from ERA. { listWhereClauses.Add("etrans.EtransNum IN (" + string.Join(",", listEtransNum.Select(x => POut.Long(x))) + ")"); } if (listWhereClauses.Count == 0) { return(new List <Etrans835Attach>()); } string command = "SELECT etrans835attach.* " + (isSimple?"":",etrans.DateTimeTrans ") + "FROM etrans835attach " + (isSimple?"":"INNER JOIN etrans ON etrans.EtransNum=etrans835attach.EtransNum ") + "WHERE " + string.Join(" OR ", listWhereClauses) + " " + "ORDER BY etrans835attach.DateTimeEntry"; //Attaches created from splitting an ERA need to be after the original claim attach. DataTable table = Db.GetTable(command); if (isSimple) { return(Crud.Etrans835AttachCrud.TableToList(table)); } List <Etrans835Attach> listAttaches = Crud.Etrans835AttachCrud.TableToList(table); for (int i = 0; i < listAttaches.Count; i++) { Etrans835Attach attach = listAttaches[i]; DataRow row = table.Rows[i]; attach.DateTimeTrans = PIn.DateT(row["DateTimeTrans"].ToString()); } return(listAttaches); }
public static List <Etrans835Attach> GetForEtransNumOrClaimNums(bool isSimple, long etransNum = 0, params long[] listClaimNums) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <Etrans835Attach> >(MethodBase.GetCurrentMethod(), isSimple, etransNum, listClaimNums)); } List <string> listWhereClauses = new List <string>(); if (listClaimNums.Length != 0) { listWhereClauses.Add("etrans835attach.ClaimNum IN (" + String.Join(",", listClaimNums.Select(x => POut.Long(x))) + ")"); } if (etransNum != 0) //Manually detached rows will have claimNum 0. { listWhereClauses.Add("(etrans.EtransNum=" + POut.Long(etransNum) + " AND etrans835attach.ClaimNum=0)"); } if (listWhereClauses.Count == 0) { return(new List <Etrans835Attach>()); } string command = "SELECT etrans835attach.* " + (isSimple?"":",etrans.DateTimeTrans ") + "FROM etrans835attach " + (isSimple?"":"INNER JOIN etrans ON etrans.EtransNum=etrans835attach.EtransNum ") + "WHERE " + string.Join(" OR ", listWhereClauses); DataTable table = Db.GetTable(command); if (isSimple) { return(Crud.Etrans835AttachCrud.TableToList(table)); } List <Etrans835Attach> listAttaches = Crud.Etrans835AttachCrud.TableToList(table); for (int i = 0; i < listAttaches.Count; i++) { Etrans835Attach attach = listAttaches[i]; DataRow row = table.Rows[i]; attach.DateTimeTrans = PIn.DateT(row["DateTimeTrans"].ToString()); } return(listAttaches); }