Beispiel #1
0
        //update ops manager
        public void UpdateOps(OpsManager ops)
        {
            using (SqlConnection con = new SqlConnection(connectionString))
            {
                SqlCommand cmd = new SqlCommand("spUpdateOps", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@OpsManagerID", ops.OpsManagerID);
                cmd.Parameters.AddWithValue("@OpsManagerFirstName", ops.OpsManagerFirstName);
                cmd.Parameters.AddWithValue("@OpsManagerLastName", ops.OpsManagerLastName);
                cmd.Parameters.AddWithValue("@OpsManagerAddress", ops.OpsManagerAddress);
                cmd.Parameters.AddWithValue("@OpsManagerCity", ops.OpsManagerCity);
                cmd.Parameters.AddWithValue("@OpsManagerState", ops.OpsManagerState);
                cmd.Parameters.AddWithValue("@OpsManagerZipcode", ops.OpsManagerZipcode);
                cmd.Parameters.AddWithValue("@OpsManagerPhoneNumber", ops.OpsManagerPhoneNumber);
                cmd.Parameters.AddWithValue("@OpsManagerJobTitle", ops.JobTitle);

                cmd.Parameters.AddWithValue("@OpsManagerUserName", ops.OpsManagerUserName);
                cmd.Parameters.AddWithValue("@OpsManagerPassword", ops.OpsManagerPassword);

                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();
            }
        }
Beispiel #2
0
        //get all opsmanagers
        public IEnumerable <OpsManager> GetAllOps()
        {
            List <OpsManager> lstOps = new List <OpsManager>();

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                string     SqlQuery = "SELECT * FROM OpsManager";
                SqlCommand cmd      = new SqlCommand(SqlQuery, con);

                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    OpsManager ops = new OpsManager();


                    ops.OpsManagerID          = Convert.ToInt32(rdr["OpsManagerID"]);
                    ops.OpsManagerFirstName   = rdr["OpsManagerFirstName"].ToString();
                    ops.OpsManagerLastName    = rdr["OpsManagerLastName"].ToString();
                    ops.OpsManagerAddress     = rdr["OpsManagerAddress"].ToString();
                    ops.OpsManagerCity        = rdr["OpsManagerCity"].ToString();
                    ops.OpsManagerState       = rdr["OpsManagerState"].ToString();
                    ops.OpsManagerZipcode     = Convert.ToInt32(rdr["OpsManagerZipcode"]);
                    ops.OpsManagerPhoneNumber = rdr["OpsManagerPhoneNumber"].ToString();
                    ops.JobTitle           = rdr["OpsManagerJobTitle"].ToString();
                    ops.OpsManagerUserName = rdr["OpsManagerUserName"].ToString();
                    ops.OpsManagerPassword = rdr["OpsManagerPassword"].ToString();

                    lstOps.Add(ops);
                }
                con.Close();
            }
            return(lstOps);
        }
Beispiel #3
0
        //get one ops
        public OpsManager GetOpsManager(int?OpsManagerID)
        {
            OpsManager ops = new OpsManager();

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                string     SqlQuery = "SELECT * FROM OpsManager WHERE OpsManagerID = " + OpsManagerID;
                SqlCommand cmd      = new SqlCommand(SqlQuery, con);

                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    ops.OpsManagerID          = Convert.ToInt32(rdr["OpsManagerID"]);
                    ops.OpsManagerFirstName   = rdr["OpsManagerFirstName"].ToString();
                    ops.OpsManagerLastName    = rdr["OpsManagerLastName"].ToString();
                    ops.OpsManagerAddress     = rdr["OpsManagerAddress"].ToString();
                    ops.OpsManagerCity        = rdr["OpsManagerCity"].ToString();
                    ops.OpsManagerState       = rdr["OpsManagerState"].ToString();
                    ops.OpsManagerZipcode     = Convert.ToInt32(rdr["OpsManagerZipcode"]);
                    ops.OpsManagerPhoneNumber = rdr["OpsManagerPhoneNumber"].ToString();
                    ops.JobTitle           = rdr["OpsManagerJobTitle"].ToString();
                    ops.OpsManagerUserName = rdr["OpsManagerUserName"].ToString();
                    ops.OpsManagerPassword = rdr["OpsManagerPassword"].ToString();
                }

                return(ops);
            }
        }
Beispiel #4
0
        public OpsManager OpsManagerLogin(string UserName, string Password)
        {
            OpsManager opsManager = new OpsManager();

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                string     SqlQuery = "SELECT OpsManagerID FROM OpsManager WHERE OpsManagerUserName = '******' AND OpsManagerPassword = '******'";
                SqlCommand cmd      = new SqlCommand(SqlQuery, con);

                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    opsManager.OpsManagerID = Convert.ToInt32(rdr["OpsManagerID"]);
                    Session.OpsManagerID    = opsManager.OpsManagerID;
                }
            }
            return(opsManager);
        }