public long InsertUser_SuperAdmin(LoginSignUp objInsertUser)
        {
            long returnCode = -1;

            try
            {
                List <MySqlParameter> parameters = new List <MySqlParameter>
                {
                    new MySqlParameter("SAName", objInsertUser.Name),
                    new MySqlParameter("UserName", objInsertUser.UserName),
                    new MySqlParameter("Pswd", objInsertUser.Password),
                    new MySqlParameter("ConfirmPswd", objInsertUser.ConfirmPassword),
                    new MySqlParameter("PhNo", objInsertUser.PhoneNumber)
                };

                var output = sqlHelper.executeSP <int>(parameters, "SP_InsertUsers_SuperAdmin");
                returnCode = Convert.ToInt64(output);
                return(returnCode);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            // return returnCode;
        }
        public long IsSuperAdminExists(LoginSignUp obj)
        {
            long returnCode = -1;

            try
            {
                List <MySqlParameter> parameters = new List <MySqlParameter>
                {
                    new MySqlParameter("UserN", obj.UserName),
                    new MySqlParameter("Pswd", obj.Password),
                };

                var output = sqlHelper.executeSP <DataSet>(parameters, "SP_IsSAUserExits");
                if (output.Tables[0].Rows.Count > 0)
                {
                    returnCode = 1;
                }
                else
                {
                    returnCode = 0;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(returnCode);
        }
        public IActionResult IsUserExists(LoginSignUp obj)
        {
            List <Admin> lst = new List <Admin>();

            try
            {
                if (!string.IsNullOrEmpty(obj.UserName) && !string.IsNullOrEmpty(obj.Password))
                {
                    lst = objBAL.IsUserExists(obj);
                }
                else
                {
                    return(NotFound("Username & Password not entered"));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            if (lst.Count > 0)
            {
                return(Ok(lst));
            }

            else
            {
                return(NotFound());
            }
        }
        public List <Admin> IsUserExists(LoginSignUp obj)
        {
            List <Admin> lst = new List <Admin>();

            try
            {
                List <MySqlParameter> parameters = new List <MySqlParameter>
                {
                    new MySqlParameter("UserN", obj.UserName),
                    new MySqlParameter("Pswd", obj.Password),
                };

                DataSet ds = sqlHelper.executeSP <DataSet>(parameters, "SP_IsUserExits");
                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        DTtoListConverter.ConvertTo(ds.Tables[0], out lst);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lst);
        }
Beispiel #5
0
        internal async Task <bool> ChangePassword()
        {
            var chgPaswd = new ChangePassword()
            {
                OldPassword     = User.Password,
                NewPassword     = User.NewPassword,
                ConfirmPassword = User.ConfirmNewPassword
            };
            var resp = await LoginSignUp.ChangePassword(chgPaswd);

            return(resp);
        }
Beispiel #6
0
        //Post New  User
        public async void SignUpResidentUsersAsync(LoginSignUp loginSignUp, Residents residents)
        {
            loginSignUp.Role = "user";
            HttpResponseMessage response1 = await client.PostAsJsonAsync("users", loginSignUp);

            if (!response1.IsSuccessStatusCode)
            {
                ////Setting the data to the model
                //return loginDetailsDB = await response.Content.ReadAsAsync<List<LoginSignUp>>();
                Console.WriteLine("Internal server Error");
            }
            HttpResponseMessage response2 = await client.PostAsJsonAsync("userresident", residents);

            if (!response2.IsSuccessStatusCode)
            {
                Console.WriteLine("Internal server Error");
            }
            //return loginDetailsDB = null;
        }
Beispiel #7
0
        public long UpdatePswdSuperAdmin(LoginSignUp obj)
        {
            long returnCode = -1;

            using TransactionScope transactionScope = new TransactionScope();
            try
            {
                returnCode = objDAL.UpdatePswdSA(obj);
                transactionScope.Complete();
                transactionScope.Dispose();
            }
            catch (Exception ex)
            {
                transactionScope.Dispose();
                throw ex;
            }

            return(returnCode);
        }
Beispiel #8
0
        public long SAUserExists(LoginSignUp obj)
        {
            long returnCode = -1;

            using TransactionScope transactionScope = new TransactionScope();
            try
            {
                returnCode = objDAL.IsSuperAdminExists(obj);
                transactionScope.Complete();
                transactionScope.Dispose();
            }
            catch (Exception ex)
            {
                transactionScope.Dispose();
                throw ex;
            }

            return(returnCode);
        }
Beispiel #9
0
        public List <Admin> IsUserExists(LoginSignUp obj)
        {
            List <Admin> lst = new List <Admin>();

            using TransactionScope transactionScope = new TransactionScope();
            try
            {
                lst = objDAL.IsUserExists(obj);
                //  lst[0].TotalDays = Convert.ToInt32((lst[0].EndDate - lst[0].StartDate).TotalDays);
                transactionScope.Complete();
                transactionScope.Dispose();
            }
            catch (Exception ex)
            {
                transactionScope.Dispose();
                throw ex;
            }

            return(lst);
        }
        public long UpdatePswdSA(LoginSignUp objInsertUser)
        {
            long returnCode = -1;

            try
            {
                List <MySqlParameter> parameters = new List <MySqlParameter>
                {
                    new MySqlParameter("user_name", objInsertUser.UserName),
                    new MySqlParameter("password", objInsertUser.Password),
                    new MySqlParameter("confirmpassword", objInsertUser.ConfirmPassword),
                };

                var output = sqlHelper.executeSP <int>(parameters, "SP_Update_SAPassword");
                returnCode = Convert.ToInt64(output);
                return(returnCode);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public IActionResult UpdateSAPassword([FromBody] LoginSignUp obj)
        {
            long returnCode = -1;

            try
            {
                returnCode = objBAL.UpdatePswdSuperAdmin(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            if (returnCode > 0)
            {
                return(Ok(returnCode));
            }

            else
            {
                return(BadRequest());
            }
        }
        public IActionResult IsSAUserExists([FromBody] LoginSignUp obj)
        {
            long returnCode = -1;

            try
            {
                returnCode = objBAL.SAUserExists(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            if (returnCode >= 0)
            {
                return(Ok(returnCode));
            }

            else
            {
                return(BadRequest());
            }
        }
        public IActionResult SuperAdminInsert([FromBody] LoginSignUp obj)
        {
            long returnCode = -1;

            try
            {
                returnCode = objBAL.InsertUser(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            if (returnCode >= 0)
            {
                return(Ok(returnCode));
            }

            else
            {
                return(BadRequest());
            }
        }
Beispiel #14
0
        internal async Task <bool> Register()
        {
            IsSuccess = false;
            using (UserDialogs.Instance.Loading("Registration you.."))
            {
                var reg = new Registeration()
                {
                    Email           = User.EmailAddress,
                    Password        = User.Password,
                    ConfirmPassword = User.ConfirmPin,
                    UserName        = User.Username
                };

                //APIService api = new APIService();
                //var a = await APIService.Post<Registeration>(reg, "api/Account/register");
                //var aa = await LoginSignUp.RegisterLocal(reg);
                var regaa = await LoginSignUp.RegisterLoco(reg);

                //if (a.StatusCode == System.Net.HttpStatusCode.OK)
                //{
                //    var result =await a.Content.ReadAsStringAsync();
                //}
                //else
                //{
                //    var result = await a.Content.ReadAsStringAsync();

                if (regaa.Message != null)
                {
                    if (regaa.Message.ToLower().Contains("success"))
                    {
                        IsSuccess = true;
                    }
                    else
                    {
                        IsSuccess          = false;
                        RegisterationError = regaa.Message;
                        return(IsSuccess);
                    }
                }

                //if (aa == null)
                //{
                //    UserDialogs.Instance.Alert("Info", "Error", "OK");
                //    return IsSuccess;

                //}
                //if (aa.ContainsKey(false))
                //{
                //    UserDialogs.Instance.Alert("Info", "Error during registration", "OK");
                //    return IsSuccess;

                //}
                //else if(aa.ContainsKey(true))
                //{
                //    //UserDialogs.Instance.Alert("Success", "Registration successful", "OK");
                //    IsSuccess = true;
                //    return IsSuccess;

                //}
                //}
                return(IsSuccess);
            }
        }