Beispiel #1
0
        public void AddRole(RoleAttribute Role)
        {
            using (MySqlConnection conn = GetConnection())
            {
                conn.Open();
                MySqlCommand cmd = new MySqlCommand("sp_AddRole", conn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                //  RoleAttributes rol = new RoleAttributes();

                cmd.Parameters.AddWithValue("Employee_Id", Role.Employee_Id);
                cmd.Parameters.AddWithValue("Employee_Name", Role.Employee_Name);
                cmd.Parameters.AddWithValue("Role_Designation", Role.Role_Designation);
                cmd.Parameters.AddWithValue("Role_Description", Role.Role_Description);
                cmd.Parameters.AddWithValue("Role_Status", Role.Role_Status);
                cmd.Parameters.AddWithValue("Role_StartDate", Role.Role_StartDate);
                cmd.Parameters.AddWithValue("Role_EndDate", Role.Role_EndDate);
                // cmd.Parameters.AddWithValue("Role_CreatedBy", Role.Role_CreatedBy);
                //  cmd.Parameters.AddWithValue("Role_CreatedDate", Role.Role_CreatedDate);
                // cmd.Parameters.AddWithValue("Role_LastUpdatedBy", Role.Role_LastUpdatedBy);
                // cmd.Parameters.AddWithValue("Role_LastUpdatedDate", Role.Role_LastUpdatedDate);


                cmd.ExecuteNonQuery();
                conn.Close();
            }
        }
        public int UpdateRole(RoleAttribute role)
        {
            using (MySqlConnection conn = GetConnection())
            {
                MySqlCommand cmd = new MySqlCommand("sp_UpdateRole", conn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("emp_Id", role.Employee_Id);
                cmd.Parameters.AddWithValue("Employee_Name", role.Employee_Name);
                cmd.Parameters.AddWithValue("Role_Designation", role.Role_Designation);
                cmd.Parameters.AddWithValue("Role_Description", role.Role_Description);
                cmd.Parameters.AddWithValue("Role_Status", role.Role_Status);
                cmd.Parameters.AddWithValue("Role_StartDate", role.Role_StartDate);
                cmd.Parameters.AddWithValue("Role_EndDate", role.Role_EndDate);
                conn.Open();
                cmd.ExecuteNonQuery();
                conn.Close();
            }
            return(1);
        }