Example #1
0
 public void SearchInvoicesByContract(decimal?invoiceId)
 {
     searchString           = invoiceId.ToString();
     selectedDeliveryMethod = null;
     selectedSpecialist     = null;
     contractString         = null;
     SearchString           = invoiceId.ToString();
 }
Example #2
0
        public ObservableCollection <InvoiceGroup> SearchT(
            ObservableCollection <InvoiceGroup> output,
            Action onCompleted
            )
        {
#if !ORACLE
            return(null);
#endif
            IInvoiceGroupRepository DataTarget = Spheris.Billing.Data.BillingDataFactory.NewInstance().CreateInvoiceGroupRepository();
            var syncContext = SynchronizationContext.Current;
            if (syncContext == null)
            {
                throw new InvalidOperationException("...");
            }

            BillingSpecialist billSp     = (SelectedSpecialist == null || SelectedSpecialist.Id == 0) ? null : SelectedSpecialist;
            DeliveryMethod    delMethod  = (SelectedDeliveryMethod == null || SelectedDeliveryMethod.Descr == "*") ? null : SelectedDeliveryMethod;
            string            cntString  = (string.IsNullOrEmpty(ContractString)) ? null : ContractString;
            string            srchString = (string.IsNullOrEmpty(SearchString) || SearchString.Length < 3) ? null : SearchString;
            if (billSp == null && delMethod == null && string.IsNullOrEmpty(cntString) && string.IsNullOrEmpty(srchString))
            {
                IGroups = null;
                return(null);
            }
            uiDispatcher = Dispatcher.CurrentDispatcher;
            if (workerThread != null)
            {
                Debug.WriteLine("Killing thread");
                workerThread.Abort();
            }
            workerThread = new Thread(new ThreadStart(delegate
            {
                try
                {
                    var payload = DataTarget.FetchGroups(billSp,
                                                         delMethod,
                                                         (string.IsNullOrEmpty(contractString)) ? null : contractString,
                                                         (string.IsNullOrEmpty(searchString)) ? null : searchString);

                    if (payload != null)
                    {
                        syncContext.Post(arg => CreateOutput(payload as ObservableCollection <InvoiceGroup> /* output*/, onCompleted), null);
                    }
                }
                catch (Exception x)
                {
                    // throw x;// ThisView.ShowMsg(x.ToString());
                }
            }));
            workerThread.Priority = ThreadPriority.Normal;
            workerThread.Start();
            return(null);
        }
        public void Search()
        {
            BillingSpecialist billSp     = (SelectedSpecialist == null || SelectedSpecialist.Id == 0) ? null : SelectedSpecialist;
            DeliveryMethod    delMethod  = (SelectedDeliveryMethod == null || SelectedDeliveryMethod.Descr == "*") ? null : SelectedDeliveryMethod;
            string            cntString  = (string.IsNullOrEmpty(ContractString)) ? null : ContractString;
            string            srchString = (string.IsNullOrEmpty(SearchString) || SearchString.Length < 3) ? null : SearchString;

            if (billSp == null && delMethod == null && string.IsNullOrEmpty(cntString) && string.IsNullOrEmpty(srchString))
            {
                IGroups = null;
            }
            else
            {
                IGroups = DataTarget.FetchGroups(billSp,
                                                 delMethod,
                                                 (string.IsNullOrEmpty(ContractString)) ? null : ContractString,
                                                 (string.IsNullOrEmpty(SearchString)) ? null : SearchString);
            }
        }
Example #4
0
        protected override void RowConverter(BillingSpecialist item, DataRow row)
        {
            int parsed = 0;

            try
            {
                if (int.TryParse(row["BILL_SPECIALIST_ID"].ToString(), out parsed))
                {
                    item.Id = parsed;
                }

                item.Name             = row["NAME"].ToString();
                item.Phone            = row["PHONE"].ToString();
                item.Email            = row["INVOICE_EMAIL_BODY"].ToString();
                item.DisplayTitle     = row["DISPLAY_TITLE"].ToString();
                item.InvoiceEmailBody = row["INVOICE_EMAIL_BODY"].ToString();
            }
            catch (Exception sysEx)
            {
                throw sysEx;
            }
        }
Example #5
0
        public override ObservableCollection <BillingSpecialist> GetSpecialists()
        {
#if !ORACLE
            return(null);
#endif

            ObservableCollection <BillingSpecialist> specialists = new ObservableCollection <BillingSpecialist>();
            try
            {
                const string sql = "select * from  sphrsbilling.bill_specialist";
                DataTable    dt  = OracleHelper.ExecuteQuery(base.ConnectionString.Value, sql, null);

                foreach (DataRow row in dt.Rows)
                {
                    BillingSpecialist item = new BillingSpecialist
                    {
                        Id               = int.Parse(row["BILL_SPECIALIST_ID"].ToString()),
                        Name             = row["NAME"].ToString(),
                        Phone            = row["PHONE"].ToString(),
                        Email            = row["EMAIL"].ToString(),
                        DisplayTitle     = row["DISPLAY_TITLE"].ToString(),
                        InvoiceEmailBody = row["INVOICE_EMAIL_BODY"].ToString()
                    };
                    specialists.Add(item);
                }
            }
            catch (OracleException ex)
            {
                throw ex;
            }
            catch (Exception sysEx)
            {
                throw sysEx;
            }
            return(specialists);
        }
Example #6
0
 public override void Remove(BillingSpecialist entity)
 {
 }
Example #7
0
 public override void Update(BillingSpecialist entity)
 {
 }
Example #8
0
 public override void Add(BillingSpecialist entity)
 {
 }
Example #9
0
 public override BillingSpecialist Get(BillingSpecialist entity)
 {
     return(null);
 }
        public override ObservableCollection <InvoiceGroup> FetchGroups(BillingSpecialist specialist, DeliveryMethod deliveryMethod, string contractFilter, string descFilter)
        {
            ObservableCollection <InvoiceGroup> groups = null;

            try
            {
                string where = string.Empty;
                if (descFilter != null)
                {
                    int    output;
                    string descWhere = String.Format(" UPPER (ig.DESCR) LIKE '%{0}%'", descFilter.ToUpper());

                    if (int.TryParse(descFilter.Trim(), out output))
                    {
                        descWhere += String.Format(" OR ig.INVOICE_GRP_ID={0}", output);
                    }

                    descWhere  = descWhere.Insert(0, "(");
                    descWhere += ")";
                    where      = Where(where, descWhere);
                }
                if (deliveryMethod != null)
                {
                    where = Where(where, String.Format(" IG.DELIVERY_METHOD='{0}'", deliveryMethod.TheDeliveryMethod));
                }

                if (specialist != null)
                {
                    //where = Where(where, String.Format(" IG.Id='{0}'", specialist.Id));
                    where = Where(where, String.Format(" IG.BILL_SPECIALIST_ID='{0}'", specialist.Id));
                }

                if (contractFilter != null)
                {
                    int    output;
                    string conWhere = String.Format(" UPPER(CON.DESCR) LIKE '%{0}%'", contractFilter.ToUpper());

                    if (int.TryParse(contractFilter.Trim(), out output))
                    {
                        conWhere += String.Format(" OR ig.CONTRACT_ID={0}", output);
                    }
                    conWhere  = conWhere.Insert(0, "(");
                    conWhere += ")";
                    where     = Where(where, conWhere);
                }


                string sql = string.Format("select  ig.* ,con.descr\r\n"
                                           + " ,nvl(case when ig.encryption_optout = 'Y' then 'N' \r\n"
                                           + "  when ist.must_encrypt = 'Y' or r.must_encrypt = 'Y' then 'Y' else 'N' end, 'N') \r\n"
                                           + " as must_encrypt \r\n"
                                           + "from    sphrsbilling.invoice_grp ig \r\n"
                                           + "left join sphrsbilling.invoice_style ist \r\n"
                                           + "  on    ist.invoice_style = ig.invoice_style \r\n"
                                           + "left join sphrsbilling.contract con \r\n"
                                           + "  on    con.contract_id = ig.contract_id \r\n"
                                           + "left join (select invoice_grp_id, max(rt.must_encrypt) as must_encrypt \r\n"
                                           + "           from   sphrsbilling.invoice_grp_report igr \r\n"
                                           + "           join   sphrsbilling.report_type rt \r\n"
                                           + "             on   rt.report_type_id = igr.report_type_id \r\n"
                                           + "           where  rt.must_encrypt = 'Y' \r\n"
                                           + "           group by invoice_grp_id) r \r\n"
                                           + "  on    r.invoice_grp_id = ig.invoice_grp_id");
                if (!string.IsNullOrEmpty(where))
                {
                    sql += where;
                }
                OracleParameter[] p = null;
#if TIMEIT
                DateTime Start = DateTime.Now;
#endif
                DataTable dt = OracleHelper.ExecuteQuery(base.ConnectionString.Value, sql, p);
#if TIMEIT
                DateTime End      = DateTime.Now;
                TimeSpan CallTime = End - Start;

                System.Diagnostics.Debug.WriteLine("Query Time: + " + CallTime.Milliseconds.ToString());
#endif
                groups = ConvertDataTableToObservableCollection(dt);
            }
            catch (OracleException ex)
            {
                throw ex;
            }
            catch (Exception sysEx)
            {
                throw sysEx;
            }
            return(groups);
            //return null;
        }
Example #11
0
 public abstract ObservableCollection <InvoiceGroup> FetchGroups(BillingSpecialist specialist, DeliveryMethod deliveryMethod, string contractFilter, string descFilter);