Esempio n. 1
0
        public static bool CheckUser(string userName)
        {
            bool    isUserNameExist;
            UserBAL userBAL = new UserBAL();

            userBAL.UserName = userName;
            isUserNameExist  = userBAL.CheckUserNameExists();

            return(isUserNameExist);
        }
Esempio n. 2
0
        internal DataTable UserSelect(UserBAL userBAL)
        {
            try
            {
                con = Connection.GetConnection();
                cmd = Connection.GetCommand("UserSelect", con);
                cmd.Parameters.AddWithValue("@userId", userBAL.UserId);

                sda = new SqlDataAdapter(cmd);
                sda.Fill(dt);
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        internal int UserInsert(UserBAL userBAL)
        {
            try
            {
                con = Connection.GetConnection();
                cmd = Connection.GetCommand("UserInsert", con);
                con.Open();

                cmd.Parameters.AddWithValue("@firstName", userBAL.FirstName);
                cmd.Parameters.AddWithValue("@lastName", userBAL.LastName);
                cmd.Parameters.AddWithValue("@email", userBAL.Email);
                cmd.Parameters.AddWithValue("@userName", userBAL.UserName);
                cmd.Parameters.AddWithValue("@userPassword", userBAL.UserPassword);
                cmd.Parameters.AddWithValue("@title", userBAL.Title);
                cmd.Parameters.AddWithValue("@officeNo", userBAL.OfficeNo);
                cmd.Parameters.AddWithValue("@mobileNo", userBAL.MobileNo);
                cmd.Parameters.AddWithValue("@userRoleId", userBAL.UserRoleId);
                cmd.Parameters.AddWithValue("@companyId", userBAL.CompanyId);

                cmd.Parameters.AddWithValue("@userId", userBAL.UserId);
                cmd.Parameters["@userId"].Direction = ParameterDirection.InputOutput;

                cmd.ExecuteNonQuery();
                int userId = Convert.ToInt32(cmd.Parameters["@userId"].Value);
                con.Close();

                return(userId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (con.State != ConnectionState.Closed)
                {
                    con.Close();
                }
            }
        }