Пример #1
0
 /// <summary>
 /// Creates a product
 /// </summary>
 /// <param name="productEntity"></param>
 /// <returns></returns>
 public int CreateAppUser(AppUsersEntity appUserEntity)
 {
     using (var scope = new TransactionScope())
     {
         var AppUsers = new tblAppUser
         {
             AUrowid     = appUserEntity.AUrowid,
             FirstName   = appUserEntity.FirstName,
             LastName    = appUserEntity.LastName,
             PhoneNumber = appUserEntity.PhoneNumber,
             EmailId     = appUserEntity.EmailId,
             NPINumber   = appUserEntity.NPINumber,
             Access      = appUserEntity.Access,
             // createdby = appUserEntity.createdby,
             createdby = "Admin",
             createdts = DateTime.Now,
             updatedby = "Admin",
             updatedts = DateTime.Now
         };
         _unitOfWork.AppUserRepo.Insert(AppUsers);
         _unitOfWork.Save();
         scope.Complete();
         return(AppUsers.AUrowid);
     }
 }
Пример #2
0
        public tblAppUser GetNotifications(string phoneNumber)
        {
            tblAppUser patient = new tblAppUser();

            int?NPINumber = null;

            try
            {
                //UserDevicesEntity
                // var patient = _unitOfWork.DeviceRepo.Get(o => o.DeviceId.Equals(phoneNumber)).FirstOrDefault();

                patient   = _unitOfWork.AppUserRepo.Get(o => o.PhoneNumber.Equals(phoneNumber)).FirstOrDefault();
                NPINumber = patient.NPINumber;
            }
            catch (Exception ex)
            {
                throw;
            }

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

            //IMapper mapper = config.CreateMapper();
            //deviceEntity = mapper.Map<tblDevice, DevicesEntity>(patient);
            ////===============mapper end==========================================
            return(patient);
        }
Пример #3
0
        public ReferralSignDetailsEntity GetRefSignDetails(int patientId, int noteId, string NPINumber)
        {
            ReferralSignDetailsEntity refSignDetails = new ReferralSignDetailsEntity();

            if (!string.IsNullOrEmpty(NPINumber))
            {
                int        npinum   = Convert.ToInt32(NPINumber);
                tblAppUser _appuser = _unitOfWork.AppUserRepo.Get(o => o.NPINumber == npinum).FirstOrDefault();
                if (_appuser != null)
                {
                    tblDevice       _devices      = _unitOfWork.DeviceRepo.Get(o => o.PhoneNumber.Equals(_appuser.PhoneNumber)).FirstOrDefault();
                    tblReferrerSign _ReferralSign = _unitOfWork.ReferrerSignRepo.Get(o => o.NPINumber == npinum &&
                                                                                     o.PTrowid == patientId && o.Docrowid == noteId
                                                                                     ).FirstOrDefault();



                    refSignDetails.EmailID = _appuser.EmailId;

                    refSignDetails.PhoneNumber = _appuser.PhoneNumber;
                    //refSignDetails.SignedDate = _ReferralSign.SignedDate ?? default;
                    refSignDetails.NoteType  = _ReferralSign.NoteType;
                    refSignDetails.Sign      = _ReferralSign.Signed ?? false;
                    refSignDetails.Signiture = _devices.SignPath;
                    refSignDetails.PDFPath   = _ReferralSign.PDFName;
                }
            }
            return(refSignDetails);
        }
Пример #4
0
        public IHttpActionResult CheckAccess(string phoneNumber)
        {
            tblAppUser result = new tblAppUser();

            try
            {
                result = _authRepository.GetAppUserByPhoneNo(phoneNumber);
            }
            catch (Exception ex)
            {
                throw new ApiDataException(2000, "Technical error occured, Please contact administrator", HttpStatusCode.InternalServerError);
            }

            finally
            {
                if (result == null)
                {
                    throw new ApiDataException(1004, "Access not provided", HttpStatusCode.InternalServerError);
                }

                //  return result;
            }

            return(Ok(result));
        }
Пример #5
0
        public tblAppUser RegisterUser(DevicesEntity deviceModel)
        {
            bool flag = false;
            List <tblAppUser> user      = new List <tblAppUser>();
            List <tblDevice>  tblDevice = new List <tblDevice>();

            try
            {
                user = _unitOfWork.AppUserRepo.Get(c => c.PhoneNumber.Equals(deviceModel.PhoneNumber)).ToList();
                if (user.Count() > 0)
                {
                    tblDevice = _unitOfWork.DeviceRepo.Get(c => c.EmailId.Equals(deviceModel.EmailId) && c.PhoneNumber.Equals(deviceModel.PhoneNumber)).ToList();
                    if (tblDevice.Count() == 0)
                    {
                        using (var scope = new TransactionScope())
                        {
                            var TblDevice = new tblDevice
                            {
                                //Drowid = 1,
                                DeviceId    = deviceModel.DeviceId,
                                EmailId     = deviceModel.EmailId,
                                PhoneNumber = deviceModel.PhoneNumber,
                                SignPath    = deviceModel.SignPath,
                            };

                            _unitOfWork.DeviceRepo.Insert(TblDevice);
                            _unitOfWork.Save();
                            scope.Complete();
                        }
                    }

                    flag = true;
                }
                if (flag)
                {
                    return(user.FirstOrDefault());
                }
                else
                {
                    tblAppUser emptyUser = new tblAppUser();
                    return(emptyUser);
                }
            }
            catch (Exception ex)
            {
                CustomLogger.LogError("AuthRepository in RegisterUser " + Convert.ToString(ex.Message));
                CustomLogger.SendExcepToDB(ex, "AuthRepository");

                throw;
            }
            finally
            {
            }
        }
Пример #6
0
        //public tblAppUser Register()
        //{
        //    string sPath = "";
        //    sPath = System.Web.Hosting.HostingEnvironment.MapPath("~/locker/");
        //    DevicesEntity deviceModel = new DevicesEntity();
        //    tblAppUser result = new tblAppUser();
        //    System.Web.HttpPostedFile hpf = HttpContext.Current.Request.Files["Image"];
        //    deviceModel.DeviceId = Convert.ToString(HttpContext.Current.Request.Form["DeviceId"]);
        //    deviceModel.EmailId = Convert.ToString(HttpContext.Current.Request.Form["EmailId"]);
        //    deviceModel.PhoneNumber = Convert.ToString(HttpContext.Current.Request.Form["PhoneNumber"]);
        //    //deviceModel.SignPath = System.Text.Encoding.ASCII.GetBytes(HttpContext.Current.Request.Form["Image"]);
        //    deviceModel.SignPath = null;
        //    deviceModel.OTP = "999999";
        //    if (hpf != null)
        //    {
        //        try
        //    {

        //        // deviceModel.UserId = Convert.ToString(HttpContext.Current.Request.Form["UserId"]);

        //        if (hpf.ContentLength > 0)
        //        {

        //            string fileType = hpf.ContentType;
        //            Stream file_Strm = hpf.InputStream;
        //            string file_Name = Path.GetFileName(hpf.FileName);
        //            int fileSize = hpf.ContentLength;
        //            byte[] fileRcrd = new byte[fileSize];
        //            file_Strm.Read(fileRcrd, 0, fileSize);


        //            Stream fs = hpf.InputStream;
        //            BinaryReader br = new BinaryReader(fs);
        //            Byte[] bytes = br.ReadBytes((Int32)fs.Length);
        //            deviceModel.SignPath = bytes;
        //        }



        //        result = _authRepository.RegisterUser(deviceModel);
        //        return result;
        //    }
        //    catch (Exception ex)
        //    {

        //        throw new ApiDataException(2000, "Technical error occured, Please contact administrator", HttpStatusCode.InternalServerError);

        //    }
        //    }
        //    else
        //    {
        //        throw new ApiDataException(1004, "Image is not selected", HttpStatusCode.InternalServerError);
        //    }

        //}
        public tblAppUser Register()
        {
            string sPath = "";

            sPath = System.Web.Hosting.HostingEnvironment.MapPath("~/locker/");
            DevicesEntity deviceModel = new DevicesEntity();
            tblAppUser    result      = new tblAppUser();

            // System.Web.HttpPostedFile hpf = HttpContext.Current.Request.Files["Image"];
            deviceModel.DeviceId    = Convert.ToString(HttpContext.Current.Request.Form["DeviceId"]);
            deviceModel.EmailId     = Convert.ToString(HttpContext.Current.Request.Form["EmailId"]);
            deviceModel.PhoneNumber = Convert.ToString(HttpContext.Current.Request.Form["PhoneNumber"]);
            deviceModel.SignPath    = Convert.ToString(HttpContext.Current.Request.Form["Image"]);
            // deviceModel.SignPath = null;
            deviceModel.OTP = "999999";
            //  if (hpf != null)
            //  {
            try
            {
                // deviceModel.UserId = Convert.ToString(HttpContext.Current.Request.Form["UserId"]);

                //  if (hpf.ContentLength > 0)
                // {

                //string fileType = hpf.ContentType;
                //Stream file_Strm = hpf.InputStream;
                //string file_Name = Path.GetFileName(hpf.FileName);
                //int fileSize = hpf.ContentLength;
                //byte[] fileRcrd = new byte[fileSize];
                //file_Strm.Read(fileRcrd, 0, fileSize);


                //   Stream fs = hpf.InputStream;
                // BinaryReader br = new BinaryReader(fs);
                //  Byte[] bytes = br.ReadBytes((Int32)fs.Length);
                // deviceModel.SignPath = bytes;
                //  }



                result = _authRepository.RegisterUser(deviceModel);
                return(result);
            }
            catch (Exception ex)
            {
                throw new ApiDataException(2000, "Technical error occured, Please contact administrator", HttpStatusCode.InternalServerError);
            }
            // }
            //else
            // {
            // throw new ApiDataException(1004, "Image is not selected", HttpStatusCode.InternalServerError);
            // }
        }