Example #1
0
        public List <TriPatientNotesEntity> GetPatientNotes(int patientId)
        {
            List <TriPatientNotesEntity> triPatientNotesEntity = new List <TriPatientNotesEntity>();

            try
            {
                //var patient = _unitOfWork.DocMasterRepo.Get(o => o.PTrowid == patientId).FirstOrDefault();
                //if (patient != null)
                //{
                List <SP_PatientNotes_Result> patientNotes = new List <SP_PatientNotes_Result>();
                //List<SP_PatientNotes_Result> patients = _unitOfWork.PatientNotesEntityRepo.Get();
                patientNotes = _unitOfWork.PatientNotesEntityRepo.ExecWithStoreProcedure("SP_GetDocMaster @Patientid", new SqlParameter("Patientid", SqlDbType.BigInt)
                {
                    Value = patientId
                }).ToList();

                //===============Mapper===========================================
                var config = new MapperConfiguration(cfg =>
                {
                    cfg.CreateMap <SP_PatientNotes_Result, TriPatientNotesEntity>();
                });

                IMapper mapper = config.CreateMapper();
                triPatientNotesEntity = mapper.Map <List <SP_PatientNotes_Result>, List <TriPatientNotesEntity> >(patientNotes);
                //===============mapper end==========================================
                //  }
            }
            catch (Exception ex)
            {
                CustomLogger.LogMessage(ex.Message, "");
                CustomLogger.SendExcepToDB(ex, "TNotesRepository");

                throw;
            }
            return(triPatientNotesEntity);
        }
Example #2
0
        public bool SendOTP(string StrPhone, string strTimeZone)
        {
            string responseStr = "";
            // string StrPhone = "9049991221";
            string cultureName = "en-US";

            string fulldate = "12-08-2018 19:08:54";

            string[] time = strTimeZone.Split(' ');

            string datepart = time[0];

            string[] tt        = datepart.Split('-');
            string   finaldate = tt[1] + "/" + tt[0] + "/" + tt[2] + " " + time[1];

            try
            {
                //  Get list of Patients to send a note
                Random rnd        = new Random();
                int    myRandomNo = rnd.Next(100000, 999999); // creates a 8 digit random no.
                //var culture = new CultureInfo(cultureName);
                //object Tday = DateTime.Now.ToString(culture);
                DateTime mobileDate = Convert.ToDateTime(finaldate);
                object   Tday       = mobileDate.ToString("yyyy-MM-dd HH:mm");
                int      mm         = Convert.ToInt32(mobileDate.ToString("mm"));
                int      ss         = Convert.ToInt32(mobileDate.ToString("ss"));
                int      hh         = Convert.ToInt32(mobileDate.ToString("HH"));
                //ss = ss + 30;
                //if (ss < 60)
                //{
                //    Tday = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                //    Tday = (Tday + ":"+ Convert.ToString(ss));
                //}
                //else
                //{
                //    Tday = DateTime.Now.ToString("yyyy-MM-dd HH");
                //    ss = ss - 60;
                //    mm = mm + 1;
                //    Tday = (Tday + ":" + Convert.ToString(mm));
                //    //Tday = (Tday + ":" + Convert.ToString(ss));
                //}
                Tday = mobileDate.ToString("yyyy-MM-dd ");
                ss   = ss - 60;
                mm   = mm + 1;
                string minute = string.Empty;
                if (mm < 10)
                {
                    minute = "0" + mm;
                }
                else
                {
                    minute = Convert.ToString(mm);
                }
                hh = hh - 1;
                string hours = string.Empty;
                if (hh < 10)
                {
                    hours = "0" + hh;
                }
                else
                {
                    hours = Convert.ToString(hh);
                }
                Tday = (Tday + hours + ":" + minute);
                Tday = (Tday + "-05");

                //string msg = "OTP is" + myRandomNo;111
                //HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://sms.mahabeautyplus.com/sendsms/sendsms.php?username=memahatra&password=mes1231&type=TEXT&sender=Alerts&mobile="+ StrPhone + "&message=" + msg + "");

                //// HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://sms.mahabeautyplus.com/sendsms/sendsms.php?username=memesthn&password=mes2014&type=TEXT&sender=Alerts&mobile=8879333715&message=hello");

                //HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
                //System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
                //string responseString = respStreamReader.ReadToEnd();
                //respStreamReader.Close();
                //myResp.Close();



                //===========================USA=========================================
                string url1 = "https://api.remindercall.net/v3.2/dispatch.xml";
                // Enter code for sending text message
                //00b4def6b655ce6026fbdc66014f779b6789da1321b9a43cad42f1804269134d
                // -----------    FORM XML    START       ------------------------------------------------------------------------------------------
                XDocument doc = new XDocument(
                    new XElement("request",
                                 new XElement("key", "cb5aba79e96ccfd59c5b3265e0786bb74c15598b2d2fc35fbef99ffed62a4825"),
                                 new XElement("text", new XAttribute("action", "create"),
                                              new XElement("id", myRandomNo),
                                              new XElement("delivery", Tday.ToString()),
                                              new XElement("number", StrPhone),
                                              new XElement("message", "OTP is " + myRandomNo))));


                // -----------    FORM XML    END       ------------------------------------------------------------------------------------------
                HttpWebRequest request = ((HttpWebRequest)(WebRequest.Create(url1)));
                byte[]         bytes;
                string         xmlString = doc.ToString();
                bytes = System.Text.Encoding.ASCII.GetBytes(xmlString);
                request.ContentType   = "text/xml; encoding=\'utf-8\'";
                request.ContentLength = bytes.Length;
                request.Method        = "POST";
                Stream requestStream = request.GetRequestStream();
                requestStream.Write(bytes, 0, bytes.Length);
                requestStream.Close();
                HttpWebResponse resp;
                resp = ((HttpWebResponse)(request.GetResponse()));
                if ((resp.StatusCode == HttpStatusCode.OK))
                {
                    Stream responseStream = resp.GetResponseStream();
                    responseStr = new StreamReader(responseStream).ReadToEnd();
                }
                // TODO: Warning!!!! NULL EXPRESSION DETECTED...


                // responseStr = "<?xml version=""1.0"" encoding=""UTF-8""?>
                //               <response>
                //                  <status>
                //                     <text>
                //                         <id>2</id>
                //                         <result>success</result>
                //                         <status>new</status>
                //                     </text>
                //                 </status>
                //               </response>"
                string genre = string.Empty;
                using (XmlReader reader = XmlReader.Create(new StringReader(responseStr)))
                {
                    reader.ReadToFollowing("text");
                    reader.MoveToFirstAttribute();
                    reader.ReadToFollowing("result");
                    genre = reader.ReadElementContentAsString();
                }
                //=============================USA END
                tblOTP otpEntity = new tblOTP();
                otpEntity.PhoneNumber = StrPhone;
                otpEntity.OTPCode     = Convert.ToString(myRandomNo);

                var result = UpdateDevices(otpEntity);
            }
            catch (Exception ex)
            {
                CustomLogger.LogMessage(ex.Message, "");
                CustomLogger.SendExcepToDB(ex, "AuthRepository");

                throw;
            }



            return(true);
        }