コード例 #1
0
        public UserDetails[] ForgotPassword(Stream message)
        {
            UserDetails objInput = JSonHelper.JsonDeserialize<UserDetails>(new StreamReader(message).ReadToEnd());
            if (System.Configuration.ConfigurationManager.AppSettings[objInput.Pin] == null)
            {
                var objArray = new UserDetails[1];
                UserDetails objDetails = new UserDetails();
                objDetails.UserId = "";
                objDetails.MessengerMessage = "Invalid PIN";
                objArray[0] = objDetails;
                return objArray;
            }
            if (objInput.Pin != null && objInput.Pin.Length <= 0)
            {
                var objArray = new UserDetails[1];
                UserDetails objDetails = new UserDetails();
                objDetails.UserId = "";
                objDetails.MessengerMessage = "Pin is a required field";
                objArray[0] = objDetails;
                return objArray;
            }
            else
            {
                var objArray = new UserDetails[1];
                UserInfo oUserInfo = new UserInfo();
                oUserInfo.EmailId = objInput.UserName;
                oUserInfo.pin = System.Configuration.ConfigurationManager.AppSettings[objInput.Pin].ToString();
                UserBLL oUser = new UserBLL();
                UserInfo ouserinfo = oUser.getUserDetailsByEmailId(oUserInfo.EmailId, oUserInfo.pin);
                if (ouserinfo != null && ouserinfo.UserId > 0)
                {
                    UserDetails objDetails = new UserDetails();
                    objDetails.UserId = ouserinfo.UserId.ToString();
                    objDetails.MessengerMessage = "";
                    objDetails.SecurityQuestion1 = ouserinfo.SecurityQuestion1;
                    objDetails.SecurityQuestion2 = ouserinfo.SecurityQuestion2;
                    objDetails.SecurityQuestion3 = ouserinfo.SecurityQuestion3;
                    objDetails.SecurityAnswer1 = ouserinfo.SecurityAnswer1;
                    objDetails.SecurityAnswer2 = ouserinfo.SecurityAnswer2;
                    objDetails.SecurityAnswer3 = ouserinfo.SecurityAnswer3;


                    objArray[0] = objDetails;
                    return objArray;
                }
                else
                {
                    objArray = new UserDetails[1];
                    UserDetails objDetails = new UserDetails();
                    objDetails.UserId = "";
                    objDetails.MessengerMessage = "User not found";
                    objArray[0] = objDetails;
                    return objArray;
                }
            }
        }
コード例 #2
0
        public string Enroll(Stream message)
        {
            try
            {
                Enrollment objInput = JSonHelper.JsonDeserialize<Enrollment>(new StreamReader(message).ReadToEnd());
                if (System.Configuration.ConfigurationManager.AppSettings[objInput.Pin] == null)
                {


                    return "Invalid PIN";
                }
                if (objInput.Pin != null && objInput.Pin.Length > 0)
                {
                    UserBLL oUser1 = new UserBLL();
                    UserInfo _UserInfo1 = new UserInfo();
                    System.Data.DataSet ds = new System.Data.DataSet();
                    _UserInfo1.PracticeTin = objInput.PracticeTin;
                    _UserInfo1.PracticeName = objInput.PracticeName;
                    _UserInfo1.pin = System.Configuration.ConfigurationManager.AppSettings[objInput.Pin].ToString();
                    ds = oUser1.getpracticename1(objInput.PracticeTin);
                    int iPracticeID = 0;
                    int iLocationID = 0;

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        iPracticeID = Convert.ToInt32(ds.Tables[0].Rows[0]["ProviderId"].ToString());

                        System.Data.DataSet dslocation = oUser1.getLocationDetails(objInput.PracticeTin);
                        iLocationID = Convert.ToInt32(dslocation.Tables[0].Rows[0]["LocationId"].ToString());
                    }
                    else
                    {
                        int i = oUser1.insertPractice(_UserInfo1);
                        if (i > 0)
                        {
                            ds = oUser1.getpracticename1(objInput.PracticeTin);

                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                iPracticeID = Convert.ToInt32(ds.Tables[0].Rows[0]["ProviderId"].ToString());
                                System.Data.DataSet dslocation = oUser1.getLocationDetails(objInput.PracticeTin);
                                if (dslocation.Tables[0].Rows.Count <= 0)
                                {

                                    _UserInfo1.LocationName = objInput.LocationName;
                                    _UserInfo1.OrganisationName = objInput.OrganizationType;
                                    _UserInfo1.practicephone = objInput.PracticePhone;
                                    _UserInfo1.PracticeAddress = objInput.Address;
                                    _UserInfo1.practiceFax = objInput.PracticeFax;
                                    _UserInfo1.PracticeCity = objInput.City;
                                    _UserInfo1.PracticeState = objInput.State;
                                    _UserInfo1.PracticeZip = objInput.State;


                                    _UserInfo1.ProviderId = Convert.ToInt32(ds.Tables[0].Rows[0]["ProviderId"].ToString());
                                    int j = oUser1.insertLocationDetails(_UserInfo1);

                                    dslocation = oUser1.getLocationDetails(objInput.PracticeTin);
                                    iLocationID = Convert.ToInt32(dslocation.Tables[0].Rows[0]["LocationId"].ToString());
                                }
                                else
                                {
                                    iLocationID = Convert.ToInt32(ds.Tables[0].Rows[0]["LocationId"].ToString());
                                }

                            }
                        }
                    }

                    if (iPracticeID > 0 && iLocationID > 0)
                    {
                        _UserInfo1.PhysicianId = 0;
                        _UserInfo1.ProviderId = iPracticeID;
                        _UserInfo1.PhyOfficeName = objInput.PracticeName;
                        _UserInfo1.fname = objInput.FirstName;
                        _UserInfo1.lname = objInput.LastName;
                        _UserInfo1.UserType = 2;
                        _UserInfo1.UserRole = 2;
                        _UserInfo1.EmailId = objInput.EmailAddress;
                        _UserInfo1.Password = objInput.Password;
                        _UserInfo1.EmailAddress = objInput.EmailAddress;
                        _UserInfo1.DirectEmail = "";
                        _UserInfo1.practicephone = objInput.PracticePhone;
                        _UserInfo1.LocationIds = iLocationID.ToString();
                        _UserInfo1.SecurityQuestion1 = objInput.SecurityQuestion1;
                        _UserInfo1.SecurityQuestion2 = objInput.SecurityQuestion2;
                        _UserInfo1.SecurityQuestion3 = objInput.SecurityQuestion3;
                        _UserInfo1.SecurityAnswer1 = objInput.SecurityAnswer1;
                        _UserInfo1.SecurityAnswer2 = objInput.SecurityAnswer2;
                        _UserInfo1.SecurityAnswer3 = objInput.SecurityAnswer3;
                        UserInfo info1 = oUser1.getUserDetailsByEmailId(objInput.EmailAddress, _UserInfo1.pin);
                        if (info1.UserId > 0)
                        {
                            return "User already exists";
                        }
                        else
                        {
                            int success = oUser1.insertuserfromEnrollment(_UserInfo1);
                            return "Enrollment Sucessful";
                        }

                    }
                    return "Unable to enroll. please try again later";
                }
                else
                {
                    return "Pin is a required field";
                }
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
        }