Beispiel #1
0
        public List <insurance> _getInsurance_doc1(dynamic con_ins)
        { // temporary for table DOCTOR1
            try
            {
                SV_db1Entities   dbEntity = new SV_db1Entities();
                List <insurance> ins      = new List <insurance>();
                // var con_ins = dbEntity.con_DOCTOR1_ref_insurance.Where(a => a.rel_DOCTOR_id == doctor_id);

                foreach (var n in con_ins)
                {
                    //ins.Add(new insurance
                    //{
                    //    id = n.rel_ref_insurance_provider_id.Value,
                    //    provider = n.ref_insurance_provider.PayerName.Split('|')[0]
                    //});
                    ins.Add(new insurance
                    {
                        id       = n.ins_id,
                        provider = n.ins_provider.Split('|')[0]
                    });
                }

                return(ins);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Beispiel #2
0
        public IHttpActionResult Get1()
        {
            SV_db1Entities db           = new SV_db1Entities();
            string         insurance_id = "";
            var            ref_ins      = from a in db.ref_insurance_provider
                                          where a.PayerID.Contains(insurance_id)
                                          select a;

            ref_ins = ref_ins.OrderBy(a => a.PayerName);

            List <insurance> ins = new List <insurance>();

            foreach (var i in ref_ins)
            {
                ins.Add(
                    new insurance
                {
                    id       = i.id, //i.PayerID.Split(',')[0],
                    provider = i.PayerName.Split('|')[0].Trim()
                });
            }


            var ret1  = JsonConvert.SerializeObject(ins);
            var json1 = Newtonsoft.Json.Linq.JArray.Parse(ret1);

            return(Json(new { data = json1, message = "", success = true }));
        }
Beispiel #3
0
        // created: 01/11/2018
        public List <doc_specialty_01112018> getSpecialty(long spec_id)
        {
            SV_db1Entities db = new SV_db1Entities();

            var n = db.ref_specialty1.Find(spec_id);
            List <doc_specialty_01112018> spec = new List <doc_specialty_01112018>();

            if (n != null)
            {
                //string[] con = n.conditions.Split('|');
                List <string> condition = new List <string>();
                foreach (var c in n.ref_condition)
                {
                    condition.Add(c.dname);
                }

                spec.Add(new doc_specialty_01112018
                {
                    id            = n.id,
                    provider_type = n.ref_specialty_provider.name,//  s.provider_type,

                    classification_code = n.level2_classification_code,
                    classification      = n.level2_classification,

                    specialization_code = n.level2_classification_code == null ? "" : n.level2_classification_code,
                    specialization      = n.level3_specialization == null ? "" : n.level3_specialization, // s.specialization,
                    conditions          = condition
                });
            }

            return(spec);
        }
Beispiel #4
0
        public List <doc_language> _getLanguage_doc1(dynamic con_lang)
        {
            // temporary for table DOCTOR1

            try
            {
                SV_db1Entities      dbEntity = new SV_db1Entities();
                List <doc_language> doc_lang = new List <doc_language>();
                //var con_lang = dbEntity.con_DOCTOR1_ref_language.Where(a => a.rel_DOCTOR_id == doctor_id);

                //string[] split_val = value.Split(',');
                foreach (var a in con_lang)
                {
                    // var ref_lang = dbEntity.ref_languages.Find(a.rel_ref_language_id);
                    //doc_lang.Add(new doc_language
                    //{
                    //    id = a.ref_languages.id,
                    //    name = a.ref_languages.name
                    //});

                    doc_lang.Add(new doc_language
                    {
                        id   = a.lang_id,
                        name = a.lang_name
                    });
                }


                return(doc_lang);
            }
            catch (Exception ex) { return(null); }
        }
        private long xvalidateZip(string city, string state, string zip)
        {
            SV_db1Entities db      = new SV_db1Entities();
            int            nzip    = 0;
            bool           isvalid = int.TryParse(zip, out nzip);

            if (!isvalid)
            {
                return(-1);
            }

            var ref_zip = db.ref_zip.Where(a => a.zip == zip);

            if (ref_zip.Count() > 0)
            {
                if (ref_zip.FirstOrDefault().city_name.ToLower() != city.ToLower())
                {
                    //return Json(new { data = new string[] { }, message = "Invalid city name.", success = false });
                    return(0);
                }

                if (ref_zip.FirstOrDefault().city_state.ToLower() != state.ToLower()
                    & ref_zip.FirstOrDefault().city_state_long.ToLower() != state.ToLower())
                {
                    //return Json(new { data = new string[] { }, message = "Invalid state name.", success = false });
                    return(0);
                }
            }

            //return Json(new { data = new string[] { }, message = "Match found.", success = true });
            return(ref_zip.FirstOrDefault().id);
        }
Beispiel #6
0
        // validate zip in PharmacyController
        public long validateZip(post_pharmacy pha)
        {
            SV_db1Entities db      = new SV_db1Entities();
            int            nzip    = 0;
            bool           isvalid = int.TryParse(pha.zip, out nzip);

            if (!isvalid)
            {
                return(1);
            }

            var ref_zip = db.ref_zip.Where(a => a.zip == pha.zip);

            if (ref_zip.Count() > 0)
            {
                if (ref_zip.FirstOrDefault().city_name.ToLower() != pha.city.ToLower())
                {
                    //return Json(new { data = new string[] { }, message = "Invalid city name.", success = false });
                    return(2);
                }

                if (ref_zip.FirstOrDefault().city_state.ToLower() != pha.state.ToLower()
                    & ref_zip.FirstOrDefault().city_state_long.ToLower() != pha.state.ToLower())
                {
                    //return Json(new { data = new string[] { }, message = "Invalid state name.", success = false });
                    return(3);
                }
            }
            pha.zip_id = ref_zip.FirstOrDefault().id;
            //return Json(new { data = new string[] { }, message = "Match found.", success = true });
            return(0);
        }
Beispiel #7
0
 public static bool Login(string username, string password)
 {
     using (SV_db1Entities auth = new SV_db1Entities())
     {
         return(auth.app_authentication.Any(user => username.Equals(username, StringComparison.OrdinalIgnoreCase) &&
                                            user.password == password
                                            ));
     }
 }
Beispiel #8
0
        public List <doc_specialty_01112018> _getDoctor_specialty_doc1(dynamic con_spec)
        {
            try
            {
                SV_db1Entities dbEntity = new SV_db1Entities();
                //01/11/2018 List<doc_specialty2> spec = new List<doc_specialty2>();
                List <doc_specialty_01112018> spec = new List <doc_specialty_01112018>();
                //var con_spec = dbEntity.con_DOCTOR1_ref_specialty.Where(a => a.rel_DOCTOR_id == doctor_id);

                foreach (var i in con_spec)
                {
                    // 01/11/2018
                    List <string> condition = new List <string>();
                    foreach (var c in i.spec_condition)
                    {
                        //string[] con = i.spec_condition.Split('|');
                        //foreach (var c in con)
                        //{
                        if (!string.IsNullOrEmpty(c))
                        {
                            condition.Add(c);
                        }
                        //}
                    }


                    // 01/11/2018
                    spec.Add(new doc_specialty_01112018
                    {
                        // id = n.ref_specialty.id,
                        // description = n.ref_specialty.description,
                        // name = n.ref_specialty.name,
                        // actor = n.ref_specialty.actor == null ? "" : n.ref_specialty.actor

                        id            = i.spec_id,
                        provider_type = i.spec_provider_type,//  s.provider_type,

                        classification_code = i.spec_classification_code,
                        classification      = i.spec_classification,

                        specialization_code = i.spec_specialization_code == null? "" : i.spec_specialization_code,
                        specialization      = i.spec_specialization == null?"" : i.spec_specialization, // s.specialization,
                        conditions          = condition
                    });
                }

                return(spec);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Beispiel #9
0
        // created: 01/11/2018
        public List <doc_specialty_01112018> getSpecialty(string code)
        {
            SV_db1Entities db = new SV_db1Entities();

            // 01/17/2018 var spec1 = db.ref_specialty1.Where(b => b.level2_classification_code == code || b.level3_specialization_code == code);
            var spec1 = from a in db.ref_specialty1
                        select new {
                a.id,
                specialty_provider = a.ref_specialty_provider.name,
                a.level2_classification,
                a.level2_classification_code,
                a.level3_specialization,
                a.level3_specialization_code,
                condition = from b in a.ref_condition
                            select b.dname,
            };
            List <doc_specialty_01112018> spec = new List <doc_specialty_01112018>();

            foreach (var n in spec1)
            {
                //string[] con = n.conditions.Split('|');
                List <string> condition = new List <string>();
                foreach (var c in n.condition)
                {
                    condition.Add(c);
                }

                spec.Add(new doc_specialty_01112018
                {
                    // id = n.ref_specialty.id,
                    // description = n.ref_specialty.description,
                    // name = n.ref_specialty.name,
                    // actor = n.ref_specialty.actor == null ? "" : n.ref_specialty.actor

                    id            = n.id,
                    provider_type = n.specialty_provider,//  s.provider_type,

                    classification_code = n.level2_classification_code,
                    classification      = n.level2_classification,

                    specialization_code = n.level3_specialization_code == null ? "" : n.level3_specialization_code,
                    specialization      = n.level3_specialization == null ? "" : n.level3_specialization, // s.specialization,
                    conditions          = condition
                });
            }


            return(spec);
        }
Beispiel #10
0
        public getDoctor_rating _get_averagerating_doc1(long doctor_id)
        {
            try
            {
                //balkon rating = dr.average_rating,
                //balkon favorite = dr.fave,
                //balkon patient_review = dr.review,

                SV_db1Entities dbEntity = new SV_db1Entities();

                // var appt = dbEntity.APPOINTMENTs.Where(a => a.doctor_id == doctor_id);
                var appt = from ap in dbEntity.APPOINTMENTs
                           where ap.doctor_id == doctor_id
                           select ap;
                // having Where clause slows down the response.
                // we shud consider the status of the Appointment, only those that were Closed not canceled

                getDoctor_rating        ave           = new getDoctor_rating();
                List <p_ratings_review> rating_review = new List <p_ratings_review>();
                foreach (var a in appt)
                {
                    // long id = a.doctor_id.Value;
                    // ave.average_rating= a.doctor_rating.Value;
                    // review = a.doctor_review;
                    double rating = a.doctor_rating == null ? 0 : a.doctor_rating.Value;
                    string review = a.doctor_review;

                    rating_review.Add(new p_ratings_review {
                        rating = rating, remark = review
                    });

                    // ave.review.Add{ rating_review};
                }

                ave.review = rating_review;
                return(ave);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Beispiel #11
0
        //    resultsTextBox.Text += "Working . . . . . . .\r\n";
        //}
        public IHttpActionResult Getinsurance(long insurance_id = 0)
        {
            System.Web.HttpContext httpCOn = System.Web.HttpContext.Current;

            string a_pass = httpCOn.Request.Headers["Authorization"];
            bool   b_pass = Validation.userAuth(a_pass);

            // Basic dXNlcjp1c2Vy
            // Basic dXNlcjp1c2Vy
            // "Basic ZGVmdHNvZnQ6ZGVmdHNvZnRhcGlrZXk="
            string msg = "The authorization header is not valid.";

            if (b_pass)
            {
                SV_db1Entities db = new SV_db1Entities();

                var ref_ins = from a in db.ref_insurance_provider select a;

                if (insurance_id > 0)
                {
                    ref_ins = ref_ins.Where(a => a.id == insurance_id);
                }

                List <insurance> ins = new List <insurance>();
                foreach (var i in ref_ins)
                {
                    ins.Add(
                        new insurance
                    {
                        id       = i.id, //i.PayerID.Split(',')[0],
                        provider = i.PayerName.Split('|')[0].Trim()
                    });
                }

                var ret1  = JsonConvert.SerializeObject(ins);
                var json1 = Newtonsoft.Json.Linq.JArray.Parse(ret1);
                return(Json(new { data = json1, message = "Record found.", success = true }));
            }

            return(Json(new { data = "", message = msg, success = false }));
        }
Beispiel #12
0
        public static bool saveClaimDoctor_ext(string _attr_name, string _dname, string _value, long doc_id = 0)
        {
            // 01/04/2018: used by Doctor signup/login (HS-67)
            DateTime       dt       = DateTime.UtcNow;
            SV_db1Entities dbEntity = new SV_db1Entities();

            try
            {
                var d_ext = dbEntity.DOCTOR_ext.Where(a => a.attr_name == _attr_name && a.rel_DOCTOR_id == doc_id).FirstOrDefault();
                if (d_ext == null) // add attr if does not exist yet
                {
                    d_ext = new DOCTOR_ext();
                    d_ext.rel_DOCTOR_id      = doc_id;
                    d_ext.attr_name          = _attr_name;
                    d_ext.dname              = _dname;
                    d_ext.value              = _value;
                    d_ext.dt_create          = dt;
                    d_ext.create_by__USER_id = 0;
                    dbEntity.DOCTOR_ext.Add(d_ext);
                    dbEntity.SaveChanges();
                }
                else // update the record if attr already exist
                {
                    //DOCTOR_ext d_ext = new DOCTOR_ext();
                    //var d_ext = dbEntity.DOCTOR_ext.Where(a => a.attr_name == _attr_name && a.rel_DOCTOR_id == doc_id).FirstOrDefault();

                    d_ext.attr_name             = _attr_name;
                    d_ext.dname                 = _dname;
                    d_ext.value                 = _value;
                    d_ext.dt_update             = dt;
                    d_ext.update_by__USER_id    = 0;
                    dbEntity.Entry(d_ext).State = System.Data.Entity.EntityState.Modified;
                    dbEntity.SaveChanges();
                }
            }
            catch (Exception ex) { }


            return(true);
        }
Beispiel #13
0
        /// <summary>
        /// Get appointment type per Doctor.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public appt_type _getDoctor_appointmenttype(long value)
        {
            SV_db1Entities dbEntity = new SV_db1Entities();

            appt_type appt_type = new appt_type();

            // long vappt_id = 0;
            // bool isAppt = long.TryParse(value, out vappt_id);

            var    n1         = dbEntity.ref_APPOINTMENT_type.Find(value);
            string vappt_name = n1.dname;
            long   vappt_id   = n1.id;

            //appt_type.Add(new appt_type
            //{
            //    id = vappt_id,
            //    type = vappt_name
            //});
            appt_type.id   = vappt_id;
            appt_type.type = vappt_name;


            return(appt_type);
        }