public bool SaveData(AddClientAppLayer user)
        {
            try
            {
                using (SqlConnection con = new SqlConnection(ConnectSql.GetConnectionString()))
                {
                    con.Open();
                    SqlCommand cmd = new SqlCommand("INSERT INTO AddHospital (HospitalName,Location,Type,AmbulanceNo) Values (@HospitalName,@Location,@Type,@AmbulanceNo)", con);
                    cmd.Parameters.AddWithValue("@HospitalName", user.HospitalName);
                    cmd.Parameters.AddWithValue("@Location", user.Location);
                    cmd.Parameters.AddWithValue("@Type", user.Type);
                    cmd.Parameters.AddWithValue("@AmbulanceNo", user.AmbulanceNo);


                    cmd.ExecuteNonQuery();
                    con.Close();
                }
                return(true);
            }
            catch (Exception ex)
            {
                Log(ex.Message);
                return(false);
            }
        }
Esempio n. 2
0
 internal string SaveVehicleDetails(VehicleDetailsModel objVehicleModel)
 {
     using (SqlConnection con = new SqlConnection(ConnectSql.GetConnectionString()))
     {
         try
         {
             con.Open();
             SqlCommand cmd = new SqlCommand("SpAddVehicle", con);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@VehicleNo", objVehicleModel.VehicleNo);
             cmd.Parameters.AddWithValue("@DriverName", objVehicleModel.DriverName);
             cmd.Parameters.AddWithValue("@LisenceNo", objVehicleModel.LisenceNo);
             cmd.Parameters.AddWithValue("@GPSId", objVehicleModel.GPSId);
             cmd.Parameters.AddWithValue("@Hospital", objVehicleModel.Hospital);
             cmd.Parameters.AddWithValue("@Address", objVehicleModel.Address);
             cmd.Parameters.AddWithValue("@Password", objVehicleModel.Password);
             return((string)cmd.ExecuteScalar());
         }
         catch (Exception ex)
         {
             return(ex.Message);
         }
         finally
         {
             con.Close();
         }
     }
 }
Esempio n. 3
0
        internal List <RegDetails> GetUser()
        {
            List <RegDetails> listUser = new List <RegDetails>();

            using (SqlConnection con = new SqlConnection(ConnectSql.GetConnectionString()))
            {
                con.Open();
                SqlCommand    cmd = new SqlCommand("select*from OwnerRegistration", con);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    while (rdr.Read())
                    {
                        RegDetails User = new RegDetails();
                        User.FirstName = rdr["FirstName"].ToString();
                        User.LastName  = rdr["LastName"].ToString();
                        User.Email     = rdr["Email"].ToString();
                        User.Mobile    = Convert.ToInt64(rdr["MobileNumber"]);
                        User.UserName  = rdr["UserName"].ToString();
                        listUser.Add(User);
                    }
                }
            }
            return(listUser);
        }
Esempio n. 4
0
        public bool SaveData(RegDetails user)
        {
            try
            {
                using (SqlConnection con = new SqlConnection(ConnectSql.GetConnectionString()))
                {
                    con.Open();
                    SqlCommand cmd = new SqlCommand("INSERT INTO OwnerRegistration (FirstName,LastName,Email,Mobile,UserName,Password) Values (@FirstName,@LastName,@Email,@Mobile,@UserName,@Password)", con);
                    cmd.Parameters.AddWithValue("@FirstName", user.FirstName);
                    cmd.Parameters.AddWithValue("@LastName", user.LastName);
                    cmd.Parameters.AddWithValue("@Email", user.Email);
                    cmd.Parameters.AddWithValue("@Mobile", user.Mobile);
                    cmd.Parameters.AddWithValue("@UserName", user.UserName);
                    cmd.Parameters.AddWithValue("@Password", user.Password);

                    cmd.ExecuteNonQuery();
                    con.Close();
                }
                return(true);
            }
            catch (Exception ex)
            {
                Log(ex.Message);
                return(false);
            }
        }
        public bool UpdateUSerDetails(RegDetails ObjRegObject)
        {
            using (SqlConnection con = new SqlConnection(ConnectSql.GetConnectionString()))
            {
                try
                {
                    con.Open();

                    SqlCommand cmd = new SqlCommand("UPDATE REGISTER SET FIRSTNAME=@FirstName,LASTNAME=@LastName,Email=@Email,Mobile=@Mobile,UserName=@UserName Where Email=@Email", con);
                    cmd.Parameters.AddWithValue("@FirstName", ObjRegObject.FirstName);
                    cmd.Parameters.AddWithValue("@LastName", ObjRegObject.LastName);
                    cmd.Parameters.AddWithValue("@Email", ObjRegObject.Email);
                    cmd.Parameters.AddWithValue("@Mobile", ObjRegObject.Mobile);
                    cmd.Parameters.AddWithValue("@UserName", ObjRegObject.UserName);
                    cmd.ExecuteNonQuery();
                    return(true);
                }
                catch
                {
                    return(false);
                }
                finally
                {
                    con.Close();
                }
            }
        }
Esempio n. 6
0
        public string AuthenticateUser(string Username, string Password)
        {
            string Resonse = "NIL";

            using (SqlConnection con = new SqlConnection(ConnectSql.GetConnectionString()))
            {
                try
                {
                    string EncryptedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(Password, "SHA1");
                    con.Open();
                    SqlCommand cmd = new SqlCommand("SpAuthenticateUser", con);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@Email", Username);
                    cmd.Parameters.AddWithValue("@Password", EncryptedPassword);
                    string Response = (string)cmd.ExecuteScalar();
                    if (Response == UserAuthResponse.USER_INACTIVE.ToString())
                    {
                        return("User is not active");
                    }
                    if (Response == UserAuthResponse.USER_DELETED.ToString())
                    {
                        return("User is deleted");
                    }
                    if (Response == UserAuthResponse.USER_BLOCKED.ToString())
                    {
                        return("User is blocked");
                    }
                    if (Response == UserAuthResponse.USER_VALID.ToString())
                    {
                        UserIdentity.username = Username;
                        return("true");
                    }
                    if (Response == UserAuthResponse.USER_INVALID.ToString())
                    {
                        return("invalid credentails");
                    }
                }
                catch (Exception ex)
                {
                    return(ex.Message);
                }
                finally
                {
                    con.Close();
                }
            }

            return(Resonse);
        }
 public bool UserExistingCheck(string EmailId)
 {
     using (SqlConnection con = new SqlConnection(ConnectSql.GetConnectionString()))
     {
         try
         {
             con.Open();
             SqlCommand cmd = new SqlCommand("select * from OwnerRegistration Where Email=@Email", con);
             cmd.Parameters.AddWithValue("@Email", EmailId);
             SqlDataReader rdr = cmd.ExecuteReader();
             return(rdr.HasRows);
         }
         catch (Exception)
         {
             throw;
         }
         finally
         {
             con.Close();
         }
     }
 }
        public bool SaveData(RegDetails user)
        {
            string EncryptedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(user.Password, "SHA1");

            try
            {
                using (SqlConnection con = new SqlConnection(ConnectSql.GetConnectionString()))
                {
                    try
                    {
                        con.Open();
                        SqlCommand cmd = new SqlCommand("SpAddUser", con);
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@FirstName", user.FirstName);
                        cmd.Parameters.AddWithValue("@LastName", user.LastName);
                        cmd.Parameters.AddWithValue("@Email", user.Email);
                        cmd.Parameters.AddWithValue("@Mobile", user.Mobile);
                        cmd.Parameters.AddWithValue("@UserName", user.UserName);
                        cmd.Parameters.AddWithValue("@Password", EncryptedPassword);
                        cmd.ExecuteNonQuery();
                        return(true);
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    finally
                    {
                        con.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                Log(ex.Message);
                return(false);
            }
        }
Esempio n. 9
0
        public bool DeleteUSerDetails(string Email)
        {
            using (SqlConnection con = new SqlConnection(ConnectSql.GetConnectionString()))
            {
                try
                {
                    con.Open();

                    SqlCommand cmd = new SqlCommand("DELETE FROM REGISTER  Where Email=@Email", con);
                    cmd.Parameters.AddWithValue("@Email", Email);
                    cmd.ExecuteNonQuery();
                    return(true);
                }
                catch
                {
                    return(false);
                }
                finally
                {
                    con.Close();
                }
            }
        }